Repository navigation
Preserve Claude sessions and composer text across subscription moves - #19
Conversation
| raise ValueError(body.get("error", "draft operation refused")) | ||
| return 0 | ||
| time.sleep(0.1) | ||
| raise ValueError("Claude did not acknowledge its external editor; saved draft retained") |
There was a problem hiding this comment.
Failed editor request blocks retries
Medium Severity
prepare leaves request.json in place when Claude never opens the editor, then refuses any later prepare until that file is removed. A timed-out account take or restore therefore makes an otherwise retryable live session fail on the next move with a different error.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 49daa397386a649ba5a3c82ae62e5010b7e03c2b. Configure here.
49daa39 to
604d40d
Compare
|
Rebased onto current New HEAD: 604d40d. The single production conflict is resolved by retaining both Validation against repository
One additional integration self-review round ( |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 604d40d. Configure here.
| local status=$? | ||
| if [ -n "${ACCOUNT_BACKUP:-}" ] && [ -f "$ACCOUNT_BACKUP" ]; then | ||
| echo "composer backup retained: $ACCOUNT_BACKUP" >&2 | ||
| fi |
There was a problem hiding this comment.
Success reports composer backup retained
Low Severity
control_cleanup prints composer backup retained whenever ACCOUNT_BACKUP exists, including after a successful account-moved. Preflight always creates that file, and the trap ignores the saved exit status, so a completed move still emits the failure-oriented retention line on stderr.
Reviewed by Cursor Bugbot for commit 604d40d. Configure here.


Summary
config/account-rules. Valid edits apply immediately; malformed/unreadable rules still refuse. Old approval artifacts are ignored, and the obsolete approval helper/test fixture is removed. This security-relevant removal was explicitly authorized for this task; this PR does not authorize its own merge.cswap run N --share-history --for rules-selected workers, secondmates, and resumes. Credential bootstrap/refresh ownership stays with cswap.fm-control.sh <id> account <N>: save exact composer bytes through an editor bridge, cleanly exit, resume the identical session ID on the requested subscription, verify the native process/session and authenticated email/organization, restore and read back the draft without submitting it, and persistaccount_override=cswap:Nfor subsequent launches.No Agent-Harness-Reconfig changes or sibling PR are needed.
Old-harness behavior carried forward
The reconstruction was completed before implementation using archived sessions
8329adce-b91b-4a95-be1e-965c240e631a(launch account selection),ca5eb122-3308-43b5-b2f7-93f7def5a5a0(account swaps), and8e106edc-46f5-4bd6-bb4e-91f3fd0c5a0e(stale credential attribution), plus source history:3f8e890104c3603571ef2fa907cc80cf6bc7e313: actualcswap --share-historylaunch, restored here rather than probing cswap then bypassing it at launch.e6c996935f8e09dd09fbb43d8da40ca44b688436andf731cdb14e06fd7eb474bade12f324df4e475682: exact native session identity, idle checking, environment scrubbing, and resume rather than a fresh conversation. This implementation additionally preserves the original composer and uses verified clean exit rather than killing the pane.9d93b155ee850a1a63d2f184763a65c4c71a6a77's historical incoming-config guard bypass is not copied. Current cswap estate has the later same-default-account protection; bypassing it can seed another copy of a refresh lineage. Firstmate now leaves that decision to cswap.58208cf685979e5a0d678afc0ca31608ee372550documents that the upstream fix(backends): resolve physical path in orca repo_ensure for symlinked projects kunchenguid/firstmate#279/feat(harness): add cursor and hermes verified adapters kunchenguid/firstmate#280 Keychain ACL theory was refuted and the ACL pin was not adopted. No Keychain ACL writes, custom token refresher, logout, or forced login are introduced here.Missing shared history and the actual-launch bypass were proven Firstmate divergences. The precise historical live-seat login failure was not conclusively reproduced. A stale stored credential is not proof of an expired account. The live diagnostic confirmed that removing
USER/LOGNAMEcan falsely report account 2 signed out; the new identity check retains them. An existing slot-4 profile also returned a different account identity in a read-only diagnostic; no slot-4 credential reset or move was attempted, and that discrepancy is not claimed repaired. The move refuses success if authenticated identity differs from the requested slot.Compatibility and safety boundaries
move waits for an empty composer or the lane's next relaunch; existing text is untouched. No screen scraping is used for capture.Live Mac proof
Repository
pearson-tfl/firstmate, branchfm/ahracctmove, commit 49daa397386a649ba5a3c82ae62e5010b7e03c2b; Claude Code 2.1.319, cswap 0.27.0b1+estate.1, 2026-11-06.Only a throwaway scratch lane was moved. Affected credential material was privately backed up before cswap activity; no real seat was moved, logged out, or re-authenticated.
fbafab01-a822-4495-9571-a4e0c6602876on account 3 with one test prompt.unsubmitted move proof λ, a newline, andsecond line with spacesplus two trailing spaces in its composer.fm-control.sh proof account 3, thenfm-control.sh proof account 2on the committed tree; both returned success.account=cswap:2/account_override=cswap:2.48b9af9ccbff79631bb7bd9ccdce1688ff91c7c97af83a9c4d7d254c1cb535a0.An earlier replacement-launch refusal also verified that the original conversation remained resumable and the saved draft survived byte-for-byte. Private native records, logs, credential backups, and reconstruction archives remain with the task rather than in this public PR.
Validation
All passed against the tree committed as
49daa397386a649ba5a3c82ae62e5010b7e03c2b:bash tests/fm-claude-draft.test.shbash tests/fm-claude-session.test.shbash tests/fm-account-rules.test.shbash tests/fm-worker-account.test.shbash tests/fm-control.test.shbash tests/fm-control-relaunch.test.shbash tests/fm-backend-rex.test.shbash tests/fm-backend-herdr.test.sh(synthetic adapter only; no Herdr lifecycle actions)bash bin/fm-lint.shwith the pinned actionlint installed privatelybash bin/fm-doc-audience-check.sh --root <repository>git diff --checkCoverage includes executed launch/editor commands, shared-history flag enforcement, approval-free rules changes, malformed rules, native session/process generation and locale, exact whitespace/Unicode transfer, original-editor delegation, placeholder races, legacy pending-text refusal, empty drafts, durable account metadata, and retained backups on authenticated-identity mismatch.
Review
One implementation self-review round; no independent reviewer or no-mistakes pipeline, following this task's direct-PR contract.
openai/gpt-6.1-sol(implementation self-review)openai/gpt-6.1-sol(implementation self-review)Note
Medium Risk
Touches worker account selection, spawn launch lines, and a new control-plane verb that stops/resumes Claude and manipulates credentials paths; behavior is heavily tested but any edge-case mismatch in cswap/auth/editor bridging could strand a lane or mis-route accounts.
Overview
Moves Claude lanes between cswap subscriptions without losing the session or composer text. Adds
fm-control.sh <task> account <n>, with preflight checks, byte-exact draft save/restore through a new external-editor bridge (fm-claude-draft.py), native session/process verification (fm-claude-session.py), authenticated identity matching againstcswap list, and durableaccount_override=cswap:<n>metadata carried into spawn.Runs real Claude launches via
cswap run <n> --share-history --(not just probes) and extends metadata/backends to support editor-bridge env wiring,C-gdelivery on tmux/herdr/rex, and account-override plumbing (FM_CONTROL_ACCOUNT, spawn meta fields).Simplifies account rules: removes captain fingerprint approval (
account-rules.approved), makesfm-account-rules.shstatus-only, and updates docs/tests/fixtures accordingly while still refusing malformed rules.Reviewed by Cursor Bugbot for commit 604d40d. Bugbot is set up for automated code reviews on this repo. Configure here.