From a0a8b3424ac1c4ef18058ee05094b3717608dca1 Mon Sep 17 00:00:00 2001 From: GLDRoger <130458023+GLDRoger@users.noreply.github.com> Date: Sat, 28 Nov 2026 04:51:31 +0000 Subject: [PATCH 1/2] fix(kin): keep memory saves on the server off GitHub People-change: Kin saves memory on the server when the memory repository is outside GitHub. Co-Authored-By: GPT-6.2 Sol --- .../src/kin/memory/MemoryPullRequests.test.ts | 49 +++++++++++++++++-- apps/server/src/kin/memory/MemoryWriter.ts | 27 ++-------- 2 files changed, 49 insertions(+), 27 deletions(-) diff --git a/apps/server/src/kin/memory/MemoryPullRequests.test.ts b/apps/server/src/kin/memory/MemoryPullRequests.test.ts index 9acaafd2c2443..87809eb2bce6c 100644 --- a/apps/server/src/kin/memory/MemoryPullRequests.test.ts +++ b/apps/server/src/kin/memory/MemoryPullRequests.test.ts @@ -87,6 +87,8 @@ const scenarios = [ "stall-body", "run-from-fork", "no-pull-requests", + "off-github-local-save", + "off-github-strip-quotes", "batched", "restart", "repeat-edit", @@ -175,6 +177,18 @@ it.effect.each(scenarios)("memory writes through PRs: %s", (scenario) => yield* workflow(scenario === "decision-then-journal" ? buildCommit : oldPin), ); } + if (scenario === "off-github-strip-quotes") { + yield* fs.makeDirectory(`${source}/claims`); + yield* fs.writeFileString( + `${source}/claims/said.md`, + fixtureItem({ + id: "said", + kind: "claim", + source: "kin:chat:cleared-chat:message:m-cleared", + quote: FIXTURE_QUOTE, + }), + ); + } yield* git(source, ["add", "--", "."]); yield* git(source, [...identity, "commit", "-m", "fixture"]); yield* git(root, ["clone", "--bare", "--", source, remote]); @@ -499,8 +513,10 @@ it.effect.each(scenarios)("memory writes through PRs: %s", (scenario) => return { status: 201, body: {} }; return { status: 404, body: { message: "Not Found" } }; }).pipe(Effect.orDie); - // GitHub as the owner's `gh` login, or as Kin's GitHub App in `merged`, over `route`. - const asApp = scenario === "merged"; + // GitHub requests go through `route` as the owner or as the GitHub App. + const offGitHub = + scenario === "off-github-local-save" || scenario === "off-github-strip-quotes"; + const asApp = scenario === "merged" || offGitHub; const github = { requests: [] as Array }; const callAs = (as: "app" | "owner"): KinGitHubApi["Service"]["call"] => @@ -558,7 +574,9 @@ it.effect.each(scenarios)("memory writes through PRs: %s", (scenario) => const config = Layer.succeed(MemoryConfig, { baseDirectory: root, ...(scenario === "code-owner-refusal" ? {} : { buildCommit }), - repositories: [{ orgId, repoUrl: remote, path: "state", githubRepo: repo }], + repositories: [ + { orgId, repoUrl: remote, path: "state", ...(offGitHub ? {} : { githubRepo: repo }) }, + ], }); const auth = Layer.succeed(Writer.MemoryWriterAuthority, { resolve: (_org, wakeupId) => @@ -653,6 +671,31 @@ it.effect.each(scenarios)("memory writes through PRs: %s", (scenario) => ).length; const toldOwner = () => notices.flatMap((notice) => notice.owner ?? []); + if (offGitHub) { + if (scenario === "off-github-local-save") { + yield* writer.stage(orgId, "wake1", claim("new")); + const { commit } = yield* journal("wake1"); + expect(yield* localMain()).toBe(commit); + expect((yield* memory.readItem(orgId, KinMemoryItemId.make("new"))).head.id).toBe("new"); + } else { + const localFile = () => git(paths.writer, ["show", "main:claims/said.md"]); + expect(yield* localFile()).toContain(`quote: "${FIXTURE_QUOTE}"`); + yield* writer.stripQuotes(orgId); + const stripped = yield* localFile(); + expect(stripped).not.toContain("quote:"); + expect(stripped).toContain("Invented fixture body."); + } + const head = yield* localMain(); + expect(head).not.toBe(original); + expect(yield* memory.anchor(orgId, "main")).toBe(head); + expect(yield* Queue.take(outcomes)).toEqual({ _tag: "idle" }); + yield* lander.sweep(orgId); + expect(github.requests).toEqual([]); + expect(yield* bare("rev-parse", "refs/heads/main")).toBe(original); + expect(yield* bare("for-each-ref", "--format=%(refname)")).toBe("refs/heads/main"); + return; + } + if (scenario === "decision-then-journal") { // A decision saved by code, then a wake-up's journal: both land, no review asked. expect(yield* writer.recordDecision(orgId, decision("decision-0001"))).toEqual({ diff --git a/apps/server/src/kin/memory/MemoryWriter.ts b/apps/server/src/kin/memory/MemoryWriter.ts index 90bc2dd6bdaa8..b013afd29a11a 100644 --- a/apps/server/src/kin/memory/MemoryWriter.ts +++ b/apps/server/src/kin/memory/MemoryWriter.ts @@ -12,7 +12,6 @@ import * as MemoryCache from "./MemoryCache.ts"; import { KinChatError, MemoryItemFrontMatter, - RepoSlug, type KinAgentId, type KinChatId, type KinMemoryItemId, @@ -312,7 +311,6 @@ export class MemoryWriter extends Context.Service< readonly stripQuotes: (orgId: KinOrgId) => Effect.Effect; } >()("t3/kin/memory/MemoryWriter") {} -const isRepoSlug = Schema.is(RepoSlug); const dreamBranch = /^dream\/\d{4}-\d{2}-\d{2}$/; const folders = [ "objectives", @@ -363,6 +361,8 @@ const make = Effect.gen(function* () { const app = yield* gitHubApp; const cache = yield* MemoryCache.MemoryCache; const pullRequests = yield* Effect.serviceOption(MemoryPullRequests); + // Pull request mode saves the default branch locally without pushing it. + // The lander stays idle when there is no GitHub target, so no pull request is attempted. const mainWrites = Option.isSome(pullRequests) ? "pull_request" : config.directMainPush === true @@ -787,16 +787,6 @@ const make = Effect.gen(function* () { return yield* new MemoryConfigError({ orgId, operation: "writer", reason: "Unknown org" }); return repo; }); - // Checked before committing: a commit no PR could ever land would only sit on this server. - const refuseOffGitHub = Effect.fn("MemoryWriter.refuseOffGitHub")(function* (orgId: KinOrgId) { - const repo = yield* repoFor(orgId); - if (repo.githubRepo === undefined || !isRepoSlug(repo.githubRepo)) - return yield* new MemorySyncConflict({ - orgId, - operation: "push", - reason: "The memory repo is not on GitHub, so Kin cannot open its PR", - }); - }); const refuseMainWrite = Effect.fn("MemoryWriter.refuseMainWrite")(function* (orgId: KinOrgId) { const reason = "Memory writes to the default branch land through a pull request, which isn't set up here (TRIG-15); this one was not committed"; @@ -1199,7 +1189,6 @@ const make = Effect.gen(function* () { const onMain = branch === (config.defaultBranch ?? "main"); if (onMain && mainWrites === "refused") return yield* refuseMainWrite(orgId); const viaPullRequest = onMain && mainWrites === "pull_request"; - if (viaPullRequest) yield* refuseOffGitHub(orgId); const recorded = yield* branchHead(orgId, writer, branch); const unpushedKey = `${orgId}\u0000${branch}`; const push = (sha: string) => @@ -1339,7 +1328,6 @@ const make = Effect.gen(function* () { }), ), ); - // The wake-up is done once its commit is here; GitHub gets it in the background. if (viaPullRequest) yield* lander.signal(orgId); else yield* push(commit); return { commit }; @@ -1493,7 +1481,6 @@ const make = Effect.gen(function* () { operation: "push", reason: "Memory writes to the default branch are refused", }); - if (mainWrites === "pull_request") yield* refuseOffGitHub(orgId); const head = yield* branchHead(orgId, writer, main); const headFiles = yield* filesAt(orgId, writer, head); if (head !== input.base) { @@ -1552,7 +1539,6 @@ const make = Effect.gen(function* () { const repo = yield* repoFor(orgId); const onMain = input.branch === main; if (onMain && mainWrites === "refused") return yield* refuseMainWrite(orgId); - if (onMain && mainWrites === "pull_request") yield* refuseOffGitHub(orgId); const stale = { _tag: "stale" } as const; // A purge rewrites history, so the wake-up's commits may be gone. for (const sha of [input.base, input.commit]) @@ -1630,7 +1616,6 @@ const make = Effect.gen(function* () { yield* refuseDuringPurge(orgId); const repo = yield* repoFor(orgId); if (mainWrites === "refused") return yield* refuseMainWrite(orgId); - if (mainWrites === "pull_request") yield* refuseOffGitHub(orgId); const item = yield* memory.readItemQuietly(orgId, input.itemId); const head = yield* branchHead(orgId, writer, main); const headFiles = yield* filesAt(orgId, writer, head); @@ -1684,7 +1669,6 @@ const make = Effect.gen(function* () { operation: "push", reason: "Memory writes to the default branch are refused", }); - if (mainWrites === "pull_request") yield* refuseOffGitHub(orgId); const item = yield* memory.readItemQuietly(orgId, input.itemId); const head = yield* branchHead(orgId, writer, main); const headFiles = yield* filesAt(orgId, writer, head); @@ -1730,7 +1714,6 @@ const make = Effect.gen(function* () { yield* refuseDuringPurge(orgId); const repo = yield* repoFor(orgId); if (mainWrites === "refused") return yield* refuseMainWrite(orgId); - if (mainWrites === "pull_request") yield* refuseOffGitHub(orgId); const item = yield* memory.readItemQuietly(orgId, input.itemId); const head = yield* branchHead(orgId, writer, main); const headFiles = yield* filesAt(orgId, writer, head); @@ -1777,7 +1760,6 @@ const make = Effect.gen(function* () { operation: "push", reason: "Memory writes to the default branch are refused", }); - if (mainWrites === "pull_request") yield* refuseOffGitHub(orgId); const path = `decisions/${input.itemId}.md`; yield* safePath(orgId, writer, path); const head = yield* branchHead(orgId, writer, main); @@ -1857,10 +1839,7 @@ const make = Effect.gen(function* () { ])) .split("\n") .filter((branch) => branch !== ""); - const mainWritable = - mainWrites === "direct" || - (mainWrites === "pull_request" && - (yield* refuseOffGitHub(orgId).pipe(Effect.result))._tag === "Success"); + const mainWritable = mainWrites !== "refused"; let failure: MemoryWriteFailure | undefined; const [clears] = yield* sql<{ mark: number }>`SELECT COALESCE(SUM(cleared_change_seq), 0) AS mark FROM kin_chats WHERE org_id = ${orgId}`.pipe( From 5ec5553ef2ba48691f1d5efd7cab031a5e32117b Mon Sep 17 00:00:00 2001 From: GLDRoger <130458023+GLDRoger@users.noreply.github.com> Date: Sat, 28 Nov 2026 12:32:52 +0530 Subject: [PATCH 2/2] chore(kin): train 13 tip, the runner pin re-measured and the models re-confirmed REVIEWED_RUNNER c8540495b72662c3 -> ce614a0494695af4, the value the failing pin test printed once steps 1, 2 and 3 were joined (the REPAID_SHORT placeholder, the bills seat constant, and the wrote-text check). No other pin moved. The people and reply models re-confirmed on the joined line, no spec change. T3-file: evals/mcp-tool-use/changed/surface.ts: the reviewed runner pin follows the joined runner files People-change: none Co-Authored-By: Claude Opus 5.5 --- evals/mcp-tool-use/changed/surface.ts | 2 +- verification/kin/people/README.md | 2 ++ verification/kin/reply/README.md | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/evals/mcp-tool-use/changed/surface.ts b/evals/mcp-tool-use/changed/surface.ts index ec547a50858d4..400b9eb7a4463 100644 --- a/evals/mcp-tool-use/changed/surface.ts +++ b/evals/mcp-tool-use/changed/surface.ts @@ -72,7 +72,7 @@ export const runnerHash = () => ); /** The runner this file's part list was checked against. */ -export const REVIEWED_RUNNER = "c8540495b72662c3"; +export const REVIEWED_RUNNER = "ce614a0494695af4"; export const CaseSurface = Schema.Struct({ /** The case as run.json hashes it, and its first request as run.json hashes it. */ diff --git a/verification/kin/people/README.md b/verification/kin/people/README.md index 3474b86bf6f6d..d409eaaf0be2a 100644 --- a/verification/kin/people/README.md +++ b/verification/kin/people/README.md @@ -46,3 +46,5 @@ On 2026-11-26, against the visibility-rule fix (#906, kin `6c18694fa04`; every r **Re-confirmed 2026-11-28** on train 11 (the search fence, joined on kin `252c46ce43d`; no spec change, all rules hold; 10/10 variants caught). `teamView.ts` gains one notes rule (`notesSeenBy`): a project's notes match only for the owner, a co-owner and that project's lead, a client's notes only with Clients on; Search and the Work list's text filter both ask it. It narrows what a teammate finds and widens nothing. **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 9 rules hold over 6,243 states in 1 s; 10/10 variants caught in 9 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. Every caller still refuses by the same checks and passes the constant by reference, so no level, removal, link or place changes. + +**Re-confirmed 2026-11-28** on train 13 (the wording train, five steps joined on kin `68da5258875`; no spec change, all 9 rules hold over 6,243 states in 1 s; 10/10 variants caught in 7 s). The one covered file, `lead/Audience.ts`, differs from kin only by step 1's words for `SHARED_REFUSAL`; kin changed nothing in it since the step was built, so every caller still refuses by the same checks and no level, removal, link or place changes. diff --git a/verification/kin/reply/README.md b/verification/kin/reply/README.md index 1c20745824b20..770dfacac9485 100644 --- a/verification/kin/reply/README.md +++ b/verification/kin/reply/README.md @@ -98,3 +98,5 @@ The guard "Steer waits after a Stop" (rule 12) now rests on code, from kin's `15 **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. + +**Re-confirmed 2026-11-28** on train 13 (the wording train, five steps joined on kin `68da5258875`; no spec change, all 17 rules hold over 1,554,826 states in 533 s; 28/28 variants caught in 36 s). Of the covered files, `lead/Audience.ts` differs from kin only by step 1's words for `SHARED_REFUSAL`, and `KinReplyBridge.ts` only by step 4's words (`WITHHELD_ANY` and the agent's own update fallback); kin changed neither since the steps were built. No reply, failure line, rescue, requeue or Stop step changes.