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 86c8064bca9e0..1c20745824b20 100644 --- a/verification/kin/reply/README.md +++ b/verification/kin/reply/README.md @@ -96,3 +96,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 10 (five steps joined on kin `252c46ce43d`: the start-it-later card's close reason and its screens, the chat feed fixes, and the smaller bill pictures with their screens; no spec change, all 17 rules hold over 1,554,826 states in 449 s; 28/28 variants caught in 40 s). The one covered file changed, `WakeupRunner.ts`, by step 4 only, and only in the bills-only lane: a claimed wake-up whose every event is `bills.read` prepares its photos before its prompt (`Bills.prepareClaimedPhotos`), tells a damaged photo unreadable and drops it from the event, and finishes as completed when none is left, as an event gone before its turn already does. A bills turn queued before this change reads its photos the old way (`billPhotoMode` "legacy"), the bills settle step gets the file services it now needs, and the live line's `bills` flag is set for the same turns as before. No reply, failure line, rescue, requeue, nudge or Stop step changes. **Re-confirmed 2026-11-28** against the facts-and-answers wording (`fix/kin-end-words-facts-and-answers`, on kin `73a62308020`; no spec change, all 17 rules hold over 1,554,826 states in 495 s; 28/28 variants caught in 45 s). The one covered file changed, `lead/Audience.ts`, changes only the words of `SHARED_REFUSAL`, the answer a refused tool call gets in a chat other people read. No claim, 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.