Conversation
…ses the baton When an account hits its usage limit, every active session dies at once. `baton watch` polls the current project's sessions for limit-shaped errors (Claude Code: transcript tail; OpenCode: last message via `opencode db`), then converts + imports the transcript into the failover target and prints the resume command. Interactive mode prompts per death; --auto fails over only sessions allowlisted via the new failover_opt_in/opt_out/status MCP tools. --once supports hook-triggered scans; --to overrides the default claude-code ⇄ opencode pair. Verified end-to-end in both directions against real `opencode import`/ `opencode export` and a real-shaped Claude transcript. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…aths, dir compare hardening - scan() now merges handled-marks into freshly-loaded state so an opt-in written by the MCP tool mid-scan isn't clobbered by the stale copy. - failover_opt_in clears the session's handled entry: opting in after a death re-arms it for the next --auto scan. - opencode directory match normalizes Windows verbatim prefixes and trailing separators on both sides. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
Post-review pass (self): fixed a mid-scan state clobber (MCP opt-in written while watch was scanning could be lost), made |
ehsanjso
force-pushed
the
feat/auto-failover
branch
from
July 12, 2026 19:13
e5cd6ff to
6546f61
Compare
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.
What
baton watch— detect quota-dead sessions and pass the baton automatically: convert the transcript, import it into the failover target, print the ready-to-run resume command.isApiErrorMessagewith limit-shaped text (matched against real error shapes: "You've hit your session limit · resets 5:50pm"). OpenCode: newest message per session viaopencode db --format json, limit-shapederrorpayload. 401s / model errors / stalls do NOT fire.--auto— unattended mode fails over only allowlisted sessions. Allowlist from inside the conversation via new MCP tools:failover_opt_in,failover_opt_out,failover_status(session id defaults to the caller's own session = most recently active).--once— single scan for wiring into agent hooks later;--tooverrides the default claude-code ⇄ opencode pair.Verified
baton watch --once --auto→ realopencode import→opencode exportconfirms all 3 messages.opencode db→ transcript written under~/.claude/projects/<encoded-cwd>/→claude --resume <id>command printed.Notes / ceilings
opencode importsets the session directory to the import cwd (ignoresinfo.directory) — hence the documented "runbaton watchfrom the project directory" constraint.🤖 Generated with Claude Code