Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions apps/server/src/kin/layer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ const probe = WsRpcGroup.omit(
tag !== WS_METHODS.serverProbe,
),
);
// Each case is about Kin's own "Kin disabled" line; other services log at startup too.
const kinDisabled = (logs: ReadonlyArray<unknown>) =>
logs.filter(
(message) =>
Array.isArray(message) &&
typeof message[0] === "string" &&
message[0].startsWith("Kin disabled"),
);
const group = RpcGroup.make(...KinChatRpcs, ...probe.requests.values()).middleware(
RpcScopeAuthorization,
);
Expand Down Expand Up @@ -97,10 +105,11 @@ it.effect.each(["identity", "defect", "unconfigured"] as const)(
),
),
);
assert.strictEqual(logs.length, mode === "unconfigured" ? 0 : 1);
assert.strictEqual(kinDisabled(logs).length, mode === "unconfigured" ? 0 : 1);
if (mode === "identity")
assert.include(JSON.stringify(logs), "restore the reserved identity");
if (mode === "defect") assert.include(JSON.stringify(logs), "private SQL defect");
assert.include(JSON.stringify(kinDisabled(logs)), "restore the reserved identity");
if (mode === "defect")
assert.include(JSON.stringify(kinDisabled(logs)), "private SQL defect");
assert.isTrue(Option.isNone(kin.services));
const handlers = yield* makeKinChatHandlers(session).pipe(
Effect.provideService(Kin.KinServer, kin),
Expand Down Expand Up @@ -225,9 +234,11 @@ it.effect.each(["disabled", "invalid", "failed"] as const)(
assert.isDefined(management.sendToThread);
}).pipe(Effect.provide(runtime));
assert.deepStrictEqual(seen, [input]);
assert.strictEqual(logs.length, mode === "disabled" ? 0 : 1);
if (mode === "invalid") assert.include(JSON.stringify(logs), "invalid KIN_ENABLED");
if (mode === "failed") assert.include(JSON.stringify(logs), "Kin migration defect");
assert.strictEqual(kinDisabled(logs).length, mode === "disabled" ? 0 : 1);
if (mode === "invalid")
assert.include(JSON.stringify(kinDisabled(logs)), "invalid KIN_ENABLED");
if (mode === "failed")
assert.include(JSON.stringify(kinDisabled(logs)), "Kin migration defect");
assert.deepStrictEqual(
yield* sql`SELECT name FROM sqlite_master WHERE name GLOB 'kin_*' ORDER BY name`,
[],
Expand Down
8 changes: 6 additions & 2 deletions apps/server/src/kin/lead/LeadMemory.shared.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -827,10 +827,14 @@ it.effect(
const found = yield* service.search(scopeOf(leads.o), { kind: "deferral" });
assert.deepInclude(found[0], { id: KinMemoryItemId.make("def-drop"), agent: finance });

// Not after outside text, whether read in this turn or followed from another.
// Not after outside text, whether read in this turn (the outside refusal comes first) or
// followed from another.
yield* sql`INSERT INTO kin_wakeup_outside_reads (org_id, wakeup_id, read_at, source)
VALUES (${orgId}, ${`wake-${leads.o}`}, 0, 'mail:invented')`;
assert.strictEqual((yield* Effect.flip(cancel(leads.o, "def-drop"))).message, notMine);
assert.strictEqual(
(yield* Effect.flip(cancel(leads.o, "def-drop"))).message,
OUTSIDE_REFUSAL,
);
yield* sql`DELETE FROM kin_wakeup_outside_reads WHERE org_id = ${orgId}`;
yield* sql`INSERT INTO kin_event_outside (org_id, event_id, outside_from)
VALUES (${orgId}, ${`follows:wake-${leads.o}`}, 'mail:invented')`;
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/kin/lead/OutsideContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const OUTSIDE_REFUSAL =
"This turn read text from a connected service, so it can't do this now. Offer it to the owner with kin_ask instead; their tap starts it in a fresh turn. Next time, start the work before you read it.";

export const OUTSIDE_SCHEDULE_REFUSAL =
"This turn read text from a connected service, so it can't set up a schedule now. Say what you would set up and ask for a reply in the owner's own words to go ahead. The owner's next message can start it.";
"This turn read text from a connected service, so it can't set up a schedule now. Say what you would set up and ask the owner to type a go-ahead. Don't offer a kin_ask card: a tap can't set up a schedule. The owner's next message can.";

/** What every tool but reading and answering here gets, once a shared turn read a repo. */
export const REPO_READ_REFUSAL = (name: string | undefined) =>
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/kin/mcp/layer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2115,7 +2115,7 @@ it.effect.each([true, false])(
expect
.soft(yield* call("kin_schedule", laterRun))
.toContain(
"This turn read text from a connected service, so it can't set up a schedule now. Say what you would set up and ask for a reply in the owner's own words to go ahead. The owner's next message can start it.",
"This turn read text from a connected service, so it can't set up a schedule now. Say what you would set up and ask the owner to type a go-ahead. Don't offer a kin_ask card: a tap can't set up a schedule. The owner's next message can.",
);
expect
.soft(yield* call("kin_cancel", { itemId: "earlier-routine", sourceEventId }))
Expand Down
4 changes: 2 additions & 2 deletions evals/mcp-tool-use/cases/kin.ndjson

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions scripts/kin-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const MODEL_COVERS: Readonly<Record<string, ReadonlyArray<string>>> = {
"apps/server/src/kin/pulse/nudge.ts",
"apps/server/src/kin/lead/ChatSharing.ts",
"apps/server/src/kin/lead/Audience.ts",
"apps/server/src/kin/lead/sessionCarry.ts",
"apps/server/src/kin/chat/KinGroups.ts",
"apps/server/src/kin/people/KinPeople.ts",
],
Expand Down
2 changes: 2 additions & 0 deletions verification/kin/checkin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ On 2026-11-26, against `fix/kin-foreign-credit-asks-which-invoice` at `520ec082b
**Re-confirmed 2026-11-28** on train 8 (six steps joined on train 7's tip `ed128889faf`; no spec change, all 13 rules hold over 3,338,701 states in 36 s; 17/17 variants caught in 19 s). Of the covered files only `KinEventQueue.ts` changes, and only by step 2 (`fix/kin-checkin-release-lets-talk-first`, 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. When a check-in may start and what is stored are unchanged, so every rule reads what it did.

**Re-confirmed 2026-11-29** on `fix/kin-later-runs-after-outside-read-need-the-owners-ask` (no spec change; all 13 rules hold over 3,338,701 states in 64 s; 17/17 variants caught in 28 s). `queueCheckIn` copies the creating turn's outside-read mark to a new pulse event in the existing enqueue transaction. When it queues, what it tells, deduplication, and quiet hours do not change. The model does not specify the agent's tool authority; the server tests cover that.

**Re-confirmed 2026-11-29** on train 17 of 29 Nov (three steps joined on kin `7e273b01f3b`; no spec change, all 13 rules hold over 3,338,701 states in 40 s; 17/17 variants caught in 17 s). The one covered file the line changes, `pulse/checkIn.ts`, is as its line above says: a new check-in event takes the creating turn's outside-read mark. Carry on by default does not change when a check-in queues, what it tells, deduplication or quiet hours.
2 changes: 2 additions & 0 deletions verification/kin/discussion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,5 @@ On 2026-11-26, against `feat/kin-session-changes` (`fc8c965117c`, on kin `4df1cc
**Re-confirmed 2026-11-29** on train 16 of 29 Nov (the cache fixes and the Finance follow-through, five steps joined on kin `bc0259ac6be`; no spec change, all 13 rules hold over 44,410 states in 34 s; 16/16 variants caught in 23 s). The one covered file the line changes, `lead/WakeupRunner.ts`, differs from kin only by the carry clocks and cost gate (the line above), which now price with the turn provider's real `cacheWeights(driver, model)` table, so the shim that waited for it is gone. Pricing is asked only on the owner-only Claude path; a Team-room turn still starts fresh and inherits no session marks.

**Re-confirmed 2026-11-29** for the cache carry policy and default (train 16 base `d35b52e265c`; spec and configuration unchanged from the run). All 13 rules hold over 44,410 states, and 16/16 broken variants are caught. The only covered file changed, `WakeupRunner.ts`, changes the provider context and cache age of an already-chosen owner-private wake, not who starts a discussion, the hand-off or its reply.

**Re-confirmed 2026-11-29** on train 17 of 29 Nov (the schedule guard after an outside read, carry on by default with one 49-minute lifetime, and the reply model's session check, three steps joined on kin `7e273b01f3b`; no spec change, all 13 rules hold over 44,410 states in 33 s; 16/16 variants caught in 24 s). The one covered file the line changes, `lead/WakeupRunner.ts`, loses the cost gate's pricing call and stamps an approved draft on the wake. Carry stays on the owner-only Claude path, so a Team-room turn still starts fresh and inherits no session marks.
51 changes: 49 additions & 2 deletions verification/kin/reply/README.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions verification/kin/reply/Reply.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CONSTANTS
Broken = "none"
PerChat = FALSE
Msgs = {1, 2}
Quiet = {2}
Triggers = {2}
Expand All @@ -20,5 +21,6 @@ INVARIANT StopPostsNothing
INVARIANT OneRing
INVARIANT TriggerOnlySends
INVARIANT NudgeOnce
INVARIANT SessionOnlyToEntitled
PROPERTY EveryMessageAnswered
PROPERTY LineClears
Loading
Loading