Repository navigation
feat(sessions): allow same-channel thread recall without agent-wide visibility - #163267
shannon0430 wants to merge 130 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. What this changesAdds opt-in same-channel session retrieval across session tools, memory search, and Wiki while denying sibling mutations. Example: Two Slack threads belong to agent main, account default, workspace t111, and channel c111.
Review scores
ProductKind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain The previous admission-lifetime finding remains unresolved in indexed recall, and the revised SDK behavior conflicts with an existing test assertion. This PR also needs a maintainer decision on adopting the new retrieval scope. Reviewed head: Decision needed
Before merge
Findings
Agent review detailsHow this fits togetherSession tools and memory plugins submit transcript reads to Gateway owners, which apply visibility decisions and return session metadata, history, snippets, and citations. flowchart LR
A[Requesting agent] --> B[Session tools]
A --> C[Memory and Wiki]
B --> D[Shared visibility policy]
C --> D
D --> E[Gateway session owners]
E --> F[Transcript storage]
E --> G[Filtered results]
Technical reviewBest possible solution: Use the existing visibility owners to preserve admitted channel decisions through indexed publication and retries, with consistent tests and an owner-approved additive contract. Do we have a high-confidence way to reproduce the issue? Source inspection establishes both remaining defects: indexed recall reauthorizes after admission, and the SDK policy-change assertion expects the opposite of the revised implementation; no tests were executed. Is this the best way to solve the issue? Extending the shared visibility owner fits the requested boundary, but indexed recall must consume its recorded admission decision and the SDK test must match that lifetime. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2486668ca558. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +1389, Tests +2249, Docs +34, Generated 0, Other +4. Total +3676 across 52 files. Added test files: 7. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall readiness starts with the lower of the proof and patch scores. It is capped at 3/6 if the fix is partial, the change offers little benefit, a product decision is still open, or the PR reverses an earlier decision without saying why. ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (63 earlier review cycles; latest 8 shown)
Reviewed November 29, 2026, 10:06 PM ET / November 30, 2026, 03:06 UTC (Revision 64). |
|
Automated author follow-up checkpoint:
For |
|
Refreshed this PR with current Each channel-scoped candidate is now re-authorized immediately before transcript search, with exact session-incarnation fencing when available. Focused suites passed (141 tests), scoped The product/SDK choice about retrieval-only versus also send/status remains for maintainers. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…l-visibility # Conflicts: # docs/.generated/config-baseline.sha256
|
🦞👀 Re-review progress:
|
|
Addressed the two fresh exact-head security findings and refreshed with current main at ba0fe78.
The maintainer-owned retrieval-only versus sibling send/status contract remains unchanged. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…l-visibility # Conflicts: # docs/.generated/config-baseline.sha256
|
Addressed the three fresh authorization findings on exact head
I also merged current upstream Regression evidence:
The dead-export scan remains excluded from the local changed check because its two failures ( I have not relabeled the focused/unit evidence as an actual Gateway or live Slack run. The earlier Gateway proof is still attached to the PR, but a fresh exact-head real-Gateway/stable-upgrade proof remains distinct follow-up evidence if required before merge. The product-scope choice also remains with maintainers: this patch deliberately authorizes channel-scoped retrieval only, not sibling send/status/write operations. |
…dmitted-read-20261128 # Conflicts: # docs/.generated/config-baseline.sha256 # packages/gateway-protocol/src/compiled/protocol.generated/predicates.js # src/gateway/server-methods/sessions-search-recall.ts
|
Resolved the admission-contract blocker and integrated current upstream Exact head: The shared publication owner now preserves a channel decision made when the read was admitted while still rechecking the requester/target owner and expected session incarnation. The same contract is applied to Exact-head validation:
The separate maintainer decision on adopting the retrieval-only channel contract remains unchanged. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Contributor verification update for The PR description promises that a withdrawn route fails closed. The latest implementation note describes permission at read admission. Those statements give different answers for an in-flight read. My recommendation is to require current channel access before releasing cross-session content, while continuing reads that remain authorized. The earlier limited test pass does not cover these two failures. This integration is still pending. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Following the exact-head review of Both released baselines were tested against this head. GitHub’s latest stable tag, v2026.11.10, and the npm distribution, 2026.11.11, each passed the checked-in stable-to-candidate Gateway fixture with the real memory worker enabled. The retained model override was distinct from the default, survived Doctor and the attempted sibling mutation, and the preserved history remained searchable. An additional isolated run on the 11.10 state enabled the real memory-wiki plugin and invoked |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Restored admission-once semantics at exact head What changed:
Exact-head verification:
The earlier candidate-bound model/stable-upgrade evidence remains scoped to sibling discovery, persistence and retrieval; the changed admission/publication boundary has fresh exact-head focused proof above. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…267-20261130 # Conflicts: # docs/.generated/config-baseline.sha256 # src/agents/tools/sessions-history-tool.ts
|
Addressed the current P2 at The shared history/list/search/memory/Wiki publication owner now carries the admission-time channel decision through publication and indexed retries. Route or policy changes affect the next request; requester/target incarnation, archive state, projection replacement, abort handling, and the admitted identity ceiling remain live fences. Current main Validation:
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Closes #163256
What Problem This Solves
Opt-in
tools.sessions.visibility: "channel"lets an agent retrieve a sibling thread in the same verified channel. It does not grant permission to send to that thread or change its model or settings. The existing visibility defaults stay in effect.Which results may be returned?
A sibling result must be readable when the request is admitted. That decision stays fixed through publication and indexed retries, matching OpenClaw's admission rule. This applies to history, list, targeted and indexed session search, and transcript-backed memory and Wiki results. The Gateway still revalidates requester and target incarnation, archive state, projection ownership and abort state before publishing.
Evidence
Current candidate
cd897fcdc2b6d8a8fcae3293fab4d74680eae55d, including upstream mained76855c83d88a63e46efbfcd9ec67273046e332.Model-chosen retrieval on this revision
A real Qwen3.5-9B (Q4_K_M) used the compiled Gateway with the four session tools directly offered (status, list, history and search), automatic tool choice and runner reasoning off. The requester asked about a previously agreed pickup code. Its question named no tool, session ID or code. Only a synthetic sibling held the right code. A matching thread in another channel held a different code.
The model chose
sessions_searchdirectly. The call ID matched the result containing the sibling and code. We read the final answer from the requesting thread withchat.history. It contained the correct code. The other channel's code was absent from every model input and the reply. There were 2 inference requests; Slack delivery was off.With default tool discovery, the same short question ended after 13 model calls without a verified search result or a correct final answer. With a second natural request asking to look through earlier discussions, the model independently chose
sessions_listandsessions_history, found the sibling, and answered with the correct code on the original thread in 5 inferences. The other channel's code never reached the model. This run demonstrates the task outcome through history; the direct-tools run above demonstrates autonomous selection ofsessions_search.Additional upgrade evidence
Both released baselines were tested against candidate
462b973a463e. The results in this paragraph refer to that earlier revision. the v2026.11.10 release, and the npm distribution, 2026.11.11, each passed the checked-in stable-to-candidate Gateway fixture with the real memory worker enabled. The retained model override was distinct from the default, survived Doctor and the attempted sibling mutation, and the preserved history remained searchable. An additional isolated run on the 11.10 state enabled the real memory-wiki plugin and invokedwiki_searchthrough the candidate Gateway (shared backend, memory corpus). It returned the permitted sibling and excluded the other scopes, then excluded the sibling on the next request after reassignment. The search manager was not mocked. The Gateway in these tests is in-process, with public RPC tool calls.Model-chosen retrieval on the candidate Gateway
Tested
462b973a463ewith the compiled Gateway, the native OpenClaw agent runtime and real local inference (llama.cpp b12833). The isolated SQLite state held a requester thread, a sibling that contained a newly generated pickup code, and an otherwise matching thread in a different channel with a different code. The requester’s question was:The question named no tool, thread key or code. We sent it through
chat.sendon the requester session with delivery off. We compared the model's emitted tool-call ID with the tool result in its next inference request, then read the final assistant message from the original thread usingchat.history. No model replies or tool calls were supplied by the test.tools.toolSearch: falsesessions_search. Its call returned the sibling thread and its code. The model answered with exactly that code on its second inference request. Neither code was in its initial input, and the other channel’s code never reached the model.sessions_searchitself. Only that call returned the pickup code. Its search result contained the sibling code; the original thread received the correct code with extra explanatory text. The different-channel code was absent from all model inputs and the response. An earlier 9B run with the runner’s automatic reasoning and OpenClaw configured for non-thinking output also selected the search and received the correct sibling. It ended with a reasoning-only provider response and no visible answer. The follow-up aligned the runner with the configured mode.Sanitized per-turn readback (call names are in model-emission order):
{"model":"Qwen3-4B-Instruct-2507, Q4_K_M","toolSurface":"direct","inferenceRequests":2,"calls":["sessions_search"],"siblingAndCodeInLinkedResult":true,"originalThreadAnsweredExactly":true,"differentChannelCodeSeen":false} {"model":"Qwen3.5-9B, Q4_K_M","toolSurface":"default","inferenceRequests":9,"calls":["tool_search","tool_search","tool_search","tool_search","dispatch_action(session_status)","dispatch_action(sessions_list)","dispatch_action(sessions_history)","dispatch_action(sessions_search)"],"siblingAndCodeInLinkedResult":true,"originalThreadAnsweredExactly":false,"differentChannelCodeSeen":false,"runnerReasoning":"off"} {"model":"Qwen3-4B-Instruct-2507, Q4_K_M","toolSurface":"default","inferenceRequests":6,"calls":["tool_search","tool_search","tool_search","tool_search","tool_search"],"siblingAndCodeInLinkedResult":false,"originalThreadAnsweredExactly":false,"differentChannelCodeSeen":false} {"model":"Qwen3.5-9B, Q4_K_M","toolSurface":"default","inferenceRequests":2,"calls":["dispatch_action(sessions_search)"],"siblingAndCodeInLinkedResult":true,"originalThreadAnsweredExactly":false,"differentChannelCodeSeen":false,"runnerReasoning":"auto"}This exercises local Slack-shaped session routes. Live Slack delivery was disabled.
Decision before merge
The implementation now follows OpenClaw's admission-once rule: route and effective-policy changes apply to the next request, while requester/target incarnation, archive, projection and abort fences remain live through publication. Maintainer adoption of the opt-in channel retrieval product contract remains the only product decision; no authority-lifetime exception is requested.
Exact-head hosted CI and re-review are pending for
cd897fcdc2b6d8a8fcae3293fab4d74680eae55d.