Repository navigation
fix(sandbox): normalize session aliases in explain - #182406
Conversation
Use the canonical agent resolver and store-key expansion before diagnostic session lookup. Channel-prefixed aliases and the main alias now resolve like other session consumers, while global sessions and mismatched-agent rejection retain their existing owners. This repairs sandbox explain diagnostics only; sender authorization is unchanged. Refs #51245.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR normalizes sandbox-explain session aliases through existing agent and session-key resolvers. Example: With agent builder and session.mainKey set to operator, run openclaw sandbox explain --session main.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness✅ Ready for maintainer review Keep open: this PR provides a focused diagnostic fix still needed on current main, with no actionable correctness findings. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe sandbox diagnostic accepts CLI agent/session selectors, reads existing session metadata and sandbox configuration, and prints effective policy without authorizing execution. flowchart TD
A[CLI selectors] --> B[Canonical agent resolution]
B --> C[Canonical session key]
C --> D[Read-only session lookup]
D --> E[Sandbox and channel diagnostics]
E --> F[JSON or terminal report]
Technical reviewBest possible solution: Use the existing normalization owners for this diagnostic and retain separate tracking for live Telegram sender authorization. Do we have a high-confidence way to reproduce the issue? Current-main source establishes both failing paths, and the PR reports four new cases failing before the fix; no target code was executed during this read-only review. Is this the best way to solve the issue? This is the smallest complete diagnostic repair: reuse canonical agent selection and store-key expansion while preserving global sessions, stored delivery precedence, and mismatch rejection. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7a9a6a981aba. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -9, Tests +42, Docs +1. Total +34 across 3 files. Added test files: 0. View PR surface stats
Review metrics
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 follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 24, 2026, 4:27 AM ET / 08:27 UTC. |
|
Merged via squash.
|
Use the canonical agent resolver and store-key expansion before diagnostic session lookup. Channel-prefixed aliases and the main alias now resolve like other session consumers, while global sessions and mismatched-agent rejection retain their existing owners. This repairs sandbox explain diagnostics only; sender authorization is unchanged. Refs openclaw#51245.
What Problem This Solves
Fixes:
openclaw sandbox explainrejects an unscoped channel session alias such astelegram:slash:123, and expands the short namemainliterally instead of honoringsession.mainKey.User Impact
sandbox explain --sessionnow resolves channel aliases and the configured main session the same way the rest of OpenClaw does, so the diagnostic reports the right agent and sandbox policy.Why This Change Was Made
The command treated every colon-bearing key as already agent-scoped and kept its own short-name expansion and agent-mismatch check. It now uses the existing agent-selection owner and
toAgentStoreSessionKeybefore session lookup and channel inference, removing the local colon heuristic, the duplicate mismatch policy, and the separate short-name builder. Stored delivery metadata still takes precedence, global sessions stay global, and conflicting agents are still rejected by the canonical resolver.Production LOC +9/-18 (net -9); tests +48/-6; docs +2/-1. No new config, dependency, API, protocol, or persistence surface.
Evidence
node scripts/run-vitest.mjs src/commands/sandbox-explain.test.tsfailed the 4 new regression cases (14 passed).node scripts/run-vitest.mjs src/commands/sandbox-explain.test.ts src/agents/sandbox-explain.test.tspassed 23 of 23, exercising the real resolver against a temporary session store.git diff --checkpassed.Related: #51245