Feature: run timeline, token telemetry, and JSON export

Merged
SL
5mo ago
+772-39

Summary

  • record normalized run timeline events for prompt queue/start, assistant deltas, tool calls/results, final messages, exits, and errors
  • capture Codex CLI token/context usage when JSON events expose it, while showing unavailable when no metrics are present
  • add a task queue timeline view with durations, command names, exit codes, final status, and per-run redacted JSON export

Files

  • apps/codex-claw/src/server/codex-cli.ts - run timeline persistence, token metric normalization, redacted event export
  • apps/codex-claw/src/routes/api/run-events.ts - JSON event log API/download route
  • apps/codex-claw/src/screens/chat/components/task-queue-panel.tsx - timeline UI, metric summary, export action
  • apps/codex-claw/src/screens/chat/types.ts - public timeline and metric types
  • apps/codex-claw/src/server/codex-cli.test.ts - redacted export and metric coverage

Testing

  • pnpm -C apps/codex-claw lint
  • pnpm -C apps/codex-claw test
  • pnpm -C apps/codex-claw build

Risk

  • Timeline persistence writes bounded event metadata during a run; event logs cap stored timeline length to avoid unbounded growth.
  • Token/context metrics are opportunistic and intentionally shown as unavailable when Codex CLI does not expose usage fields.

Closes #93


Summary by cubic

Adds run timeline tracking, token usage capture, and per-run JSON export to Codex Claw. Introduces a timeline panel in the task queue with relative timings, command names, exit codes, and final status. Closes #93.

  • New Features
    • Persist normalized run timeline events (prompt start, assistant deltas, tool calls/results, final message, exits, errors).
    • Show a “Run timeline” in the Task Queue panel with event count, relative times, status, and token metrics summary.
    • Capture token/context metrics when the Codex CLI emits usage; show “unavailable” when not present.
    • Add GET /api/run-events?id=:id&download=1 to view or download a redacted JSON log for a run.
    • Redact workspace/state paths in exports and cap stored timeline length to prevent growth.