mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-12-03 09:09:33 +01:00
fix(adopt): an adopted session has no workspace of ours
The wrapper's workingDir is the neutral /tmp, and everything master grew since 1.33.2 that branches on session.remote or session.docker read that as a local session working in /tmp, because an adopted session keeps its connection on adopt.remote and adopt.docker. So uploads wrote into /tmp and closing the tab recursively deleted the shared folder; the Git panel, its fetch and the fetch scheduler ran git on whatever sat there; the image watcher, Read My Mind and the Discord bridge used that folder; last-response paired a transcript by it and could show another conversation's answer as this one's; a magic link in a container's output registered a file from this host's /tmp; and guarded input could type into a human's composer. Each now refuses or answers unsupported, the browser hides the rows that cannot work, and Session Options shows where the foreign pane was instead of /tmp. The custom-model route refuses as well, since it restarts the CLI in the pane. The local version probe is skipped: the local binary says nothing about a process someone else started, possibly on another host. Also moves the guard test to port 0, which test-ports-guard now requires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f464a22bc3
commit
7de4201955
22 files changed
+269
-42
No files matched your search
@@ -3,6 +3,7 @@ import { expect, it, vi } from 'vitest';
|
||||
import { formatPaneSnapshot } from '../src/tmux-manager.js';
|
||||
import { Session } from '../src/session.js';
|
||||
import { promptSha256 } from '../src/agent-staging.js';
|
||||
import type { SessionAdopt } from '../src/types/session.js';
|
||||
it('fences writes and reused-pid pane lifecycles without persisting prompt content', async () => {
|
||||
let screen = '› \n GPT-6-Luna default · ~/case\n';
|
||||
const mux = {
|
||||
@@ -542,3 +543,37 @@ it('stages through a real session whose first post-write capture is the torn fra
|
||||
await session.stop(false);
|
||||
}
|
||||
});
|
||||
|
||||
it('offers no guarded input on an adopted pane, however much it looks like a composer', () => {
|
||||
// Stage and submit type a prompt on an agent's behalf, here into a pane a human is using.
|
||||
const screen = '\u203a \n GPT-6-Luna default \u00b7 ~/case\n';
|
||||
const mux = {
|
||||
isAvailable: () => true,
|
||||
capturePaneBuffer: (
|
||||
_name: string,
|
||||
_pane?: string,
|
||||
opts?: { capturedGeometry?: { cols: number; rows: number } }
|
||||
) => {
|
||||
if (opts) opts.capturedGeometry = { cols: 100, rows: 20 };
|
||||
return formatPaneSnapshot(screen.trimEnd().split('\n'), { cols: 100, rows: 20, cursorX: 2, cursorY: 0 });
|
||||
},
|
||||
sendInput: async () => true,
|
||||
};
|
||||
const build = (adopt?: SessionAdopt) =>
|
||||
new Session({
|
||||
workingDir: '/tmp',
|
||||
mode: 'codex',
|
||||
mux,
|
||||
adopt,
|
||||
muxSession: { muxName: 'codeman-test', sessionId: 'test', createdAt: 1, pid: 12345 },
|
||||
} as unknown as ConstructorParameters<typeof Session>[0]);
|
||||
expect(build().guardedInputSnapshot()).not.toBeNull();
|
||||
expect(
|
||||
build({
|
||||
location: 'local',
|
||||
socketPath: '/tmp/tmux-1000/default',
|
||||
targetSession: 'work',
|
||||
viewSession: 'codeman-view-00000000',
|
||||
}).guardedInputSnapshot()
|
||||
).toBeNull();
|
||||
});
|
||||
Reference in new issue
Block a user