Skip to content

feat(telemetry): trace exact publication handoffs - #858

Merged
brokemac79 merged 2 commits into
mainfrom
codex/csw-064-reservation-claim-telemetry
Jul 26, 2026
Merged

brokemac79 merged 2 commits into
mainfrom
codex/csw-064-reservation-claim-telemetry

Conversation

@brokemac79

@brokemac79 brokemac79 commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds reservation_claim_observability to exact-review queue stats, tracing a legacy publication batch from durable dispatcher reservation through claim, preparation, state-writer work, and final GitHub apply. The response now explicitly distinguishes that legacy state-repository batch timing from the Cloudflare-canonical direct-publication path introduced by #859/#866/#867.

Problem

Operators could not determine whether a legacy publication delay occurred before capacity, during dispatcher-to-runner handoff, on a runner, at the state writer, or at GitHub. The original surface also made it too easy to read those batch-only timings as applying to direct canonical publication.

Implementation

  • Adds additive SQLite telemetry for dispatcher reservation, batch claim, runner, preparation, state-writer, final GitHub apply, and GitHub-throttle timestamps and stable identifiers.
  • Exposes scrubbed queue slots, batch age, reservation-to-claim delay buckets, and distinct no-capacity, dispatcher/handoff, runner, state-writer, and GitHub-throttle alerts.
  • Labels every observed batch as legacy_state_repo_batch; publication_paths.cloudflare_canonical_direct is explicitly not_applicable for reservation-to-claim and state-writer timing, while a direct-publication fallback enters the legacy batch path.
  • Rejects partially supplied dispatch metadata so a claim cannot bypass the reservation/dispatch-ID correlation fence.
  • Never returns payloads, credentials, lease owners, or batch failure fingerprints from the observability response.

Compatibility

The current direct Cloudflare-canonical producer completes before a legacy publication batch is created. This PR does not change that producer, its bounded fallback, capacity, admission, retries, state-writer behavior, or GitHub writes. It only makes the two paths unambiguous to operators:

Path Reservation-to-claim / state-writer timing
cloudflare_canonical_direct not_applicable; canonical Durable Object publication bypasses the legacy batch.
legacy_state_repo_batch tracked; this is the existing batch/fallback path.

The extra response fields are additive. Existing metadata-free legacy workflow claims remain accepted; claims that opt into dispatch telemetry must supply both dispatch ID and UTC dispatch time.

Validation

  • pnpm run build:all
  • node --test test/exact-review-publication-batches.test.ts test/repair/exact-review-batch-coordinator.test.ts — 61 passing
  • node --test test/repair/exact-review-batch-workflow.test.ts with Git Bash on Windows — 10 passing, including workflow Bash syntax and the direct-publication/fallback source contract
  • git diff --check
  • pnpm run lint:dashboard and pnpm run lint:repair

The repository-wide formatter baseline still reports unrelated formatting differences; no formatter rewrite was made. actionlint is not installed on this runner.

Runtime and migration proof

The focused ExactReviewQueue Durable Object runtime test creates and completes one redacted batch trace with a fixed UTC clock. It proves the public stats response contains:

  • dispatch ID/time, workflow run ID/attempt/runner-start time;
  • preparation start/end, state-writer wait/commit, final GitHub-apply, and GitHub-throttle UTC times;
  • item/run/claim identifiers and both reservation-to-claim and enqueue-to-claim durations;
  • legacy_state_repo_batch for the batch, plus the explicit direct-versus-legacy path contract above.

It also verifies that the public response excludes worker-secret-not-public and a persisted failure-body-secret-not-public fixture. The same suite covers migration of a pre-deployment direct-publication plan to the canonical store and preservation of legacy queue receipts while adding batch tables.

This is local Durable Object/SQLite runtime proof, not a production dispatch. No live exact-review run, Action dispatch, or E2E activity was initiated because this task prohibits those operations. A redacted deployed dispatcher-to-stats capture remains the only unfulfilled ClawSweeper rank-up artifact.

Local Crabbox proof (not deployed)

On 2026-07-26, the PR head e8e526a1336057c6bff8217135ce9773917edf47 passed an isolated Docker-backed Crabbox run (provider=local-container, lease cbx_ae7f17d0f5c9, Playwright v1.60.0-noble). Wrangler/Miniflare hosted the worker and its Durable Object locally; the harness then signed an enqueue, claimed the resulting legacy batch, recorded each handoff stage, completed it, and fetched the public stats endpoint.

The captured, public-safe trace was:

publication paths:
  cloudflare_canonical_direct: reservation_to_claim=not_applicable, state_writer_timing=not_applicable
  legacy_state_repo_batch: reservation_to_claim=tracked, state_writer_timing=tracked
batch: csw-858-local-container-batch (legacy_state_repo_batch)
dispatch: publication-batch-dispatch:csw-858-local-container at 2026-07-26T11:46:43.790Z
workflow: run 92729, attempt 1, runner started 2026-07-26T11:46:44.790Z
enqueue: 2026-07-26T11:46:45.799Z; reservation-to-claim: 2026 ms; enqueue-to-claim: 17 ms
stages: preparation start/end 2026-07-26T11:46:45.826Z/2026-07-26T11:46:45.837Z;
        state-writer wait/commit 2026-07-26T11:46:45.846Z/2026-07-26T11:46:45.875Z;
        final-GitHub-apply/GitHub-throttle 2026-07-26T11:46:45.856Z/2026-07-26T11:46:45.864Z
public-redaction checks: lease owner absent; failure body absent

This verifies the local HTTP-to-worker-to-Durable-Object observability contract, including direct-versus-legacy classification and public redaction. The two final stage timestamps are local telemetry markers only: this run performed no Cloudflare deployment, GitHub Actions dispatch, or GitHub write. The latest ClawSweeper review accepts this as sufficient contributor runtime proof; a deployed dispatcher-to-stats capture is now a maintainer-controlled rollout decision and optional rank-up artifact, not a contributor-facing proof defect.

Supersession assessment

Current ClawSweeper disposition

The durable ClawSweeper review at 2026-07-26T12:28:51.002Z supersedes the prior 12:18 revision. It marks proof: sufficient and status: 👀 ready for maintainer look, while retaining P3 / gold shrimp: no code or security finding was identified; the local Crabbox trace is accepted as sufficient contributor runtime evidence; and this PR should remain open for maintainer review because it instruments a distinct retained fallback path rather than duplicating #859.

The remaining decisions are maintainer-owned rollout decisions, not a contributor-facing proof failure: whether to retain the persisted/public legacy-fallback observability contract; whether to require or waive one controlled, redacted deployed dispatcher-to-stats capture before merge; and acceptance of the additive Durable Object migration/public queue-stat compatibility contract. Any deployed evidence must redact endpoints, IP addresses, credentials, lease owners, and failure bodies.

#859 is a prerequisite, not a technical replacement for this PR. It merged the Cloudflare-canonical direct-publication path and deliberately retained the bounded legacy state-repository batch fallback. This PR observes that remaining fallback without changing its behavior; the direct path is explicitly marked not_applicable for batch-only timing.

Current origin/main at 4f1d7d6caa42c7c559301b970116b02cb98aa8c4 still has none of this PR's reservation_claim_observability, durable dispatcher reservation correlation, workflow stage timestamps, public delay buckets, or stall alerts. The seven-file / 1,016-line PR diff therefore remains additive and unmerged rather than duplicated by #859.

Maintainer decision required:

  1. Retain this legacy-fallback telemetry scope: approve the additive public-contract/schema risk and authorize one controlled, redacted deployed legacy-fallback dispatcher-to-stats capture; or explicitly waive that deployment-evidence requirement.
  2. Decline the telemetry scope because legacy-fallback observability is no longer wanted. In that case the PR may be closed as intentionally not pursued, but not as technically superseded by feat: Codex-only runtime, OpenClaw fallback runner, direct Cloudflare publication #859.

Until that decision, preserve this PR open. No deployed capture, queue replay, workflow dispatch, or behavioral change has been made from this branch.

Codex review

  • Dirty review: codex review --uncommitted — final clean result: no accepted/actionable findings.
  • Branch review: codex review --base origin/main — final clean result: no actionable correctness issues.
  • Accepted branch-review finding: a claim with only dispatch_id or only dispatched_at could bypass the correlation fence. The queue now rejects either partial form, with two-sided focused coverage.
  • Rejected findings: none. The prior ClawSweeper review raised proof/readiness requirements rather than a code defect; this body adds the available local runtime, migration, and redaction evidence without overstating it as live proof.

Risks / rollout

  • Additive Durable Object schema and public response fields only; no payloads, secrets, lease owners, or error bodies are exposed by the observability surface.
  • This remains telemetry-only. It does not modify scheduling, capacity, publisher admission, retries, state-writer semantics, direct Cloudflare publication, or GitHub-write behavior.
  • The changed batch workflow still requires the repository's existing GitHub OAuth/workflow permission. If that scope is unavailable, a maintainer-owned replacement branch may be needed.
  • Remaining maintainer rollout decision: accept the additive public contract and choose whether to authorize or waive a redacted deployed handoff capture. No merge or automerge is requested.

Related

@brokemac79
brokemac79 requested a review from a team as a code owner July 25, 2026 21:00
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Jul 25, 2026
@clawsweeper

clawsweeper Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 26, 2026, 8:37 AM ET / 12:37 UTC.

ClawSweeper review

What this changes

Adds redacted telemetry for legacy exact-review publication batches, tracing dispatcher reservation, workflow handoff, preparation, state-writer, and final GitHub-apply timing while marking direct Cloudflare publication as outside those batch-only timings.

Merge readiness

⚠️ Ready for maintainer review - 5 items remain

Keep this PR open for maintainer review. The available evidence supports a distinct, telemetry-only addition for the retained legacy publication fallback rather than a duplicate of direct publication, but accepting persisted Durable Object fields and a public queue-statistics contract is a rollout and product-boundary decision.

Priority: P3
Reviewed head: e8e526a1336057c6bff8217135ce9773917edf47
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The PR has credible local runtime proof, focused validation, and no discrete patch defect in the supplied review evidence; remaining readiness is a maintainer decision on the operator contract and rollout evidence.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body supplies an exact-head, redacted local Docker-backed Worker/Durable Object trace that exercises enqueue, claim, staged observations, completion, public stats, direct-versus-legacy classification, and redaction. A deployed trace is useful rollout evidence but not a missing contributor-proof defect.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body supplies an exact-head, redacted local Docker-backed Worker/Durable Object trace that exercises enqueue, claim, staged observations, completion, public stats, direct-versus-legacy classification, and redaction. A deployed trace is useful rollout evidence but not a missing contributor-proof defect.
Evidence reviewed 6 items Distinct retained fallback surface: The branch adds reservation-claim observability to queue stats and labels direct publication as not applicable for batch-only timing, preserving the distinction between the retained fallback and direct publication.
Durable telemetry migration and redaction boundary: The branch adds additive batch telemetry columns and fields for dispatch, runner, preparation, state-writer, and final-apply timestamps; the supplied PR evidence says the public response excludes secrets, lease owners, and failure bodies.
Workflow integration is bounded to batch publication: The workflow adds optional dispatcher correlation inputs, captures a runner-start timestamp, and records batch observation stages without changing direct publication behavior.
Findings None None.
Security None None.

How this fits together

Exact-review publication normally uses the Cloudflare-canonical direct path, with a bounded legacy state-repository batch path retained as fallback. This PR instruments that fallback path and returns redacted handoff health through the queue statistics endpoint for operators.

flowchart LR
  Producer[Exact-review producer] --> Direct[Direct Cloudflare publication]
  Producer --> Fallback[Legacy batch fallback]
  Fallback --> Reserve[Dispatcher reservation]
  Reserve --> Workflow[GitHub batch workflow]
  Workflow --> Queue[Durable queue telemetry]
  Queue --> Stats[Redacted queue statistics]
Loading

Decision needed

Question Recommendation
Should ClawSweeper retain and publicly expose this persisted observability contract for the bounded legacy publication fallback, and should a controlled redacted deployed handoff capture be required before merge? Accept the fallback telemetry contract: Approve the additive Durable Object and queue-statistics contract, then request or explicitly waive one controlled redacted deployed dispatcher-to-stats capture.

Why: The branch is additive and has credible local runtime proof, but the long-term value and compatibility commitment of durable telemetry plus a public operator response for a fallback path require maintainer intent rather than an automated correctness judgment.

Before merge

  • Resolve merge risk (P2) - Merging creates an additive Durable Object storage migration and public queue-statistics response contract for a fallback path; maintainers should explicitly accept the operator-facing compatibility boundary.
  • Resolve merge risk (P2) - The batch workflow gains dispatcher-correlation inputs and observation calls using existing credentials, so rollout should verify that production permissions and the observed fallback path behave as expected.
  • Resolve merge risk (P1) - The supplied runtime proof is strong local Worker/Durable Object evidence but is not a deployed dispatcher-to-stats capture; whether that production artifact is required is a maintainer rollout choice.
  • Complete next step (P2) - No concrete mechanical repair is evidenced; maintainers need to decide whether to retain this public, persisted fallback-observability contract and whether deployed rollout proof is required.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch surface 7 files; 1,016 additions and 25 deletions The proposal spans Durable Object storage, queue stats, a GitHub workflow, a repair CLI/client, and focused tests.
Proof scope 1 local Docker-backed Worker/Durable Object trace It exercises the public observability response and redaction contract, while a deployed handoff remains a rollout-level decision.

Root-cause cluster

Relationship: canonical
Canonical: #858
Summary: This PR is the canonical proposal for legacy publication-fallback observability; the merged direct-publication work is adjacent rather than a replacement.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Accept the operator contract with rollout evidence (recommended)
    Keep the telemetry scope and review a redacted deployed dispatcher-to-stats capture, or explicitly waive that artifact, before merging.
  2. Decline the retained-fallback surface
    Close the PR rather than merge if a persisted public telemetry API for the legacy fallback is not a desired commitment.

Technical review

Best possible solution:

Retain the telemetry only if maintainers want a durable, public observability contract for the bounded legacy fallback, then either review one controlled redacted deployed dispatcher-to-stats capture or explicitly waive that requirement before merge.

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

Not applicable: this PR adds observability rather than repairing an existing reported failure. The PR body provides a local HTTP-to-worker-to-Durable-Object trace of the new behavior, but no production dispatch was initiated.

Is this the best way to solve the issue?

Unclear: the implementation appears deliberately scoped to the retained legacy fallback rather than duplicating direct publication, but maintainers must decide whether a durable and public telemetry contract for that fallback is the best product direction.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3ecc41e30f9d.

Labels

Label justifications:

  • P3: This is an operational telemetry enhancement for a retained fallback path, not a current user-facing outage or regression.
  • merge-risk: 🚨 compatibility: The PR adds durable telemetry state and a public queue-statistics response contract that operators or integrations may come to rely on.
  • merge-risk: 🚨 automation: The batch publishing workflow gains new inputs and observation stages that must stay compatible with existing dispatch and credential handling.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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 PR body supplies an exact-head, redacted local Docker-backed Worker/Durable Object trace that exercises enqueue, claim, staged observations, completion, public stats, direct-versus-legacy classification, and redaction. A deployed trace is useful rollout evidence but not a missing contributor-proof defect.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies an exact-head, redacted local Docker-backed Worker/Durable Object trace that exercises enqueue, claim, staged observations, completion, public stats, direct-versus-legacy classification, and redaction. A deployed trace is useful rollout evidence but not a missing contributor-proof defect.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the merged direct-publication and Cloudflare-canonical record work that defines the current publication boundary and retained fallback this PR extends. (role: feature introducer; confidence: high; commits: 4288d557fff1, a22af2903582; files: dashboard/exact-review-queue.ts, dashboard/exact-review-publication-batches.ts)
  • Takhoffman: Authored the recent merged router durability work in the same repair and publication automation area, making them a relevant adjacent routing candidate rather than an owner of this proposal. (role: recent adjacent contributor; confidence: low; commits: 511dc8c4599c; files: src/repair/)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record whether the additive public queue-statistics and Durable Object migration contract is accepted.
  • If maintainers require it, add one controlled redacted deployed dispatcher-to-stats capture without exposing endpoints, IP addresses, credentials, lease owners, or failure bodies.

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 (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-25T21:46:11.966Z sha d15870f :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-26T08:37:19.074Z sha 4ce8d64 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-26T08:48:28.650Z sha e8e526a :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-26T08:52:29.207Z sha e8e526a :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-26T11:56:27.328Z sha e8e526a :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-26T12:10:58.618Z sha e8e526a :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-26T12:18:54.919Z sha e8e526a :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-26T12:28:51.002Z sha e8e526a :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 25, 2026
@brokemac79
brokemac79 force-pushed the codex/csw-064-reservation-claim-telemetry branch from d15870f to 4ce8d64 Compare July 26, 2026 08:33
@brokemac79
brokemac79 force-pushed the codex/csw-064-reservation-claim-telemetry branch from 4ce8d64 to e8e526a Compare July 26, 2026 08:43
@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. proof: sufficient Contributor real behavior proof is sufficient. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 26, 2026
@brokemac79
brokemac79 merged commit 2ea92d0 into main Jul 26, 2026
26 checks passed
@brokemac79
brokemac79 deleted the codex/csw-064-reservation-claim-telemetry branch July 26, 2026 15:12
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
* feat(telemetry): trace exact publication handoffs

* feat(telemetry): label direct publication timing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. 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