openclaw - 💡(How to fix) Fix resolveCliSessionReuse: manual attach invalidated on first turn (any hash drift treated as fresh session) [2 comments, 3 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
openclaw/openclaw#75849Fetched 2026-05-02 05:29:03
View on GitHub
Comments
2
Participants
3
Timeline
3
Reactions
2
Timeline (top)
commented ×2closed ×1

Root Cause

Root cause resolveCliSessionReuse re-validates the underlying CLI session's hash on every turn and treats any drift as "this isn't the same session anymore". For a freshly attached session that has accrued state since the snapshot was taken, drift is guaranteed — so attach effectively always invalidates on turn 1.

Fix Action

Fix / Workaround

Workaround We've been running a local runtime patch since 2026-04-29. Happy to PR.

RAW_BUFFERClick to expand / collapse

Symptom After a manual attach to an existing CLI session (e.g. via a session-manager tool), the binding is invalidated on the very first turn. Any subsequent turn behaves as a fresh session, defeating the purpose of attach.

Root cause resolveCliSessionReuse re-validates the underlying CLI session's hash on every turn and treats any drift as "this isn't the same session anymore". For a freshly attached session that has accrued state since the snapshot was taken, drift is guaranteed — so attach effectively always invalidates on turn 1.

Suggested fix Add a forceReuse: true short-circuit at the top of resolveCliSessionReuse. When the caller has explicitly asked to reuse a binding (manual attach is the canonical case), skip the hash check and trust the binding.

Affected dist file cli-session-*.js

Workaround We've been running a local runtime patch since 2026-04-29. Happy to PR.

extent analysis

TL;DR

Adding a forceReuse: true short-circuit in resolveCliSessionReuse may fix the issue by skipping the hash check when reusing a binding.

Guidance

  • The root cause is identified as the resolveCliSessionReuse function re-validating the CLI session's hash on every turn, which treats any drift as a new session.
  • To verify the issue, test the manual attach feature and check if the binding is invalidated on the first turn.
  • To mitigate the issue, consider adding the suggested forceReuse: true short-circuit in resolveCliSessionReuse.
  • The affected file is cli-session-*.js, which may need to be updated with the fix.

Example

// Example of the suggested fix
function resolveCliSessionReuse(options) {
  if (options.forceReuse) {
    // Skip hash check and trust the binding
    return true;
  }
  // Existing hash check logic
}

Notes

The suggested fix assumes that the forceReuse option is passed when manually attaching to an existing CLI session. The local runtime patch has been working since 2026-04-29, which suggests that the fix is effective.

Recommendation

Apply the workaround by adding the forceReuse: true short-circuit in resolveCliSessionReuse, as it has been proven to work with the local runtime patch.

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

openclaw - 💡(How to fix) Fix resolveCliSessionReuse: manual attach invalidated on first turn (any hash drift treated as fresh session) [2 comments, 3 participants]