Skip to content

[codex] Add incremental chat completion traces#708

Merged
jahooma merged 4 commits into
mainfrom
jahooma/incremental-agent-traces
May 20, 2026
Merged

[codex] Add incremental chat completion traces#708
jahooma merged 4 commits into
mainfrom
jahooma/incremental-agent-traces

Conversation

@brandonkachen
Copy link
Copy Markdown
Collaborator

Summary

Adds a new chat_completion_traces BigQuery table for efficient coding-agent trace storage from the chat completions endpoint. The endpoint now records a trace row before provider dispatch, storing only appended message deltas after the first snapshot for a trace lineage.

Details

  • Adds a non-optional trace_session_id to new client run state and chat completion trace rows.
  • Skips writing the new table for old clients that do not send trace_session_id.
  • Uses trace_session_id for root-agent conversation lineage and run_id for child-agent lineage isolation.
  • Keeps only message hashes in a bounded server-side cache and advances the cache only after a successful BigQuery insert.
  • Adds Jest-compatible trace tests and mocks env-validating modules so the web package test runner can load them.

Validation

  • bun run --cwd web test --runTestsByPath src/llm-api/__tests__/chat-completion-trace.test.ts
  • bun test web/src/app/api/v1/chat/completions/__tests__/completions.test.ts
  • bun run --cwd web typecheck
  • bun run --cwd common typecheck
  • bun run --cwd packages/bigquery typecheck
  • bun run --cwd sdk typecheck
  • bun run --cwd cli typecheck

@jahooma jahooma marked this pull request as ready for review May 20, 2026 02:04
@jahooma jahooma merged commit dae2e48 into main May 20, 2026
35 checks passed
@jahooma jahooma deleted the jahooma/incremental-agent-traces branch May 20, 2026 02:44
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.

2 participants