Skip to content

perf: start commands without waiting for telemetry uploads - #1931

Merged
steipete merged 3 commits into
mainfrom
codex/run-telemetry-startup
Sep 6, 2026
Merged

perf: start commands without waiting for telemetry uploads#1931
steipete merged 3 commits into
mainfrom
codex/run-telemetry-startup

Conversation

@steipete

@steipete steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Commands synchronously waited for the first best-effort telemetry upload after capturing their resource baseline. A slow telemetry endpoint could therefore delay workload admission even though an upload failure did not prevent execution.

Keep baseline capture before work, but publish it through the existing sampler. Start the 15-second ticker before publication, derive each upload's timeout from the sampler context, and cancel and fully join the sampler before finish, failure, or lease replacement. This also removes the one-second wait that could let an upload outlive its owner. Terminal event handling, baseline retention, and signed receipt verification remain with their existing owners.

Validation

  • The blocked-upload admission regression fails on the original code and passes after the repair. Virtual-time coverage also proves the first periodic sample remains at 15 seconds after a slow initial upload.
  • Race-tested owner coverage verifies cancellation while the transport still owns work, joins before finish/failure/replacement, duplicate starts, the retained terminal baseline, exact signed receipt commit/verification, and isolation of the next run's samples.
  • go vet ./..., baseline/candidate builds with Go 1.26.5, and independent P0–P2 review pass.
  • A real AWS comparison used one fixed c7a.8xlarge lease in eu-west-1, the same working directory/configuration and identical harmless no-sync commands. Both normal commands completed, both signed receipts verified, and both stored run summaries retained Linux baseline samples (32 CPUs; two samples each). Canonical Stop confirmed released/cleanup-complete; all command processes joined, SSH control sockets were absent, and operator configuration was unchanged.
  • Observed command-preparation phase: 5.366s → 4.766s; runner total: 17.172s → 16.344s; process wall time: 18.323s → 18.158s. This single pair is noisy and is not a general speed benchmark. The controlled blocked-upload regression proves removal of the admission dependency.

Live source provenance: baseline 4e3df6dfc42a49bd665a92b2e2756b909122c8c3, candidate with telemetry patch SHA-256 7df3fbc3976486164ab4f4e1f038626519322b023ab8d00ef077dddabc0c2633. Both were task-built development binaries, not signed releases. The later fixture-only commit does not alter production bytes.

CI follow-through

The local full race run first used Go's default ten-minute package budget; the rerun used the repository's prescribed go test -race -timeout=20m ./.... Both exceeded the aggregate CLI-package budget while progressing through other fixtures. Those local failures are retained. Linux CI subsequently passed on d568627e629edd2f971f62394efc95ddd5ee6114, including the full Go test step. Final head d7396168246ccc3c9ad712fae3beaca0d2704c8a adds only the changelog PR reference. Its exact-head CI also passed without retries: all 11 jobs succeeded, including the full Go race step in 19m15s. The final independent bot review reports no remaining findings.

The full run also exposed an unchanged OpenSandbox test race, reproduced on the clean baseline: its 20ms deadline could expire before sandbox creation, making its expected rollback deletion invalid. The fixture now cancels only after successful fake creation. It retains the real held lock, exact one-delete assertion, and no-published-claim assertion; existing coverage still tests timed lock cancellation. Its exact regression, full OpenSandbox race package, and independent P2 review pass. Provider production code is unchanged.

Production delta: 9 added / 9 removed (net zero). Docs and the Unreleased changelog describe the behavior. The existing telemetry API and stored representation are unchanged; no migration or configuration option is introduced.

@steipete steipete self-assigned this Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 6:45 PM ET / 22:45 UTC.

ClawSweeper review

What this changes

The PR moves initial telemetry uploads into the background sampler, joins cancelled sampling before completion or lease replacement, documents that lifecycle, and stabilizes an OpenSandbox cancellation test.

Merge readiness

Ready for maintainer review

This remains a useful, focused improvement: captured main and v0.50.0 still block on initial telemetry publication. No actionable correctness or security defect remains, and the landing disposition resolves the earlier changelog concern.

Priority: P2
Reviewed head: d7396168246ccc3c9ad712fae3beaca0d2704c8a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused lifecycle repair with relevant real-run observations, targeted regression coverage, and no remaining actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured AWS before/after run report exercises the recorder through real no-sync commands and observes retained Linux baselines, verified receipts, and cleanup with the telemetry patch. Its timing pair is supporting live evidence; inspected fault tests separately establish admission independence and joining.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured AWS before/after run report exercises the recorder through real no-sync commands and observes retained Linux baselines, verified receipts, and cleanup with the telemetry patch. Its timing pair is supporting live evidence; inspected fault tests separately establish admission independence and joining.
Evidence reviewed 9 items Repository policy: Read the complete root policy and applied its provider-neutral architecture, regression coverage, and maintainer landing changelog guidance. No applicable nested policy or maintainer-notes directory was found.
Verified introduced production change: The merge-base-to-head diff moves publication into the existing sampler, propagates cancellation into uploads, and replaces the timed shutdown wait with a join. The host-verified test merge retains base-only provider changes.
Still necessary on main: Captured main still calls appendTelemetryBestEffort synchronously from baseline capture, before either command-admission call site proceeds.
Findings None None.
Security None None.

How this fits together

Crabbox’s run recorder collects resource samples from remote Linux runners and sends them to the coordinator. It preserves those samples in run summaries alongside command results and verified terminal receipts.

flowchart LR
  A[Remote Linux runner] --> B[Capture baseline]
  B --> C[Admit command]
  B --> D[Background sampler]
  D --> E[Coordinator telemetry]
  C --> F[Finish or replace lease]
  F --> G[Cancel and join sampler]
  G --> H[Finalize summary and receipt]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta Production +9/-9; tests +208/-3 The lifecycle repair has no net production growth and adds focused admission, cancellation, and rollback coverage.

Technical review

Best possible solution:

Keep best-effort telemetry off command admission while retaining one cancellable sampler owner, baseline summaries, and existing receipt verification.

Do we have a high-confidence way to reproduce the issue?

Yes: current-main baseline capture synchronously awaits the telemetry POST before command admission, so a slow endpoint delays execution; the supplied regression targets that exact dependency. This review did not execute tests.

Is this the best way to solve the issue?

Yes: using the existing sampler is a narrow repair that preserves baseline capture, cancellation ownership, API shape, configuration, and stored summaries.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 69e79538dae2.

Labels

Label justifications:

  • P2: Removes avoidable command-start latency and tightens telemetry cleanup without an established urgent outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured AWS before/after run report exercises the recorder through real no-sync commands and observes retained Linux baselines, verified receipts, and cleanup with the telemetry patch. Its timing pair is supporting live evidence; inspected fault tests separately establish admission independence and joining.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured AWS before/after run report exercises the recorder through real no-sync commands and observes retained Linux baselines, verified receipts, and cleanup with the telemetry patch. Its timing pair is supporting live evidence; inspected fault tests separately establish admission independence and joining.

Evidence

What I checked:

  • Repository policy: Read the complete root policy and applied its provider-neutral architecture, regression coverage, and maintainer landing changelog guidance. No applicable nested policy or maintainer-notes directory was found. (AGENTS.md:1, d7396168246c)
  • Verified introduced production change: The merge-base-to-head diff moves publication into the existing sampler, propagates cancellation into uploads, and replaces the timed shutdown wait with a join. The host-verified test merge retains base-only provider changes. (internal/cli/run_recorder.go:153, d7396168246c)
  • Still necessary on main: Captured main still calls appendTelemetryBestEffort synchronously from baseline capture, before either command-admission call site proceeds. (internal/cli/run_recorder.go:159, 69e79538dae2)
  • Latest release comparison: The v0.50.0 source also contains synchronous initial telemetry publication; the proposed improvement is not already present in that release. (internal/cli/run_recorder.go:159, 215115a45086)
  • Lifecycle and transport inspection: Finish joins before forming the summary; replacement joins before changing coordinator state. Uploads use context-bound HTTP requests, cancellation-aware token commands, and no curl fallback for POST bodies. Authorization, destination checks, and stored formats are unchanged. (internal/cli/run_recorder.go:215, d7396168246c)
  • Focused regression coverage: Inspected blocked-upload admission, 15-second cadence, duplicate-start, finish/failure/replacement joining, baseline retention, and receipt assertions. The OpenSandbox fixture cancels after creation while retaining rollback and unpublished-claim assertions. Tests were inspected, not executed in this read-only review. (internal/cli/run_recorder_test.go:84, d7396168246c)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-06T22:16:24.331Z sha d568627 :: needs changes before merge. :: [P3] Leave the changelog entry to maintainer landing
  • reviewed 2026-09-06T22:29:56.848Z sha d739616 :: needs maintainer review before merge. :: none

@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer landing disposition: this PR and its Unreleased note are maintainer-authored landing work. The contributor-only changelog restriction does not apply; retaining the entry fulfills the repository's requirement to maintain release notes as work lands. The entry now includes the full PR link.

The latest commit only finalizes that changelog reference. Production and test bytes remain those already reviewed and live-tested. The runtime review has no remaining correctness findings; the final exact-head Linux CI gate is running.

@steipete
steipete merged commit 8dcdbd1 into main Sep 6, 2026
27 checks passed
@steipete
steipete deleted the codex/run-telemetry-startup branch September 6, 2026 22:53
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Landed as 8dcdbd1 after exact-head Linux CI passed all 11 jobs, including the full Go race test step. The fresh final review has no remaining findings.

The real AWS pair verified command completion, retained Linux telemetry baselines, signed receipts, and canonical provider cleanup. The controlled blocked-upload and lifecycle tests prove admission independence and cancellation/join behavior; the one timing pair remains a limited observation rather than a general performance benchmark. The landing checkout is clean on main, and its production recorder and regression-test bytes match the reviewed source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant