prime traces scaffold - #814
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e979113959
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 95e0502e47
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| try: | ||
| return max(0.0, float(value)) | ||
| except ValueError: | ||
| # HTTP-date form; callers fall back to their own backoff. | ||
| return None |
There was a problem hiding this comment.
Honor HTTP-date Retry-After values
When a 429/503 response supplies the valid HTTP-date form of Retry-After (which gateways may also emit), _parse_retry_after discards it and _send_with_retry substitutes a potentially much shorter randomized backoff. This can retry before the server-requested time and worsen throttling; parse the date and return the remaining nonnegative delay instead.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1118fee. Configure here.
| def _url(self, endpoint: str) -> str: | ||
| if not endpoint.startswith("/"): | ||
| endpoint = f"/{endpoint}" | ||
| return f"{self.base_url}/api/v1{endpoint}" |
There was a problem hiding this comment.
Base URL double API prefix
Medium Severity
Explicit base_url values are only right-stripped, while Config.traces_url also removes a trailing /api/v1. _url always appends /api/v1, so a constructor URL that already includes that suffix (common in env and config values) becomes /api/v1/api/v1/... and every request misses the service.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 1118fee. Configure here.


New
packages/prime-tracesSDK for the Prime Traces serviceScoped to v0 contract:
Idempotency-Key: sha256:<digest>over exact uncompressed bytes, 256 MiB request / 64 MiB line limits enforced client-side, gzip transport, episode line format viaX-Prime-Line-Format.ErrorCode; 429/503 retry the same bytes honoringRetry-After. Rerunning an interrupted upload replays committed receipts without re-storing.list/get/?raw=true/delete— platform#3833 defines these routes but no response models yet, so the envelopes here are a proposal to align on (flagged in code and README).Note
Low Risk
New isolated library and CI job with mock-based tests; no changes to auth, billing, or existing packages beyond workspace metadata and version-bump logic.
Overview
Introduces
packages/prime-traces, a new Python SDK for uploading and querying traces against the Prime Traces service.Upload path: Deterministic JSONL batching with SHA-256
Idempotency-Keyover uncompressed bytes, client-side 256 MiB / 64 MiB limits, optional gzip transport, andLineFormat.EPISODEviaX-Prime-Line-Format.TracesClientretries 429/502/503/504 and transport errors on the same bytes (honoringRetry-After); 400/409 fail fast with typedErrorCodeexceptions.Read/delete (provisional): Cursor-paginated
list/iter, summaryget, streamedget_raw/download_raw(.partialsafe writes), and trace/run deletes—response shapes are documented as tentative until the service pins models.Repo wiring: Root
pyproject.toml/uv.lockregister the workspace package; CI adds a hermetictest-tracesmatrix job and tightens the version-bump guard to modified-only files plusprime-traces’s__init__.pyso initial0.0.1in a new package does not block merges.Reviewed by Cursor Bugbot for commit 1118fee. Bugbot is set up for automated code reviews on this repo. Configure here.