anthropics / anthropics/claude-code
[BUG] Remote Control: reattaching to a resumed conversation's bridge session never flushes history, so turns made before enabling are missing on claude.ai
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 147k
- Forks
- 24k
- PR merge metrics
- PR metrics pending
Description
Claude Code CLI version: 2.1.270
Platform: macOS 14.5 (Darwin 23.5.0), claude -p --input-format stream-json --output-format stream-json driven by a Neovim plugin (cc.nvim); same code path as the Agent SDK
Summary
Remote Control is bound to the conversation: the transcript JSONL carries bridge-session records, and after --resume the remote_control control request reattaches to the recorded bridge session at its persisted sequence number instead of creating a new one. That reattach never flushes conversation history. Any turns made in the resumed process before Remote Control was enabled are therefore never sent to claude.ai, and the phone/web view shows only what the old bridge session already had plus turns made after the reattach.
A fresh process does this correctly: enabling Remote Control mid-session flushes the whole in-memory conversation ([remote-bridge] Flushing N history events). Only the reattach path skips it.
Steps to reproduce
- Start a stream-json session, do two turns, enable Remote Control (
control_request{"subtype":"remote_control","enabled":true}). Debug log showsFlushing 4 history events; claude.ai shows both turns. Leave Remote Control on and exit the process. claude -p ... --resume <session_id>. Do one turn with Remote Control off ("OFFLINE TURN").- Send the same
remote_controlenable request.
Observed
[bridge:repl] Reattaching to persisted bridge session cse_01NHCh... at seq 30 (fresh-mint fallback, restored_owner_match)
[remote-bridge] Reattaching to session cse_01NHCh...
[code-session] Unarchive session_01NHCh... status=200
[bridge:sdk] State change: connected
SSETransport: Opening .../worker/events/stream?from_sequence_num=30
No Flushing ... history events line. The control response returns the old session_url. On claude.ai/code the OFFLINE TURN is absent; a turn made after the reattach appears normally.
Expected
On reattach, flush the messages that the bridge session has not seen (everything after the persisted lastSequenceNum, or at minimum everything produced by this process before enable), the same way a fresh session flushes its initial history.
Workaround
In the resumed process: disable, then re-enable. Teardown archives the old bridge session and writes an empty bridge-session record; the re-enable mints a fresh session and flushes the full history (Flushing 27 history events in my run, including the offline turn). Cost: a new session URL, so continuity with the old one on the phone is lost.
Related
- #87213 (closed, inactive): resume replays a dead binding and
/remote-controlcan only retry the reconnect. Same mechanism, different consequence. - #89292: resume replays the binding even when Remote Control is globally disabled.
- #93445:
/branchleaves the original conversation's reconnection record pointing at the branch.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the stream-json flow with --resume and the remote_control enable request, comparing the fresh-session and reattach logs. Trace the persisted bridge-session binding and its last sequence number through reattachment. Done means turns made before re-enabling Remote Control appear on claude.ai without requiring disable/re-enable or losing the existing session URL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100