[codex] feat(sessions): add read-only diagnose command#94192
Conversation
232c2f7 to
a5687a8
Compare
|
Codex review: needs maintainer review before merge. Reviewed June 17, 2026, 6:23 PM ET / 22:23 UTC. Summary PR surface: Source +1520, Tests +840, Docs +491, Other +96. Total +2947 across 28 files. Reproducibility: not applicable. as a bug reproduction; current main source confirms the command/RPC is absent, and the PR body supplies live after-fix output from an isolated Gateway. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the additive read-only diagnose surface if maintainers accept the command/RPC contract; otherwise narrow or defer it to the existing stuck-session diagnostics and recovery work. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction; current main source confirms the command/RPC is absent, and the PR body supplies live after-fix output from an isolated Gateway. Is this the best way to solve the issue? Yes, subject to maintainer API acceptance; using the Gateway method as the canonical source and the CLI as a renderer is better than duplicating local store/runtime inspection in the CLI. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 591313e80a5e. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +1520, Tests +840, Docs +491, Other +96. Total +2947 across 28 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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
|
Summary
sessions.diagnoseGateway RPC withoperator.readscope.openclaw sessions diagnosefor operator triage of active, queued, stalled, done, unresolved, or unknown session state.CHANGELOG.mdedits.Linked context
Closes #94175
Related #86159, #88870, #77542
Was this requested by a maintainer or owner?
No. This follows the feature-request issue opened before the PR, per contributor guidance.
Real behavior proof (required for external PRs)
v24.14.0, isolated tempOPENCLAW_HOME/OPENCLAW_STATE_DIR, foreground Gateway on loopback port41234, token auth enabled.pnpm openclaw gateway run --dev --reset --port 41234 --auth token --token <redacted> --bind loopback --allow-unconfigured --ws-log compact; ranpnpm openclaw sessions diagnose --json --tail 1 --timeout 10000; added one minimal stored session in the isolated state (sessionId=sess-proof,label=proof-triage, one transcript line containing fake private text); then ranpnpm openclaw sessions diagnose --session-key agent:main:main --json --tail 1 --timeout 10000.sessionFilepath or the fake private transcript text.openclaw sessions diagnosewas not a registered CLI subcommand andsessions.diagnosewas not advertised by the Gateway method list.Tests and validation
Commands run:
pnpm installpnpm protocol:gen && pnpm protocol:gen:swiftpnpm exec oxfmt --write <touched source/docs/test files>pnpm docs:listPATH=<bundled-node-bin>:$PATH OPENCLAW_VITEST_MAX_WORKERS=1 pnpm test packages/gateway-protocol/src/index.test.ts src/gateway/method-scopes.test.ts src/gateway/server-methods-list.test.ts src/gateway/server-methods/session-active-runs.test.ts src/agents/embedded-agent-runner/run-state.test.ts src/gateway/server-methods/sessions.diagnose.test.ts src/commands/sessions-diagnose.test.ts src/cli/program/register.status-health-sessions.test.ts src/cli/program/routes.test.ts -- --reporter=verbosePATH=<bundled-node-bin>:$PATH pnpm tsgo:corePATH=<bundled-node-bin>:$PATH pnpm tsgo:core:testPATH=<bundled-node-bin>:$PATH pnpm check:import-cyclesPATH=<bundled-node-bin>:$PATH pnpm buildgit diff --checkRegression coverage added or updated:
SessionsDiagnoseParamsandSessionsDiagnoseResult, including boundedtail, rejected stale params, closed enum values, and path-bearing field rejection.What failed before this fix, if known?
pnpm exec vitest run ...attempt was killed by local memory pressure (exit 137). The same focused set passed through the repopnpm testwrapper withOPENCLAW_VITEST_MAX_WORKERS=1, then passed again under Node 24.If no test was added, why not?
Not applicable.
Risk checklist
Did user-visible behavior change? (
Yes/No)Yes. Adds a new CLI subcommand and read-only Gateway RPC.
Did config, environment, or migration behavior change? (
Yes/No)No.
Did security, auth, secrets, network, or tool execution behavior change? (
Yes/No)No. The RPC is
operator.readand does not execute tools, mutate state, expose transcript content, or expose local transcript paths.What is the highest-risk area?
The new diagnostic projection could accidentally over-report sensitive/session-local detail or overstate confidence about stuck-session state.
How is that risk mitigated?
The result schema is bounded, uses stable finding codes, avoids transcript content and local path fields, rejects ambiguous selectors, keeps diagnosis read-only, and includes tests that assert local paths/private transcript text do not appear in output.
Current review state
What is the next action?
Ready for maintainer review and CI on this draft PR.
What is still waiting on author, maintainer, CI, or external proof?
CI and maintainer review. The PR already includes local targeted tests, typechecks, import-cycle check, build, docs sanity, generated protocol output, and live Gateway proof.
Which bot or reviewer comments were addressed?
None yet.
AI-assisted disclosure:
This PR is AI-assisted with Codex. I understand the intended behavior and the change is scoped to a read-only operator diagnostic surface.
Local Codex review state:
codex review --base origin/mainwas attempted before opening the PR, but the local review process hung after starting a deep diff read and had to be stopped. The successful validation commands and live proof above are the current review evidence.