feat(sessions): add read-only diagnose command#96113
Conversation
|
@clawsweeper review Initial review request for replacement PR #96113. #94192 was closed after the fork branch disappeared; this PR supersedes it, keeps maintainer edits enabled, and CI is clean on 1a7f882. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Status for reviewer:
Remaining decision: maintainer acceptance of the additive public |
|
@clawsweeper review |
|
Codex review: needs maintainer review before merge. Reviewed July 25, 2026, 6:21 PM ET / 22:21 UTC. ClawSweeper reviewWhat this changesThis PR adds a read-only Merge readinessKeep open for maintainer product/API review. Current Priority: P2 Review scores
Verification
How this fits togetherThe session subsystem persists conversation metadata while the Gateway and embedded-agent runner track live work. The proposed diagnosis layer reads those sources, produces a privacy-bounded result through the Gateway protocol, and renders it in the CLI and native client models. flowchart LR
A[Session stores] --> D[Session diagnosis]
B[Gateway active runs] --> D
C[Embedded-run state] --> D
D --> E[Read-only Gateway RPC]
E --> F[CLI diagnosis]
E --> G[Native protocol clients]
Decision needed
Why: The implementation is additive and evidence-backed, but it creates a durable cross-client Gateway and CLI contract rather than repairing an established broken behavior. Before merge
Agent review detailsSecurityNone. PR surfaceSource +2748, Tests +2513, Docs +92, Generated 0, Other +97. Total +5450 across 49 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Have a session/Gateway owner explicitly sponsor or narrow the stable Do we have a high-confidence way to reproduce the issue? Not applicable: this PR adds a new diagnostic capability rather than repairing an already-defined failed behavior. The contributor did provide high-confidence live after-fix Gateway evidence for the proposed command. Is this the best way to solve the issue? Unclear until a maintainer accepts the public contract. Current main does not provide an equivalent single typed session-diagnosis path, and this core implementation is plausible because it reads core-private session and runtime state, but the stable API shape is a product decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4cdd9b8d8563. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
1a7f882 to
98c0c6e
Compare
|
@clawsweeper re-review Fixed the inherited parent-option finding on the current head. What changed:
Proof run after the patch:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Maintainer decision requested on the remaining API/product question. ClawSweeper has no contributor-facing blocker left on the current head
My recommendation is to accept the contract as the durable read-only operator diagnosis surface. If maintainers want a narrower public vocabulary before merge, I can trim that now; otherwise this should be ready for normal maintainer review/merge gates. |
|
@clawsweeper re-review Fixed the failed Cause: Fix: added Local verification:
Fresh GitHub checks are now rerunning on this head. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
463fcfc to
6ab3f83
Compare
|
@clawsweeper re-review Rebased the CI-fix commit onto latest The previous failed lane is fixed on this head:
Verification on the rebased head:
Fresh GitHub check rollup currently has no failed or pending checks. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Closes #94175
Supersedes #94192 (closed after the fork branch disappeared, not because the change was rejected).
Related: #86159, #88870, #77542
What Problem This Solves
OpenClaw operators currently have to piece together
sessions,sessions tail, health output, logs, and Gateway state when a session looks stuck, silent, queued, terminal, or missing transcript evidence. That makes incident triage slow and risky, especially before using recovery actions that could disturb active work.Why This Change Was Made
This adds an additive, read-only
sessions.diagnoseGateway RPC withoperator.readscope and a matchingopenclaw sessions diagnoseCLI command. The diagnosis combines stored session state, visible Gateway runs, embedded-run state, diagnostic activity, command-lane state, bounded transcript metadata, and generic delivery metadata into stable finding codes.The scope is intentionally conservative: no recovery, aborts, lane release, config/env changes, provider/channel connectivity checks, or changelog edit. The command rejects ambiguous selectors and avoids raw transcript content, secrets, and local transcript paths.
User Impact
Users and operators can run one command to understand whether a session is active, queued, stale, terminal, missing transcript evidence, unresolved, or simply not found before taking any recovery action. Bug reports can also include structured diagnosis output instead of scattered logs.
Evidence
Duplicate check:
ready for maintainer lookand requested maintainer API/product review, not code changes.gh pr list --repo openclaw/openclaw --state open --author zaidazmireturned no open replacement PRs.gh search prs --repo openclaw/openclaw --match title,body --limit 20 -- "\"sessions.diagnose\" OR \"sessions diagnose\""returned no open replacement PRs.Focused validation run on the rebased branch:
Other local gates:
Results:
git diff --check origin/main: passed.oxfmt --check: passed.corepack pnpm protocol:check: passed.corepack pnpm check:docs: passed, including MDX and internal link audit (checked_internal_links=5464,broken_links=0).Live behavior proof from an isolated local Gateway:
The stored-session proof used one synthetic session row and one fake transcript line in isolated temp state. The diagnosis output did not include the local transcript file path or the fake private transcript text.