Repository navigation
feat(cli): add sessions tail progress view - #83956
Conversation
|
Codex review: needs maintainer review before merge. Reviewed May 30, 2026, 4:24 PM ET / 20:24 UTC. Summary PR surface: Source +572, Tests +347, Docs +14. Total +933 across 7 files. Reproducibility: not applicable. this is an additive feature PR rather than a broken existing behavior report. Current main lacks the command, and the PR body includes source-entry CLI output showing the new behavior. Review metrics: 1 noteworthy metric.
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 this after maintainers accept the public command name and redaction policy, keeping the linked feature issue open until the PR merges. Do we have a high-confidence way to reproduce the issue? Not applicable; this is an additive feature PR rather than a broken existing behavior report. Current main lacks the command, and the PR body includes source-entry CLI output showing the new behavior. Is this the best way to solve the issue? Yes, if maintainers accept the command shape: the implementation reuses session-store targeting and extracted pointer-aware trajectory resolution instead of duplicating export behavior. The unresolved part is product/API naming, not a concrete code defect. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 3fc0df953cf1. Label changesLabel justifications:
Evidence reviewedPR surface: Source +572, Tests +347, Docs +14. Total +933 across 7 files. View PR surface stats
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
|
|
Updated this draft with:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Updated the draft again for the follow-mode handoff finding:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review The current head is |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
52211b0 to
2dd6bdf
Compare
|
Maintainer verification for head 2dd6bdf. Behavior addressed: Real environment tested: local macOS source checkout on this PR branch, using the real CLI entrypoint with a temporary session store and trajectory file. Exact steps or command run after this patch: node scripts/run-vitest.mjs run --config test/vitest/vitest.commands.config.ts src/commands/sessions-tail.test.ts
node scripts/run-vitest.mjs run --config test/vitest/vitest.cli.config.ts src/cli/program/register.status-health-sessions.test.ts
node scripts/run-vitest.mjs run --config test/vitest/vitest.unit-fast.config.ts src/trajectory/export.test.ts
./node_modules/.bin/oxfmt --check --threads=1 src/commands/sessions-tail.ts src/commands/sessions-tail.test.ts src/cli/program/register.status-health-sessions.ts src/cli/program/register.status-health-sessions.test.ts src/trajectory/export.ts src/trajectory/runtime-file.ts
pnpm docs:list
git diff --check
OPENCLAW_TSGO_HEAVY_CHECK_LOCK_HELD=1 node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo
OPENCLAW_TSGO_HEAVY_CHECK_LOCK_HELD=1 node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo
.agents/skills/autoreview/scripts/autoreview --mode local --prompt 'Review the sessions tail follow fix. Focus on cursor correctness for rewritten bounded trajectory files, duplicate/missed events, redaction, and docs accuracy.'Evidence after fix: focused tests passed ( Observed result after fix: follow mode printed the event from the replaced trajectory window and did not print the secret-bearing tool result body ( What was not tested: a real long-running chat transport session on Telegram/Discord/Slack; the live proof used the same CLI entrypoint and persisted session/trajectory file shape with a temporary local store. |
Summary
MVP for #83441.
This adds a human-readable trajectory progress tail under:
The command renders session trajectory JSONL events into compact operator-facing lines instead of requiring users to find the latest
*.trajectory.jsonlfile and hand-writejq.Follow-ups after ClawSweeper review:
--session-keyvalues now resolve the target agent store, so non-default-agent sessions can be tailed without also passing--agentor--all-agents--followcarries the initial trajectory read offset forward, so events appended during the initial render-to-follow handoff are not droppedsessions tailnow resolves runtime trajectory files through the same pointer-aware trajectory resolver used by export, so sessions withOPENCLAW_TRAJECTORY_DIRrelocated runtime files can be tailed from their session-adjacent pointerScope
openclaw sessions tail--session-key,--tail,--follow,--store,--agent, and--all-agentsMaintainer Decision Point
This PR is ready for maintainer review, with one intentional product/API decision point: whether the public command shape should be
openclaw sessions tailor another surface such asopenclaw logs --source sessions --follow.I used
sessions tailbecause this renders session trajectory activity rather than gateway/process logs. If maintainers prefer a different command shape, I can adapt this branch.Real Behavior Proof
Behavior or issue addressed:
openclaw sessions tailshould render live human-readable trajectory progress, follow appended trajectory events, redact tool arguments/results, resolve a fully qualified non-default-agent--session-keywithout requiring--agent, avoid dropping events appended while follow mode starts, and honor existing relocated trajectory pointer files.Real environment tested: local macOS source checkout of this PR branch using Node.js v24.13.1,
node --import tsx src/entry.ts, and temporaryOPENCLAW_STATE_DIRdirectories containing real OpenClaw session-store and*.trajectory.jsonlfiles for a non-defaultopsagent.Exact steps or command run after this patch:
OPENCLAW_STATE_DIR=/tmp/openclaw-sessions-tail-follow-proof-*/state \ node --import tsx src/entry.ts sessions tail \ --session-key agent:ops:telegram:direct:redacted-user \ --tail 1 --followI also ran the non-follow tail path:
OPENCLAW_STATE_DIR=/tmp/openclaw-sessions-tail-proof.zBZU2c/state \ node --import tsx src/entry.ts sessions tail \ --session-key agent:ops:telegram:direct:redacted-user \ --tail 4Evidence after fix: copied terminal output from the after-fix source-checkout CLI run. The temporary trajectory fixture included
SECRET_SHOULD_NOT_PRINTin a tool result body; the rendered output below did not expose it.Non-follow copied terminal output:
Observed result after fix: the command found the
opsagent session from the explicit fully qualified session key, printed compact session progress lines, followed an appended trajectory event, rendered tool call/result/model status previews, and kept the secret tool result body out of the output. Focused regression coverage also verifies the follow handoff case and anOPENCLAW_TRAJECTORY_DIR-style relocated runtime trajectory pointer.What was not tested: full GitHub CI for the latest pushed head is left to the repository workflow. The local run covered focused command tests, trajectory export regression tests, formatting, diff check, full lint, and core/core-test typecheck.
Before evidence: before the follow-up fixes, source inspection showed
sessions tailresolved stores before deriving any agent from--session-key, follow mode initialized offsets from current file size after initial rendering, and tailing computed only the direct trajectory path without checking the session-adjacent trajectory pointer.Verification
OPENCLAW_TEST_WORKERS=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.commands.config.ts src/commands/sessions-tail.test.ts(5 tests passed)OPENCLAW_TEST_WORKERS=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.cli.config.ts src/cli/program/register.status-health-sessions.test.ts(25 tests passed)OPENCLAW_TEST_WORKERS=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.unit-fast.config.ts src/trajectory/export.test.ts(17 tests passed)./node_modules/.bin/oxfmt --check --threads=1 src/cli/program/register.status-health-sessions.ts src/cli/program/register.status-health-sessions.test.ts src/commands/sessions-tail.ts src/commands/sessions-tail.test.ts src/trajectory/export.ts src/trajectory/runtime-file.tsOPENCLAW_OXLINT_SKIP_LOCK=1 node scripts/run-oxlint-shards.mjs --threads=8OPENCLAW_TSGO_HEAVY_CHECK_LOCK_HELD=1 node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfoOPENCLAW_TSGO_HEAVY_CHECK_LOCK_HELD=1 node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfogit diff --checkRisk
Low-to-medium. The change is additive CLI surface over existing trajectory/session files. The main open question is naming and redaction policy, not runtime behavior.