Skip to content

prime traces scaffold - #814

Open
kcoopermiller wants to merge 15 commits into
mainfrom
feature/traces
Open

prime traces scaffold#814
kcoopermiller wants to merge 15 commits into
mainfrom
feature/traces

Conversation

@kcoopermiller

@kcoopermiller kcoopermiller commented Jul 30, 2026

Copy link
Copy Markdown
Member

New packages/prime-traces SDK for the Prime Traces service

Scoped to v0 contract:

  • Content-addressed upload: deterministic JSONL batching, Idempotency-Key: sha256:<digest> over exact uncompressed bytes, 256 MiB request / 64 MiB line limits enforced client-side, gzip transport, episode line format via X-Prime-Line-Format.
  • Retry semantics: durable 400 rejections stop the upload with a typed ErrorCode; 429/503 retry the same bytes honoring Retry-After. Rerunning an interrupted upload replays committed receipts without re-storing.
  • Provisional reads: 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-Key over uncompressed bytes, client-side 256 MiB / 64 MiB limits, optional gzip transport, and LineFormat.EPISODE via X-Prime-Line-Format. TracesClient retries 429/502/503/504 and transport errors on the same bytes (honoring Retry-After); 400/409 fail fast with typed ErrorCode exceptions.

Read/delete (provisional): Cursor-paginated list/iter, summary get, streamed get_raw/download_raw (.partial safe writes), and trace/run deletes—response shapes are documented as tentative until the service pins models.

Repo wiring: Root pyproject.toml / uv.lock register the workspace package; CI adds a hermetic test-traces matrix job and tightens the version-bump guard to modified-only files plus prime-traces’s __init__.py so initial 0.0.1 in 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.

@kcoopermiller kcoopermiller changed the title prime traces prime traces scaffold Jul 30, 2026
Comment thread packages/prime-traces/src/prime_traces/core/client.py
Comment thread packages/prime-traces/src/prime_traces/traces.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread packages/prime-traces/src/prime_traces/core/config.py
Comment thread packages/prime/src/prime_cli/commands/traces.py Outdated
@kcoopermiller
kcoopermiller marked this pull request as draft July 30, 2026 19:56
@kcoopermiller
kcoopermiller marked this pull request as ready for review August 2, 2026 20:20

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +43 to +47
try:
return max(0.0, float(value))
except ValueError:
# HTTP-date form; callers fall back to their own backoff.
return None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1118fee. Configure here.

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