From a8b809d2605b611546dc4bde5392019604142b86 Mon Sep 17 00:00:00 2001 From: GLDRoger <130458023+GLDRoger@users.noreply.github.com> Date: Sat, 28 Nov 2026 05:08:13 +0000 Subject: [PATCH] fix(kin): notices and memory-failure lines end in what a person can do The last-resort chat notice told a person to send their message again even for faults a resend cannot fix, and six memory-failure lines named no step. The agent's update refusal with no reason shared the person's sentence and spoke of "your message". Each now says what Kin does next or what to do, and every claim about Kin was checked against the code (two proposed claims were not true and were rewritten). People-change: when Kin can't post an agent's reply for an unexpected reason, the chat now says Kin logged why and to ask again, then tell whoever looks after Kin if it repeats; memory problems told to the owner now say what Kin does next or whom to ask. Co-Authored-By: Claude Opus 5.5 --- .../src/kin/memory/writeFailure.test.ts | 30 +++++++++++++++++++ apps/server/src/kin/memory/writeFailure.ts | 16 ++++++---- .../src/kin/reply/KinReplyBridge.test.ts | 22 +++++++++++++- apps/server/src/kin/reply/KinReplyBridge.ts | 9 ++++-- verification/kin/reply/README.md | 2 ++ 5 files changed, 70 insertions(+), 9 deletions(-) diff --git a/apps/server/src/kin/memory/writeFailure.test.ts b/apps/server/src/kin/memory/writeFailure.test.ts index 85c3f67d318bf..231ccd16dfd6a 100644 --- a/apps/server/src/kin/memory/writeFailure.test.ts +++ b/apps/server/src/kin/memory/writeFailure.test.ts @@ -166,3 +166,33 @@ it.effect.each([ assert.deepStrictEqual(seen, told === undefined ? [] : [told]); }), ); + +// Each of these names what Kin does next or what the owner can do; the claims are the code's. +it.each([ + [ + "remote", + "Kin couldn't send the memory changes to the online copy. What is already saved on this server goes up with the next memory change; if this stays, ask whoever looks after Kin to check the memory repository's access.", + ], + [ + "review", + "GitHub didn't accept Kin's memory changes. They are kept on this server; ask whoever looks after Kin to check the memory repository's rules on GitHub.", + ], + [ + "online-conflict", + "Kin couldn't combine the memory changes made on GitHub with the ones saved here, so both are kept apart. Ask whoever looks after Kin to settle the two in the memory repository.", + ], + [ + "scanner", + "Kin didn't save a memory update because the check for passwords and keys couldn't finish, and it saves nothing unchecked. If this stays, ask whoever looks after Kin to check it.", + ], + [ + "purged-history", + "Kin dropped a pending memory update because memory history was rewritten. If it mattered, tell the agent again.", + ], + [ + "dream-remote", + "Kin couldn't send the nightly memory update to the online copy. Nothing Kin already remembered was lost, and tonight it reads the same days again; if this stays, ask whoever looks after Kin to check the memory repository's access.", + ], +] as const)("tells the owner what comes next after %s", (kind, words) => { + assert.strictEqual(MEMORY_WRITE_FAILURE_WORDS[kind], words); +}); diff --git a/apps/server/src/kin/memory/writeFailure.ts b/apps/server/src/kin/memory/writeFailure.ts index 2b9083fc67b1d..163a626bd89da 100644 --- a/apps/server/src/kin/memory/writeFailure.ts +++ b/apps/server/src/kin/memory/writeFailure.ts @@ -17,15 +17,17 @@ export const MEMORY_WRITE_FAILURE_WORDS = { "Kin couldn't save memory changes because memory isn't set up to accept them here. Ask whoever looks after Kin to check it.", purge: "Kin couldn't save memory changes while older information was being removed from memory.", changed: "Kin couldn't save a memory update because memory changed while Kin was working on it.", - remote: "Kin couldn't send the memory changes to the online copy.", - review: "GitHub didn't accept Kin's memory changes.", + remote: + "Kin couldn't send the memory changes to the online copy. What is already saved on this server goes up with the next memory change; if this stays, ask whoever looks after Kin to check the memory repository's access.", + review: + "GitHub didn't accept Kin's memory changes. They are kept on this server; ask whoever looks after Kin to check the memory repository's rules on GitHub.", "online-conflict": - "Kin couldn't combine the memory changes made on GitHub with the ones saved here.", + "Kin couldn't combine the memory changes made on GitHub with the ones saved here, so both are kept apart. Ask whoever looks after Kin to settle the two in the memory repository.", "review-needed": "GitHub requires a review before it accepts Kin's memory changes. Check the memory repository's review rules on GitHub; Kin tries again once the rules change or the server restarts.", secret: "Kin didn't save a memory update because it may contain a password or key.", scanner: - "Kin held a memory update back because the check for passwords and keys couldn't finish.", + "Kin didn't save a memory update because the check for passwords and keys couldn't finish, and it saves nothing unchecked. If this stays, ask whoever looks after Kin to check it.", note: "Kin couldn't save a memory update because a memory note couldn't be read.", journal: "Kin couldn't save a journal entry because its date or time zone couldn't be read.", storage: @@ -65,12 +67,14 @@ export const MEMORY_WRITE_FAILURE_WORDS = { "index-generated": "Kin builds the memory index automatically, so the nightly update couldn't write it directly.", "undo-target": "Kin couldn't identify the change to undo in memory.", - "purged-history": "Kin dropped a pending memory update because memory history was rewritten.", + "purged-history": + "Kin dropped a pending memory update because memory history was rewritten. If it mattered, tell the agent again.", "off-github": "Kin couldn't open a review for the memory update because the online copy isn't on GitHub.", "dream-base": "Kin couldn't finish the nightly memory update because the earlier version it read is gone.", - "dream-remote": "Kin couldn't send the nightly memory update to the online copy.", + "dream-remote": + "Kin couldn't send the nightly memory update to the online copy. Nothing Kin already remembered was lost, and tonight it reads the same days again; if this stays, ask whoever looks after Kin to check the memory repository's access.", "dream-changed": "Kin couldn't save the nightly memory update because memory changed while it ran.", "missing-note": "Kin couldn't find the memory note it needed to update.", diff --git a/apps/server/src/kin/reply/KinReplyBridge.test.ts b/apps/server/src/kin/reply/KinReplyBridge.test.ts index 3c7a496d3dbb2..eb9649449cf9b 100644 --- a/apps/server/src/kin/reply/KinReplyBridge.test.ts +++ b/apps/server/src/kin/reply/KinReplyBridge.test.ts @@ -3846,6 +3846,26 @@ it.effect.each([ }).pipe(Effect.provide(layer)), ); +it.effect("an update refused for a reason Kin didn't give reads the agent's own fallback", () => + Effect.gen(function* () { + const { bridge, orgId, wakeupId, sql, posted } = yield* setupSend({ + ask: "Is the loading slot booked?", + }); + // Malformed event JSON makes the stop check fail with an error that carries no reason. + yield* sql`UPDATE kin_events SET state = 'done', json = '{' WHERE wakeup_id = ${wakeupId}`; + const before = yield* posted; + const refused = yield* Effect.flip( + bridge.update({ orgId, wakeupId, text: "Checking the loading slot." }), + ); + assert.strictEqual(refused.reason, "withheld"); + assert.strictEqual( + refused.message, + "Not shown, for a reason Kin didn't give; your message stays as it was posted. Don't try the same update again.", + ); + assert.deepStrictEqual(yield* posted, before); + }).pipe(Effect.provide(layer)), +); + it.effect( "a progress update restarts the working timer when its old deadline falls during the post", () => @@ -4834,7 +4854,7 @@ it.effect("an unknown refusal shows Retry and logs the rejecting error once", () yield* expectWithheldNotice( turn, "kin-no-reply", - "Finance's reply couldn't be posted: Kin couldn't save it. Send your message again.", + "Finance's reply couldn't be posted: Kin couldn't post it for a reason it didn't expect, and logged why. Ask again, and if this line comes back, tell whoever looks after Kin.", ); assert.deepStrictEqual( logs.filter( diff --git a/apps/server/src/kin/reply/KinReplyBridge.ts b/apps/server/src/kin/reply/KinReplyBridge.ts index 678b5a56a0507..f3642a464f7a3 100644 --- a/apps/server/src/kin/reply/KinReplyBridge.ts +++ b/apps/server/src/kin/reply/KinReplyBridge.ts @@ -316,7 +316,9 @@ class KinReplyUpdateError extends Schema.TaggedError()("Kin }) { override get message() { return this.reason === "withheld" - ? `Not shown: ${this.why ?? WITHHELD_ANY}` + ? this.why === undefined + ? UPDATE_WITHHELD_ANY + : `Not shown: ${this.why}` : UPDATE_REFUSALS[this.reason]; } } @@ -362,7 +364,10 @@ type Ending = type Outcome = "held" | "posted" | "note" | "empty" | "withheld" | "dropped"; -const WITHHELD_ANY = "Kin couldn't save it. Send your message again."; +const WITHHELD_ANY = + "Kin couldn't post it for a reason it didn't expect, and logged why. Ask again, and if this line comes back, tell whoever looks after Kin."; +const UPDATE_WITHHELD_ANY = + "Not shown, for a reason Kin didn't give; your message stays as it was posted. Don't try the same update again."; type Withheld = { readonly _tag: "withheld"; readonly reason: KinChatError["reason"] | "wake-up ended" | "past_its_day"; diff --git a/verification/kin/reply/README.md b/verification/kin/reply/README.md index 16a96cce3716e..725bd68cfe1d2 100644 --- a/verification/kin/reply/README.md +++ b/verification/kin/reply/README.md @@ -92,3 +92,5 @@ The guard "Steer waits after a Stop" (rule 12) now rests on code, from kin's `15 **Re-confirmed 2026-11-28** on train 8 (six steps joined on train 7's tip `ed128889faf`; no spec change, all 17 rules hold over 1,554,826 states in 421 s; 28/28 variants caught in 39 s). Two covered files change. `KinEventQueue.ts`, by step 2 only (re-confirmed above at its own head): `claim` lets a held check-in give its turn to the owner's requests that were waiting when its hold released; the page is still claimed apart from every message and takes no steer. `WakeupRunner.ts`, by step 3 only: a morning or evening check-in's prompt is built with its live-state reader and a flag that its facts already carry `now`, inside the mail rule hold catch, so no reply, failure line, rescue, requeue or Stop step changes. **Re-confirmed 2026-11-28** on train 9b (bills from mail, its fix round and the eval-case fixes, ten steps joined on kin `dd13db0eddc`; no spec change, all 17 rules hold over 1,554,826 states in 436 s; 28/28 variants caught in 40 s). Three covered files change. `classify.ts` gains working-line labels for `mail_rule` ("Suggesting a mail rule") and `bill_cut` ("Splitting a page of bills"), and a `bills` opening phrase, "Reading bills". `KinReplyBridge.ts` `begin` takes an optional `bills` flag and opens the live line on that phrase instead of "Looking at what you sent" or "Thinking"; `WakeupRunner.ts` sets it when every event of the wake-up is `bills.read`. Each only picks which words the presence line shows first: no reply, failure line, rescue, requeue or Stop step changes. + +**Re-confirmed 2026-11-28** against the notice words (`fix/kin-end-words-notices`, on kin `73a62308020`; no spec change, all 17 rules hold over 1,554,826 states in 490 s; 28/28 variants caught in 45 s). The one covered file it changes, `KinReplyBridge.ts`, changes only words: the last-resort chat line after an unexpected refusal (`WITHHELD_ANY`) and a separate fallback for an agent's update refused with no reason. The plain failure line is still posted once, at the same step and with the same Retry id, so no reply, failure line, rescue, requeue or Stop step changes.