claude-code - 💡(How to fix) Fix [BUG] readBridgePointer is dead code in bridgeMain — env_id never reused, no headless way to resume historical chats [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56270Fetched 2026-05-06 06:32:37
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×4commented ×1cross-referenced ×1

Error Message

  1. No headless invocation resumes a historical chat as a bridge child. The subcommand rejects --resume (Error: Unknown argument: --resume). The TUI flag form claude --resume <uuid> --remote-control exits with Error: No deferred tool marker found in the resumed session…

Error Messages/Logs

Code Example



---

let qH, zH = {
    ...,
    environmentId: vJ$.randomUUID(),
    reuseEnvironmentId: qH,            // never assigned
    ...
  };

---

let qH;
     try { qH = (await readBridgePointer(J))?.environmentId; } catch {}
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Two design gaps in claude remote-control standalone-server mode prevent headless deployments from preserving iOS / claude.ai-code chats across a service restart:

  1. readBridgePointer is defined but has zero call sites — verified with grep -aobE 'readBridgePointer\(' claude (only matches the definition readBridgePointer:()=>). The reuseEnvironmentId field on registerBridgeEnvironment is therefore always undefined, even though the API call site supports it (...Y.reuseEnvironmentId && { environment_id: Y.reuseEnvironmentId }).
  2. No headless invocation resumes a historical chat as a bridge child. The subcommand rejects --resume (Error: Unknown argument: --resume). The TUI flag form claude --resume <uuid> --remote-control exits with Error: No deferred tool marker found in the resumed session…--resume is scoped to deferred-tool-call resumption, not chat-resumption-as-server.

Combined effect under systemd: env URL stays stable (server-side relay reuse on (machine_name, dir, account)), but every historical chat tombstones — transcript visible, session counter increments, prompts silently drop. Surfaces as "Remote Control disconnected." Related: #52796.

  • Claude Code: 2.1.128 (also 2.1.126); GIT_SHA e44c1d97bd39
  • linux-x64, Debian 13, OAuth (Max plan)
  • Invocation: claude remote-control --remote-control-session-name-prefix <prefix> under systemd

What Should Happen?

readBridgePointer should workxD

Error Messages/Logs

Steps to Reproduce

  1. claude remote-control --remote-control-session-name-prefix foo (no --resume, no --spawnsame-dir mode).
  2. Open env URL in iOS, send messages — works.
  3. Restart the process.
  4. Reopen the previous chat: visible, counter increments, prompts get no reply.

Code (offsets in 2.1.126 ELF)

bridgeMain registration (≈120124458):

let qH, zH = {
  ...,
  environmentId: vJ$.randomUUID(),
  reuseEnvironmentId: qH,            // never assigned
  ...
};

Pointer write only fires in single-session mode (≈120127497) — so same-dir writes nothing — and readBridgePointer is never called in any mode.

Asks

  1. Wire readBridgePointer → reuseEnvironmentId in bridgeMain:
    let qH;
    try { qH = (await readBridgePointer(J))?.environmentId; } catch {}
    Plus extend the pointer-write block to fire in same-dir too.
  2. Add a "resume bridge session" headless mode (e.g. claude remote-control --resume-bridge <session-uuid>) that spawns a sub-session bound to the historical session_id so prompts route to a live process.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.128

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

No response

extent analysis

TL;DR

To fix the issue, wire readBridgePointer to reuseEnvironmentId in bridgeMain and add a "resume bridge session" headless mode.

Guidance

  • Assign the result of readBridgePointer to reuseEnvironmentId in bridgeMain to preserve environment IDs across restarts.
  • Extend the pointer-write block to fire in same-dir mode to ensure environment IDs are written correctly.
  • Introduce a new headless mode, e.g., claude remote-control --resume-bridge <session-uuid>, to resume historical bridge sessions.
  • Verify the fix by checking if environment IDs are correctly reused after a restart and if historical chats can be resumed successfully.

Example

let qH;
try { qH = (await readBridgePointer(J))?.environmentId; } catch {}
let zH = {
  ...,
  environmentId: vJ$.randomUUID(),
  reuseEnvironmentId: qH,            // assign readBridgePointer result
  ...
};

Notes

The provided code snippet assumes that readBridgePointer returns a promise that resolves to an object with an environmentId property. The actual implementation may vary depending on the specifics of the readBridgePointer function.

Recommendation

Apply the suggested workaround by wiring readBridgePointer to reuseEnvironmentId and introducing a "resume bridge session" headless mode, as this addresses the identified issues with environment ID reuse and historical chat resumption.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] readBridgePointer is dead code in bridgeMain — env_id never reused, no headless way to resume historical chats [1 comments, 2 participants]