fix(coding-agent): keyed tan local root on session-manager id

Snapshot this.ctx.sessionManager.getSessionId() for the tan clone's local://
mapping instead of session.sessionId. The two diverge after /fresh or a
provider session override, and the Windows short-root fallback keys
%TEMP%/omp-local/<id> off the session-manager id used by the parent's
large-paste writes and '/data/workspaces/can1357__oh-my-pi__6971/.omp-session/2026-07-29T06-08-45-283Z_019fac7d-5ee3-7000-a7aa-16fe9394fdc9/local' reads, so the mismatched id left attachments
unreachable.

Diverge the mocked session id from the manager id in the regression test so
it pins the session-manager id.

Fixes #6971

(cherry picked from commit 1efcd22326d76fdb8b50c0977a836c892e80ab76)
This commit is contained in:
roboomp
2026-07-29 23:08:44 +02:00
committed by can1357
parent dd4985f31e
commit bbf3d78c7e
2 changed files with 11 additions and 4 deletions
@@ -121,7 +121,7 @@ function createContext(overrides?: {
} as unknown as InteractiveModeContext["session"];
const parentArtifactsDir = parentFile.slice(0, -6);
const getArtifactsDir = vi.fn(() => parentArtifactsDir);
const getSessionId = vi.fn(() => "parent-session");
const getSessionId = vi.fn(() => "parent-local-session");
const sessionManager = {
getSessionFile: vi.fn(() => parentFile),
getCwd: vi.fn(() => tempDir.path()),
@@ -255,7 +255,9 @@ describe("TanCommandController", () => {
const opts = capturedOptions?.localProtocolOptions;
if (!opts) throw new Error("localProtocolOptions was not passed");
expect(resolveLocalRoot(opts)).toBe(path.join(harness.parentArtifactsDir, "local"));
expect(opts.getSessionId?.()).toBe("parent-session");
// The local mapping keys off the session-manager id (not `session.sessionId`,
// still "parent-session"), matching the parent's large-paste / local:// writes.
expect(opts.getSessionId?.()).toBe("parent-local-session");
});
it("aborts the cloned agent when the background job signal aborts", async () => {