Skip to content

Feature: run timeline, token telemetry, and JSON export#106

Merged
slashdevcorpse merged 2 commits into
mainfrom
feature/run-timeline-telemetry
May 31, 2026
Merged

Feature: run timeline, token telemetry, and JSON export#106
slashdevcorpse merged 2 commits into
mainfrom
feature/run-timeline-telemetry

Conversation

@slashdevcorpse
Copy link
Copy Markdown
Owner

@slashdevcorpse slashdevcorpse commented May 31, 2026

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.

Written for commit 6de50d4. Summary will update on new commits.

Review in cubic

Copilot AI review requested due to automatic review settings May 31, 2026 10:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds run timeline tracking, token/context metric capture, and JSON export support for Codex CLI runs, surfacing the new data in the task queue UI and exposing it through a new API route.

Changes:

  • Adds normalized timeline event and token metric storage to task records.
  • Adds a /api/run-events endpoint for per-run JSON export with path redaction.
  • Adds task queue UI timeline display, token metric summary, and JSON download action.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
apps/codex-claw/src/server/codex-cli.ts Persists run timeline events, captures token metrics, and builds redacted run event logs.
apps/codex-claw/src/server/codex-cli.test.ts Adds coverage for redacted run timeline export and token metric output.
apps/codex-claw/src/screens/chat/types.ts Adds public timeline and token metric TypeScript types.
apps/codex-claw/src/screens/chat/components/task-queue-panel.tsx Displays timeline events, metric summaries, and JSON export action in the task queue panel.
apps/codex-claw/src/routes/api/run-events.ts Adds API/download route for run event logs.
apps/codex-claw/src/routeTree.gen.ts Registers the new generated run-events route.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

finishedAt: task.finishedAt,
durationMs: task.durationMs,
exitCode: task.exitCode,
tokenMetrics: task.tokenMetrics ?? null,
typeof metrics.totalTokens === 'number' ||
typeof metrics.contextTokens === 'number'
if (!hasMetrics) return undefined
metrics.raw = record
@slashdevcorpse slashdevcorpse merged commit 7aafad9 into main May 31, 2026
6 checks passed
@slashdevcorpse slashdevcorpse deleted the feature/run-timeline-telemetry branch May 31, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: run timeline, token/context telemetry, and JSON event export

2 participants