Skip to content

fix(logging): restore session traces and accurate usage delivery - #616

Merged
Aayam Bansal (aayambansal) merged 2 commits into
mainfrom
codex/fix-usage-logging
Sep 16, 2026
Merged

Aayam Bansal (aayambansal) merged 2 commits into
mainfrom
codex/fix-usage-logging

Conversation

@aayambansal

@aayambansal Aayam Bansal (aayambansal) commented Sep 16, 2026

Copy link
Copy Markdown
Member

What does this PR do, and why?

The CLI no longer had a trace uploader, while the privacy page and landing FAQs described conflicting defaults. Restore authenticated session trace delivery and preserve provider-observed usage through a durable queue and verified server acknowledgements.

  • Share full session traces by default while signed in, including BYOK, subscription, and local model routes. Preserve saved account and legacy opt-outs; add a device switch and delivery status under Customize → General → Data & privacy.
  • Capture model context, exposed reasoning, responses, tool inputs/results, errors, and interrupted output. Redact known credentials before persistence; bound content and queue sizes and mark truncation.
  • Keep provider token counts and reported cost without inventing missing values or substituting catalog estimates. These raw response observations are separate from account usage charts and Wallet settlement; they are not an independent invoice audit.
  • Check account sharing preferences before each upload, bind records to their account, validate receipt IDs, and retain stable event IDs for retries. Isolate permanently rejected records so valid events can progress. Disabling sharing clears pending records, and re-enabling cannot revive an earlier in-flight request.
  • Update the privacy policy in ordinary prose, correct the FAQ/security documentation, add usage documentation and a changelog entry, and regenerate the settings SDK.

Linked issue

No linked issue.

How did you verify it?

On main f46e0646, the following passed:

Check Result
Backend session suite 730 passed
Backend server suite 220 passed, 2 skipped
Backend CLI suite 51 passed
Root backend tests selected by Fast CI 58 passed
Shared UI 342 passed
Workspace 1,020 passed
SDK 29 passed
Docs checks/tests 6 passed
Monorepo typecheck and formatting Passed
Workspace and landing/docs builds Passed
SDK generation and gitleaks Passed

The final logging-specific rerun passes all 29 tests. It exercises real SDK streaming, interrupted output, exact numeric values, redaction, bounded payloads, all supported routes, opt-outs, account changes, concurrent capture, malformed/partial/lost receipts, replay deduplication, and rejected-record isolation. Three rendered settings tests exercise a loopback HTTP fixture, including failed preference writes and resolved delivery errors.

An actual emitted batch was also submitted to the real Atlas ingest implementation using an isolated test database. It preserved the numeric usage/cost and trace content, and replay produced no duplicate events. No production traces were sent.

All GitHub checks passed on 5c7a4fd0: backend tests, frontend tests, typecheck, formatting, web build, gitleaks, compatibility, and the native Harbor trial.

Checklist

  • Format, typecheck, all affected backend suites, and frontend/UI/SDK/docs tests pass separately as listed above
  • The entire backend suite in one bun run check process was rerun after rebasing (validation used the affected suites)
  • bun run --cwd frontend/workspace build succeeds
  • ./tooling/repo/generate.ts was run and the SDK output is committed
  • CHANGELOG.md has an Unreleased entry
  • Matching documentation is updated
  • Screenshots or a short video are attached for UI changes (rendered behavior tests added)
  • No version bumps
  • Installer files are untouched

@vercel

vercel Bot commented Sep 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openscience Ready Ready Preview Sep 16, 2026 1:48pm UTC

Request Review

@aayambansal
Aayam Bansal (aayambansal) merged commit 4d831a0 into main Sep 16, 2026
10 checks passed
@aayambansal
Aayam Bansal (aayambansal) deleted the codex/fix-usage-logging branch September 16, 2026 13:50
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.

1 participant