fix(agents): refuse codex resume-adopt explicitly + document why#125
Merged
Conversation
… downgrading
Resume-adopt (claude --resume under a PTY) is claude-only because the
liveness guard that prevents resuming a *live* session — and corrupting its
transcript via a second writer — relies on claude's pid-file
(~/.claude/sessions/<pid>.json + kill -0). Codex has no equivalent: its
rollout JSONL carries no pid/lock, so "idle" could only be guessed from
mtime, which isn't safe. The codex CLI *does* support `codex resume <id>`;
the blocker is the missing liveness signal, not the capability.
Previously POST /api/agents/pty/start {agent:"codex", resumeSessionId}
passed the claude-only liveness check (the id isn't in the claude set), then
PtyAgent.start dropped the resume args (gate was kind==="claude-code") and
spawned a *fresh* codex session — so "resume X" silently became "new
session". Now it's refused honestly:
- PtyAgent.start throws for resumeSessionId on a non-claude agent.
- POST /api/agents/pty/start returns 400 (clearer than the generic 503).
codex adopt-at-launch (a fresh `lisa agents pty codex "<task>"`) is unaffected.
Docs: PTY_AGENTS.md gains "Why codex resume-adopt isn't supported (yet)"
(with unblock conditions); IOS_COMPANION_PLAN.md §4 records the investigation
and the explicit refusal.
Verified: npm run typecheck && npm run build && npm test -> 804 pass, 1 skip
(the real-node-pty round-trip, which can't spawn under Node 26).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resume-adopt (
claude --resumeunder a PTY) is claude-only because its non-bypassable liveness guard — which refuses to resume a live session and corrupt its transcript via a second writer — relies on claude's pid-file (~/.claude/sessions/<pid>.json+kill -0).I checked codex parity: the codex CLI does support
codex resume <id>, but it leaves no equivalent liveness signal (its rollout JSONL carries no pid/lock), so "idle" could only be guessed from mtime — unsafe on a transcript-corruption surface. codex also isn't installed in this environment and node-pty can't spawn under Node 26, so a speculative path couldn't be verified end-to-end. So it's documented as deliberately unsupported, with the unblock conditions.While doing so I found + fixed a latent footgun:
POST /api/agents/pty/start {agent:"codex", resumeSessionId}used to pass the claude-only liveness check and then silently start a fresh codex session (the resume id was dropped) — "resume X" became "new session". Now:PtyAgent.startthrows forresumeSessionIdon a non-claude agent.codex adopt-at-launch (a fresh
lisa agents pty codex "<task>") is unaffected. The CLI/iOS/GUI never request codex resume, so this only tightens the direct-API path.Docs
docs/PTY_AGENTS.md: new "Why codex resume-adopt isn't supported (yet)" section.docs/IOS_COMPANION_PLAN.md§4: records the investigation + explicit refusal.Verification
npm run typecheck && npm run build && npm test→ 804 pass, 1 skip (the real-node-pty round-trip, which can't spawn under Node 26). The refusal is unit-tested insrc/agents/pty.test.ts.🤖 Generated with Claude Code