Skip to content

fix: session_status 'current' resolves to live run session instead of stale sandbox key (#76708) - #76995

Merged
clawsweeper[bot] merged 3 commits into
mainfrom
ak/issue-76708-bug-session-status-current-resolves-to-stale-tel
May 4, 2026
Merged

clawsweeper[bot] merged 3 commits into
mainfrom
ak/issue-76708-bug-session-status-current-resolves-to-stale-tel

Conversation

@amknight

@amknight amknight commented May 3, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #76708

session_status({sessionKey: "current"}) was resolving to a stale Telegram direct session key instead of the live run session when the tool was constructed with a sandbox/policy session key.

Root Cause

In runEmbeddedAttempt, sandboxSessionKey (derived from params.sandboxSessionKey) is passed as sessionKey into createOpenClawCodingTools. When a user calls session_status({sessionKey: "current"}), the resolution logic uses this sandbox key as the requester identity, which can resolve to the stale Telegram direct session instead of the actual live run session (agent:main:main).

Fix

Thread a new runSessionKey option through the tool creation chain:

  • createSessionStatusTool → createOpenClawTools → createOpenClawCodingTools
  • runEmbeddedAttempt and compactEmbeddedPiSessionDirectOnce pass the live params.sessionKey as runSessionKey when it differs from sandboxSessionKey
  • When sessionKey: "current" is requested and runSessionKey is available, it resolves directly to the live run session

This preserves sandbox/tool-policy enforcement (which uses sandboxSessionKey) while fixing user-visible status reporting.

Tests

  • pnpm test src/agents/openclaw-tools.session-status.test.ts — 47/47 passed
  • pnpm test src/agents/pi-embedded-runner/compact.hooks.test.ts — 39/39 passed

New regression test verifies that when a session store has both a stale Telegram direct session and a live main session, session_status({sessionKey: "current"}) returns the live session.

Changelog

Entry added to CHANGELOG.md under Unreleased > Fixes.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels May 3, 2026
@clawsweeper

clawsweeper Bot commented May 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

Summary
The PR threads a live runSessionKey through embedded tool construction, updates session_status({sessionKey:"current"}) resolution, and adds unit, Telegram QA, workflow, and changelog coverage for #76708.

Reproducibility: yes. Source inspection shows current main gives session_status only the sandbox/requester key, and the linked report plus PR follow-up describe a focused Telegram Docker scenario that fails pre-fix and passes with this head.

Next step before merge
No repair job is needed: the automerge-opted PR has no actionable review findings, so exact-head checks and mergeability should gate the remaining path.

Security
Cleared: The diff adds bounded session identity plumbing plus QA/workflow scenario coverage and does not add dependencies, secrets exposure, broader permissions, or new artifact execution paths.

Review details

Best possible solution:

Merge this PR after exact-head automerge and CI gates pass, keeping sandbox policy identity separate from live run identity and retaining the new regression and Telegram QA coverage.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection shows current main gives session_status only the sandbox/requester key, and the linked report plus PR follow-up describe a focused Telegram Docker scenario that fails pre-fix and passes with this head.

Is this the best way to solve the issue?

Yes. The PR is the narrow maintainable fix: it adds a separate live run-session identity for semantic current lookups while preserving sandbox/tool-policy identity and explicit cross-session denial.

What I checked:

Likely related people:

  • steipete: Recent history shows maintenance on the same session-status fallback area, embedded runner surfaces, and Telegram QA/release validation paths touched by this PR. (role: recent maintainer and adjacent owner; confidence: high; commits: dfca707e4b16, 786fdeb36631, 3367cfaa1466; files: src/agents/tools/session-status-tool.ts, src/agents/pi-embedded-runner/run/attempt.ts, extensions/qa-lab/src/live-transports/telegram/telegram-live.runtime.ts)
  • bittoby: Recent merged commits added channel-plugin sessionKey=current handling and sparse requester session-status behavior in the same tool and test files. (role: recent adjacent feature author; confidence: high; commits: 8ace33be6768, d5ad90f7ec7c; files: src/agents/tools/session-status-tool.ts, src/agents/openclaw-tools.session-status.test.ts)
  • obviyus: Commit metadata shows this person committed the recent current-session status fixes and recently maintained Telegram QA runtime timeout behavior adjacent to the new QA scenario. (role: recent maintainer and QA adjacent owner; confidence: medium; commits: 8ace33be6768, d5ad90f7ec7c, 9e94a9e418d4; files: src/agents/tools/session-status-tool.ts, src/agents/openclaw-tools.session-status.test.ts, extensions/qa-lab/src/live-transports/telegram/telegram-live.runtime.ts)

Remaining risk / open question:

  • Exact-head CI/automerge gates still need to pass; this read-only review did not execute tests locally.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 02b9dbde394b.

@amknight

amknight commented May 4, 2026

Copy link
Copy Markdown
Member Author

E2E follow-up pushed in 935169feec.

What I verified:

  • Set up fresh Telegram QA bots/group and confirmed raw bot-to-bot group delivery through the Telegram Bot API.
  • Built a pre-fix origin/main package tarball and reproduced the failure in Docker with the focused scenario:
    • canary passed
    • telegram-current-session-status-tool failed
    • observed reply: 📊 Session Status: current / progress-only session_status current, i.e. current was not resolved to the live Telegram group session.
  • Ran the same focused Docker scenario against the PR package and found an additional packaged Telegram path still failing because sandboxed channel runs could pass literal current through sessions.resolve when no separate runSessionKey was present.

Fixes added:

  • session_status({ sessionKey: "current" }) now resolves semantic current to runSessionKey when present, or to the effective requester key for sandboxed channel runs when no separate run key exists.
  • Added a focused regression for the sandboxed Telegram-shaped current-session path.
  • Added an opt-in Telegram live QA scenario that forces the mock model to call session_status with sessionKey: "current" and assert the resolved session is the Telegram group session.
  • Updated the Telegram QA harness to observe edited_message updates and keep waiting past progress drafts until the expected final marker is present.
  • Wired the new scenario into the package acceptance Telegram lane in CI.

Passing verification after the fix:

  • pnpm build
  • pnpm ui:build
  • node scripts/run-vitest.mjs run src/agents/openclaw-tools.session-status.test.ts extensions/qa-lab/src/live-transports/telegram/telegram-live.runtime.test.ts passed: 98 tests.
  • node scripts/run-vitest.mjs run test/scripts/package-acceptance-workflow.test.ts test/scripts/npm-telegram-live.test.ts extensions/qa-lab/src/live-transports/telegram/telegram-live.runtime.test.ts src/agents/openclaw-tools.session-status.test.ts passed: 123 tests.
  • Package tarball integrity passed for the refreshed PR tarball.
  • Focused Docker Telegram E2E passed with the final marker:
    • QA-TELEGRAM-CURRENT-SESSION-OK agent:qa:telegram:group:-5096326138
  • Broader default Docker Telegram E2E passed: canary plus 6 default scenarios, 7/7 passed.

@amknight

amknight commented May 4, 2026

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@amknight
amknight marked this pull request as ready for review May 4, 2026 03:53
@amknight
amknight force-pushed the ak/issue-76708-bug-session-status-current-resolves-to-stale-tel branch 2 times, most recently from f470f2f to f604b90 Compare May 4, 2026 03:56
amknight and others added 3 commits May 4, 2026 13:56
- Track isSemanticCurrentRequest before key rewrite
- Skip early explicit-agent-key visibility check for current requests
- Add isSemanticCurrentRequest to shouldTreatVisibilityTargetAsSelf
- Fix test to use default/tree visibility instead of 'all'
- Add negative guard test for explicit cross-session key rejection
@amknight
amknight force-pushed the ak/issue-76708-bug-session-status-current-resolves-to-stale-tel branch from f604b90 to c3c964e Compare May 4, 2026 03:59
@amknight

amknight commented May 4, 2026

Copy link
Copy Markdown
Member Author

/clawsweeper automerge

@clawsweeper clawsweeper Bot added the clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge label May 4, 2026
@clawsweeper

clawsweeper Bot commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞✅
ClawSweeper merged this PR after the passing review.

Source: clawsweeper[bot]
Feedback: structured ClawSweeper verdict: pass (sha=c3c964ecfd5b8a1be4d44b8ad7d4c60085bc78da)
Merge status: merged by ClawSweeper automerge
Merged at: 2026-05-04T04:04:44Z
Merge commit: 3f732aee83d5

What merged:

Automerge notes:

The automerge loop is complete.

Automerge progress:

  • 2026-05-04 04:00:12 UTC review queued c3c964ecfd5b (queued)
  • 2026-05-04 04:04:31 UTC review passed c3c964ecfd5b (structured ClawSweeper verdict: pass (sha=c3c964ecfd5b8a1be4d44b8ad7d4c60085bc7...)
  • 2026-05-04 04:04:46 UTC merged c3c964ecfd5b (merged by ClawSweeper automerge)

@clawsweeper
clawsweeper Bot merged commit 3f732ae into main May 4, 2026
113 checks passed
@clawsweeper
clawsweeper Bot deleted the ak/issue-76708-bug-session-status-current-resolves-to-stale-tel branch May 4, 2026 04:04
lxe pushed a commit to lxe/openclaw that referenced this pull request May 6, 2026
… stale sandbox key (openclaw#76708) (openclaw#76995)

Summary:
- The PR threads a live `runSessionKey` through embedded tool construction, updates `session_status({sessionKey:"current"})` resolution, and adds unit, Telegram QA, workflow, and changelog coverage for openclaw#76708.
- Reproducibility: yes. Source inspection shows current main gives `session_status` only the sandbox/requester ... plus PR follow-up describe a focused Telegram Docker scenario that fails pre-fix and passes with this head.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix: preserve session visibility semantics for runSessionKey (openclaw#76708)
- PR branch already contained follow-up commit before automerge: fix: cover Telegram current session status

Validation:
- ClawSweeper review passed for head c3c964e.
- Required merge gates passed before the squash merge.

Prepared head SHA: c3c964e
Review: openclaw#76995 (comment)

Co-authored-by: Alex Knight <[email protected]>
Co-authored-by: Alex Knight <[email protected]>
markfietje pushed a commit to markfietje/openclaw that referenced this pull request May 20, 2026
… stale sandbox key (#76708) (#76995)

Summary:
- The PR threads a live `runSessionKey` through embedded tool construction, updates `session_status({sessionKey:"current"})` resolution, and adds unit, Telegram QA, workflow, and changelog coverage for #76708.
- Reproducibility: yes. Source inspection shows current main gives `session_status` only the sandbox/requester ... plus PR follow-up describe a focused Telegram Docker scenario that fails pre-fix and passes with this head.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix: preserve session visibility semantics for runSessionKey (#76708)
- PR branch already contained follow-up commit before automerge: fix: cover Telegram current session status

Validation:
- ClawSweeper review passed for head c3c964ecfd5b8a1be4d44b8ad7d4c60085bc78da.
- Required merge gates passed before the squash merge.

Prepared head SHA: c3c964ecfd5b8a1be4d44b8ad7d4c60085bc78da
Review: openclaw/openclaw#76995 (comment)

Co-authored-by: Alex Knight <[email protected]>
Co-authored-by: Alex Knight <[email protected]>
markfietje pushed a commit to markfietje/openclaw that referenced this pull request May 20, 2026
… stale sandbox key (#76708) (#76995)

Summary:
- The PR threads a live `runSessionKey` through embedded tool construction, updates `session_status({sessionKey:"current"})` resolution, and adds unit, Telegram QA, workflow, and changelog coverage for #76708.
- Reproducibility: yes. Source inspection shows current main gives `session_status` only the sandbox/requester ... plus PR follow-up describe a focused Telegram Docker scenario that fails pre-fix and passes with this head.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix: preserve session visibility semantics for runSessionKey (#76708)
- PR branch already contained follow-up commit before automerge: fix: cover Telegram current session status

Validation:
- ClawSweeper review passed for head c3c964ecfd5b8a1be4d44b8ad7d4c60085bc78da.
- Required merge gates passed before the squash merge.

Prepared head SHA: c3c964ecfd5b8a1be4d44b8ad7d4c60085bc78da
Review: openclaw/openclaw#76995 (comment)

Co-authored-by: Alex Knight <[email protected]>
Co-authored-by: Alex Knight <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
… stale sandbox key (openclaw#76708) (openclaw#76995)

Summary:
- The PR threads a live `runSessionKey` through embedded tool construction, updates `session_status({sessionKey:"current"})` resolution, and adds unit, Telegram QA, workflow, and changelog coverage for openclaw#76708.
- Reproducibility: yes. Source inspection shows current main gives `session_status` only the sandbox/requester ... plus PR follow-up describe a focused Telegram Docker scenario that fails pre-fix and passes with this head.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix: preserve session visibility semantics for runSessionKey (openclaw#76708)
- PR branch already contained follow-up commit before automerge: fix: cover Telegram current session status

Validation:
- ClawSweeper review passed for head c3c964e.
- Required merge gates passed before the squash merge.

Prepared head SHA: c3c964e
Review: openclaw#76995 (comment)

Co-authored-by: Alex Knight <[email protected]>
Co-authored-by: Alex Knight <[email protected]>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
… stale sandbox key (openclaw#76708) (openclaw#76995)

Summary:
- The PR threads a live `runSessionKey` through embedded tool construction, updates `session_status({sessionKey:"current"})` resolution, and adds unit, Telegram QA, workflow, and changelog coverage for openclaw#76708.
- Reproducibility: yes. Source inspection shows current main gives `session_status` only the sandbox/requester ... plus PR follow-up describe a focused Telegram Docker scenario that fails pre-fix and passes with this head.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix: preserve session visibility semantics for runSessionKey (openclaw#76708)
- PR branch already contained follow-up commit before automerge: fix: cover Telegram current session status

Validation:
- ClawSweeper review passed for head c3c964e.
- Required merge gates passed before the squash merge.

Prepared head SHA: c3c964e
Review: openclaw#76995 (comment)

Co-authored-by: Alex Knight <[email protected]>
Co-authored-by: Alex Knight <[email protected]>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
… stale sandbox key (openclaw#76708) (openclaw#76995)

Summary:
- The PR threads a live `runSessionKey` through embedded tool construction, updates `session_status({sessionKey:"current"})` resolution, and adds unit, Telegram QA, workflow, and changelog coverage for openclaw#76708.
- Reproducibility: yes. Source inspection shows current main gives `session_status` only the sandbox/requester ... plus PR follow-up describe a focused Telegram Docker scenario that fails pre-fix and passes with this head.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix: preserve session visibility semantics for runSessionKey (openclaw#76708)
- PR branch already contained follow-up commit before automerge: fix: cover Telegram current session status

Validation:
- ClawSweeper review passed for head c3c964e.
- Required merge gates passed before the squash merge.

Prepared head SHA: c3c964e
Review: openclaw#76995 (comment)

Co-authored-by: Alex Knight <[email protected]>
Co-authored-by: Alex Knight <[email protected]>
zeekay pushed a commit to hanzoai/bot that referenced this pull request Sep 11, 2026
… stale sandbox key (#76708) (#76995)

Summary:
- The PR threads a live `runSessionKey` through embedded tool construction, updates `session_status({sessionKey:"current"})` resolution, and adds unit, Telegram QA, workflow, and changelog coverage for #76708.
- Reproducibility: yes. Source inspection shows current main gives `session_status` only the sandbox/requester ... plus PR follow-up describe a focused Telegram Docker scenario that fails pre-fix and passes with this head.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix: preserve session visibility semantics for runSessionKey (#76708)
- PR branch already contained follow-up commit before automerge: fix: cover Telegram current session status

Validation:
- ClawSweeper review passed for head c3c964ecfd5b8a1be4d44b8ad7d4c60085bc78da.
- Required merge gates passed before the squash merge.

Prepared head SHA: c3c964ecfd5b8a1be4d44b8ad7d4c60085bc78da
Review: openclaw/openclaw#76995 (comment)

Co-authored-by: Alex Knight <[email protected]>
Co-authored-by: Alex Knight <[email protected]>
zeekay pushed a commit to hanzoai/bot that referenced this pull request Sep 11, 2026
… stale sandbox key (#76708) (#76995)

Summary:
- The PR threads a live `runSessionKey` through embedded tool construction, updates `session_status({sessionKey:"current"})` resolution, and adds unit, Telegram QA, workflow, and changelog coverage for #76708.
- Reproducibility: yes. Source inspection shows current main gives `session_status` only the sandbox/requester ... plus PR follow-up describe a focused Telegram Docker scenario that fails pre-fix and passes with this head.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix: preserve session visibility semantics for runSessionKey (#76708)
- PR branch already contained follow-up commit before automerge: fix: cover Telegram current session status

Validation:
- ClawSweeper review passed for head c3c964ecfd5b8a1be4d44b8ad7d4c60085bc78da.
- Required merge gates passed before the squash merge.

Prepared head SHA: c3c964ecfd5b8a1be4d44b8ad7d4c60085bc78da
Review: openclaw/openclaw#76995 (comment)

Co-authored-by: Alex Knight <[email protected]>
Co-authored-by: Alex Knight <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge extensions: qa-lab maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: session_status current resolves to stale Telegram direct session instead of live main session

1 participant