Skip to content

Fix current session visibility aliases#89461

Closed
bemsas wants to merge 2 commits into
openclaw:mainfrom
bemsas:fix/cron-telegram-current-history
Closed

Fix current session visibility aliases#89461
bemsas wants to merge 2 commits into
openclaw:mainfrom
bemsas:fix/cron-telegram-current-history

Conversation

@bemsas

@bemsas bemsas commented Jun 2, 2026

Copy link
Copy Markdown

Summary

  • Treat configured current-session aliases as current for session visibility checks
  • Pass current-session aliases through sessions_list, sessions_history, and sessions_send
  • Add regression coverage for self/tree visibility alias handling

Verification

  • pnpm exec vitest run src/agents/tools/sessions-access.test.ts --config vitest.unit.config.ts
  • pnpm exec oxfmt --check src/agents/tools/sessions-access.ts src/agents/tools/sessions-history-tool.ts src/agents/tools/sessions-list-tool.ts src/agents/tools/sessions-send-tool.ts src/agents/tools/sessions-access.test.ts
  • pnpm tsgo

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 2, 2026
@clawsweeper

clawsweeper Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 2, 2026, 12:22 PM ET / 16:22 UTC.

Summary
The PR adds a currentSessionKeys alias set to shared session visibility checks and threads it through sessions_history, sessions_list, and sessions_send, with regression tests for self/tree alias handling.

PR surface: Source +17, Tests +33. Total +50 across 6 files.

Reproducibility: yes. for the patch defect: source inspection shows a requester such as agent:main:telegram:direct:123 receives currentSessionKeys containing main, and the PR checker then treats that target as current under self/tree. I did not run tests because this review is read-only.

Review metrics: 2 noteworthy metrics.

  • Current alias candidates: 5 keys accepted. The new alias set includes requester keys plus alias, mainKey, and literal main, which is the source of the access-boundary risk.
  • Shared visibility API params: 3 optional parameters added. The PR changes shared/plugin-SDK session visibility helper signatures, so the contract and semantics need maintainer review before merge.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🧂 unranked krab
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Constrain current-session aliases to the actual requester and add negative tests for main/agent:main:main from non-main requesters under self and tree.
  • [P1] Add redacted real behavior proof in the PR body showing the fixed list/history/send workflow after the patch.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body only lists test, format, and type commands; the external contributor should add redacted live output, logs, a terminal screenshot, or a recording/artifact showing the after-fix behavior, then update the PR body so ClawSweeper re-reviews automatically or a maintainer can comment @clawsweeper re-review.

Risk before merge

  • [P1] Merging as-is can let a non-main same-agent requester use main or agent:main:main as a current session under self/tree, bypassing the session visibility boundary for history, list, and send paths.
  • [P1] The patch changes the shared plugin SDK visibility helper signatures, so the alias semantics need owner/security review before this becomes a public helper contract.
  • [P1] The external PR has no after-fix real behavior proof from a live setup, so reviewer confidence is limited to source inspection and listed local commands.

Maintainer options:

  1. Constrain aliases before merge (recommended)
    Limit currentSessionKeys to the requester and semantic-current aliases that resolve to that requester, then add regression tests proving non-main requesters cannot access main or agent:main:main under self/tree.
  2. Accept broader main alias access
    Maintainers could explicitly decide that main should mean current for all same-agent session tools, but that would be a deliberate access-boundary change and should be documented with owner approval.
  3. Pause for boundary direction
    If the intended meaning of current-session aliases is still unsettled, pause this PR until the session tool owner chooses the canonical requester-vs-main behavior.

Next step before merge

  • [P1] Needs human review because the remaining blockers are access-boundary semantics and external contributor real behavior proof, not a safe bot-only repair path.

Security
Needs attention: The diff introduces a concrete session access-boundary regression by trusting main aliases as current for all same-agent requesters.

Review findings

  • [P1] Limit current aliases to the actual requester — src/agents/tools/sessions-access.ts:40-42
Review details

Best possible solution:

Keep the shared visibility guard strict until the PR only marks aliases that resolve to the actual requester as current, adds denial coverage for non-main requesters targeting main aliases, and includes redacted live proof of the fixed workflow.

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

Yes for the patch defect: source inspection shows a requester such as agent:main:telegram:direct:123 receives currentSessionKeys containing main, and the PR checker then treats that target as current under self/tree. I did not run tests because this review is read-only.

Is this the best way to solve the issue?

No, this is a plausible layer but not the best fix as written. The safer fix should derive current aliases from the actual requester/semantic-current resolution only, not add configured main aliases for every requester.

Full review comments:

  • [P1] Limit current aliases to the actual requester — src/agents/tools/sessions-access.ts:40-42
    currentSessionKeys includes alias, mainKey, and literal main for every caller. For a non-main same-agent requester, main resolves to the main session but now passes isRequesterSession, so sessions_history, sessions_list, and sessions_send can bypass self/tree visibility; build this set only from keys that resolve to the requester and add denial tests for main aliases from non-main requesters.
    Confidence: 0.93

Overall correctness: patch is incorrect
Overall confidence: 0.92

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: This is a normal-priority session visibility fix PR with a blocking security-boundary issue before merge, not an already-merged user-facing emergency.
  • merge-risk: 🚨 security-boundary: The diff can make main-session aliases pass self/tree checks for non-main same-agent requesters in shared session tools.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body only lists test, format, and type commands; the external contributor should add redacted live output, logs, a terminal screenshot, or a recording/artifact showing the after-fix behavior, then update the PR body so ClawSweeper re-reviews automatically or a maintainer can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +17, Tests +33. Total +50 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 5 21 4 +17
Tests 1 33 0 +33
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 54 4 +50

Security concerns:

  • [high] Main aliases can bypass session visibility — src/agents/tools/sessions-access.ts:40
    The added alias set includes alias, mainKey, and main without checking whether they identify the requester; because the shared checker accepts any set member as the requester session before self/tree denials, non-main requesters can gain main-session visibility through list/history/send.
    Confidence: 0.91

What I checked:

  • PR alias set admits global main aliases: At PR head, resolveSandboxedSessionToolContext builds currentSessionKeys from effectiveRequesterKey, requesterInternalKey, alias, mainKey, and literal main, so non-main requesters inherit configured main aliases as current-session keys. (src/agents/tools/sessions-access.ts:40, 8484484f3ef6)
  • PR checker trusts every currentSessionKeys hit: At PR head, createSessionVisibilityRowChecker treats any key in currentSessionKeys as isRequesterSession before the self and tree denials run. (src/plugin-sdk/session-visibility.ts:306, 8484484f3ef6)
  • Current main keeps self limited to requester/current: Current main only treats the exact requester key or literal current as the requester session in the shared visibility checker, so the PR is the source of the broader alias trust. (src/plugin-sdk/session-visibility.ts:303, f789081bae12)
  • Resolution makes main aliases security-relevant: Current resolution maps input main to the configured alias, and display logic also labels either alias or mainKey as main, so adding both to currentSessionKeys affects real resolved targets. (src/agents/tools/sessions-resolution.ts:62, f789081bae12)
  • Sibling status behavior blocks this access pattern: Current session_status tests explicitly block a non-main same-agent requester from accessing agent:main:main or bare main under tools.sessions.visibility=self, which is the boundary this PR would weaken for list/history/send. (src/agents/openclaw-tools.session-status.test.ts:1775, f789081bae12)
  • Real behavior proof missing: The PR body lists Vitest, oxfmt, and tsgo commands only; no redacted live output, logs, recording, terminal screenshot, or linked artifact demonstrates the changed behavior after the patch. (8484484f3ef6)

Likely related people:

  • @steipete: Introduced the split access/resolution helpers and shared session tool context used by this PR. (role: feature-history owner; confidence: high; commits: 1a03aad24649, 8a4f9f168bd5, 42d6e35cb45f; files: src/agents/tools/sessions-access.ts, src/agents/tools/sessions-resolution.ts, src/agents/tools/sessions-history-tool.ts)
  • Robin Waslander: Added recent session_status visibility hardening and tests that preserve the non-main requester boundary for main aliases. (role: security-boundary hardening contributor; confidence: medium; commits: 4d369a3400dc; files: src/agents/tools/session-status-tool.ts, src/agents/openclaw-tools.session-status.test.ts)
  • @vincentkoc: Recent history shows multiple agent/status/access-boundary changes near the same session visibility surface. (role: adjacent area contributor; confidence: medium; commits: 11318ef9b949, 340c99d65733, 7cd0ff2d888f; files: src/agents/tools/session-status-tool.ts, src/plugin-sdk/session-visibility.ts)
  • NVIDIAN: Current shallow blame for the shared session visibility/access files points at this author, though the commit summary is broad and the ownership signal is weaker than the focused history above. (role: recent current-line contributor; confidence: low; commits: eb417bc672e6; files: src/agents/tools/sessions-access.ts, src/plugin-sdk/session-visibility.ts, src/agents/tools/sessions-resolution.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jun 2, 2026
…rent-history

# Conflicts:
#	src/agents/tools/sessions-access.ts
#	src/agents/tools/sessions-history-tool.ts
#	src/agents/tools/sessions-list-tool.ts
#	src/agents/tools/sessions-send-tool.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant