Skip to content

fix(publication): contain retries and normalize canonical slugs - #1094

Merged
brokemac79 merged 2 commits into
mainfrom
codex/csw-115-publication-containment
Aug 10, 2026
Merged

brokemac79 merged 2 commits into
mainfrom
codex/csw-115-publication-containment

Conversation

@brokemac79

@brokemac79 brokemac79 commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • reduce production exact-review publication capacity from the temporary pinned 50/50/50 override to staged containment values 8/32/40, including normalization of the persisted fixed-policy controller
  • normalize repository slugs to lowercase at both direct-publication and fallback canonical-tuple validation boundaries
  • preserve GitHub-facing queue, fence, and lifecycle keys with their original repository casing
  • add mixed-case regression coverage for steipete/CodexBar and openclaw/Peekaboo, including direct acceptance, fallback acceptance, dedupe, storage continuity, and collision prevention

Problem

CSW-115 found two independent publication degradation cohorts after #1088:

  1. Publication remained pinned at 50 concurrent workers even while the shared target-owner GitHub App installation was returning rate-limit failures. The fixed minimum prevented the adaptive controller from selecting a lower ceiling.
  2. GitHub repository identity is case-insensitive, but direct and fallback validation compared mixed-case target-derived slugs with lowercase canonical record paths case-sensitively. Reviews for repositories such as steipete/CodexBar and openclaw/Peekaboo could sync their GitHub comment and then retry or dead-letter during canonical publication.

PR #1088 did not introduce either behavior. The capacity override came from temporary emergency PR #729, and PR #1091 added diagnostics for the mixed-case rejection without fixing it.

Implementation

Staged capacity containment

Production bindings now use:

  • minimum: 8
  • base: 32
  • maximum: 40

This preserves more healthy throughput than the historical 4/24/48 rollback while restoring meaningful downward movement under pressure. A controller persisted by the fixed 50/50/50 policy now reopens with the new maximum ceiling of 40 and the new base demand of 32, and the normalized state is durably written on refresh. Batch size, batch workflow concurrency, dispatch cooldown, retry budgets, and queue inventory are unchanged.

Canonical repository identity

  • Direct validation lowercases only the target-derived canonical repository slug before comparing it with record paths.
  • Fallback tuple validation lowercases and canonicalizes the tuple key before path validation, fingerprinting, storage, and dedupe.
  • GitHub-facing canonicalTargetKey, fenceKey, lifecycle identity, and displayed repository casing remain unchanged.
  • Uppercase canonical record paths remain invalid, preventing a parallel storage namespace.
  • No migration, queue replay, DLQ operation, or production-data mutation is required.

Validation

Passed:

  • pnpm run build:all
  • focused changed-surface proof:
    node --test --test-name-pattern="production doubles|full review admission does not inflate|exact-review publication scales bounded|direct publication keeps GitHub casing|fallback tuple publication normalizes" test/dashboard-worker.test.ts
    • 5 passed, 0 failed
  • node --test test/dashboard-worker.test.ts
    • 325 passed, 0 failed
  • pnpm exec oxfmt --check dashboard/exact-review-direct-publication.ts dashboard/wrangler.toml test/dashboard-worker.test.ts
  • pnpm run lint:dashboard
  • pnpm run lint:scripts
  • git diff --check

Aggregate Windows limits:

  • pnpm run check reached repository-wide format:check, which reports 647 pre-existing checkout/line-ending differences on this Windows worktree. The three touched files pass the focused formatting check.
  • pnpm run test:coverage:no-build exercised the suite but failed in unrelated platform baselines: hosted Bash workflow fixtures with no WSL /bin/bash, Windows temp cleanup EPERM, and five action-ledger path assertions expecting / while receiving Windows \. No platform policy or unrelated fixtures are changed here; hosted Linux CI remains authoritative for those surfaces.

Real Behavior Proof

Claim: Mixed-case GitHub repository identities publish into one lowercase canonical Worker namespace through both direct and fallback paths, while the staged capacity range permits selection below the base target.

Exercised surface: The actual Worker/DO request handlers, publication validation, canonical storage, delivery fingerprinting/dedupe, record reads, and production Wrangler bindings.

Scenario and observed result:

  • Direct steipete/CodexBar#2831 and openclaw/Peekaboo#364 publications using lowercase canonical paths were accepted.
  • An identical direct delivery deduped while returning the original GitHub-cased target and fence keys.
  • A mixed-case fallback key steipete-CodexBar/2831 was accepted into records/steipete-codexbar/....
  • Repeating the same delivery as steipete-codexbar/2831 deduped at revision 1.
  • The lowercase canonical record remained readable, no uppercase namespace existed, and an uppercase-path tuple was rejected.
  • Production configuration assertions prove 8/32/40; capacity selection accepted a current ceiling of 16 rather than being clamped to the base or the former minimum of 50.
  • A persisted fixed-policy controller with ceiling/demand 50 reopens under the staged policy as ceiling 40 / demand 32 and persists that normalized controller state.

Environment: Windows host, Node v24.13.0, pnpm 11.16.0, in-memory SQLite-backed Worker/DO stores; plus Docker-backed Crabbox local-container with Node v24.19.0, pnpm 11.10.0, Wrangler 4.107.0, a real local Worker HTTP boundary, and the real ExactReviewQueue Durable Object. Candidate commit 1767e1eea72d89c709e497d86a637c1488e05931.

Artifacts/traces: TAP output from the focused five-scenario command and complete 325-test dashboard Worker file; audit contract retained locally as C:\clawsweeper-work\notes\CSW-115-real-behavior-proof.md.

Docker-backed runtime proof: Crabbox provider local-container, image node:24-bookworm, lease cbx_751790f30d07. To bypass the host's broken rsync transport without changing providers, the no-sync harness cloned the pushed branch inside the container and verified exact SHA a39f19e369632d5cbcc091399637888d4d758cf6. It installed pnpm 11.10.0, completed pnpm run build:all, and passed all five focused Worker/DO scenarios (5 passed, 0 failed). Timing: checkout 2.944s, install 3.827s, build 5.964s, behavior 1.393s, total 15.390s. Exit code 0; the one-shot lease stopped automatically. Earlier leases cbx_92bcc6fceaa4 and cbx_184ab5d8f57c documented the host rsync failure; setup-only leases cbx_150081ab7ab7 and cbx_55f28fb33afc identified and corrected container Corepack/PATH harness setup before the passing run.

Local Wrangler boundary proof: Crabbox provider local-container, image node:24-bookworm, lease cbx_a9dca16e1b96, exact SHA 1767e1eea72d89c709e497d86a637c1488e05931. Wrangler 4.107.0 first opened disposable local Durable Object state under the old fixed 50/50/50 policy and exposed/persisted ceiling=50, demand_capacity=50. A second Wrangler process reopened that same state under 8/32/40 and exposed ceiling=40, demand_capacity=32. Across signed loopback HTTP routes, a mixed-case direct batch publication for steipete/CodexBar#2831 returned accepted then deduped, preserved the GitHub-cased target/fence keys, and read the stored lowercase record back with revision/digest continuity. A fallback tuple keyed as openclaw-Peekaboo/364 returned accepted, then deduped when retried as openclaw-peekaboo/364; the lowercase record read back at revision 1, the uppercase namespace returned 404, and uppercase direct/fallback paths returned 400. Result: all controller and 31 route assertions passed, exit 0; checkout 2.726s, install 3.937s, old-policy seed 11.827s, staged-policy restart 2.184s, HTTP behavior 0.285s, total 21.774s; lease stopped automatically. No request targeted production or external GitHub.

Limits: This proof does not deploy the Worker, mutate a live GitHub target, replay queues, or demonstrate organic post-deployment quota recovery.

Codex review closeout

  • Dirty patch: codex review --uncommitted
    • no actionable correctness issue identified
  • Committed range: codex review --base origin/main
    • reviewed base 2cc2c0df8d533677c5ff82cf3b86a148dd869554
    • reviewed head 1767e1eea72d89c709e497d86a637c1488e05931
    • no actionable regression evident
  • Accepted findings: normalize the persisted fixed 50/50/50 controller to the staged base on downgrade; implemented with focused upgrade-state coverage.
  • Rejected findings: none
  • Focused behavior proof, full 325-test Worker file, and the post-fix Wrangler/DO boundary proof were rerun clean.

OpenClaw Bay impact

No Bay schema, API response shape, route, or UI rendering changes. Mixed-case reviews will now reach the same lowercase canonical records that Bay already reads, reducing retry/DLQ gaps in lifecycle projection. The lower publication capacity may temporarily leave more cards in Applying while a backlog drains, but the Bay stage mapping and public contract are unchanged.

Risks and rollout

  • Lower capacity may temporarily increase fresh-publication latency if quota pressure is absent. The staged base of 32 and max of 40 limit that risk.
  • Lowercasing canonical storage identity intentionally converges case variants. GitHub treats owner/repository identity case-insensitively, and canonical record paths are already lowercase.
  • No storage migration or destructive operation is included.

After deployment, monitor at least one complete 60-minute quota window:

  • retry amplification below 0.25
  • positive publication backlog drain
  • falling oldest-item age, targeting below one hour
  • no same-installation 403 bursts attributable to excessive concurrency
  • no new mixed-case tuple_protocol_invalid failures
  • acceptable fresh-publication latency

Rollback is a normal code/config revert. It does not require queue or record migration.

Follow-up

This containment does not yet short-circuit remaining members after the first same-installation rate-limit response or connect every batch throttle receipt to adaptive capacity feedback. Those should remain a separate, measured follow-up.

Links

Release-note context: publication now treats GitHub repository casing consistently and applies a lower staged concurrency range during backlog recovery. CHANGELOG.md is intentionally untouched because release notes are release-owned.

@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 10, 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 merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. P1 Urgent regression or broken agent/channel workflow affecting real users now. 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. labels Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 10, 2026, 5:23 AM ET / 09:23 UTC.

ClawSweeper review

What this changes

The PR lowers exact-review publication capacity to 8/32/40, persists that policy across a prior fixed-capacity state, and normalizes mixed-case repository slugs at direct and fallback canonical-record validation boundaries.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

The patch is technically sound and its final-head Worker/Durable Object boundary proof is sufficient. Keep it open for an explicit maintainer decision on the production 8/32/40 capacity policy and its throughput tradeoff.

Priority: P1
Reviewed head: 1767e1eea72d89c709e497d86a637c1488e05931
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused real-boundary proof, narrow implementation, and regression coverage strongly support the repair; only production capacity policy approval remains.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body records an after-fix Docker-backed local Wrangler Worker and real Durable Object run on the final head, including persisted-controller restart and signed direct and fallback publication results.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body records an after-fix Docker-backed local Wrangler Worker and real Durable Object run on the final head, including persisted-controller restart and signed direct and fallback publication results.
Evidence reviewed 6 items Current main still needs the capacity change: Current main pins the publication minimum, base, and maximum at 50, so the staged policy is not already implemented.
Current main exposes the mixed-case validation defect: Both fallback tuple and direct-plan validation derive a repository slug without lowercasing it before comparing canonical paths.
Persisted-controller downgrade is narrowly handled: The branch recognizes a former fixed policy above the new maximum, restores demand to the staged base, and writes normalized state rather than retaining a fixed maximum target.
Findings None None.
Security None None.

How this fits together

Exact-review publication sends completed reviews through a Durable Object queue into lowercase canonical record storage while retaining GitHub’s displayed repository casing for queue and lifecycle identities. The adaptive controller limits how many publication jobs proceed, and stored records feed lifecycle and dashboard readers.

flowchart LR
A[Completed reviews] --> B[Publication queue]
B --> C[Adaptive capacity controller]
C --> D[Worker validation]
D --> E[Canonical record storage]
E --> F[Lifecycle and dashboard readers]
Loading

Decision needed

Question Recommendation
Should production adopt the staged 8/32/40 publication policy, accepting potentially lower fresh-publication throughput to restore adaptive containment during GitHub quota pressure? Approve staged containment: Merge the 8/32/40 policy and monitor the specified quota window for backlog drain, retry amplification, 403 bursts, and latency.

Why: The source and local boundary proof establish correctness, but selecting a production concurrency envelope and rollout tolerance is an operational ownership decision.

Before merge

  • Resolve merge risk (P1) - The local proof cannot establish live GitHub-installation quota recovery; merging changes fresh-publication latency and backlog-drain behavior until the proposed post-deployment monitoring window is observed.
  • Complete next step (P2) - No mechanical repair remains; a publication owner must approve the production concurrency envelope and its monitoring plan.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch surface 4 files affected; 304 added, 17 removed The patch spans production validation, Durable Object policy state, production bindings, and focused regression coverage.
Production versus test delta production +14 net (+26/-12); tests +273 net (+278/-5) Most growth is targeted coverage for persisted-state and mixed-case publication behavior.

Root-cause cluster

Relationship: canonical
Canonical: #1094
Summary: This PR is the canonical combined repair for the temporary fixed publication policy and mixed-case canonical-record rejection.

Members:

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

Merge-risk options

Maintainer options:

  1. Approve and monitor staged containment (recommended)
    Accept the 8/32/40 operational tradeoff and observe the documented post-deployment quota window before considering follow-up tuning.
  2. Request revised capacity targets
    Pause the draft until an owner selects different production concurrency values while retaining the canonical-slug repair.

Technical review

Best possible solution:

Adopt the focused normalization and persisted-controller repair, then monitor a full quota window to confirm lower retry amplification and acceptable fresh-publication latency.

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

Yes, at source level: current main preserves a fixed 50/50/50 policy and compares mixed-case derived slugs against canonical paths without normalization. The PR also records an after-fix local Worker/DO boundary run on its exact head.

Is this the best way to solve the issue?

Yes for the code defects: normalization is limited to canonical storage identity while GitHub-facing casing remains intact, and the persisted fixed policy is reset without a migration. The chosen production capacity values still need owner approval.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2cc2c0df8d53.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body records an after-fix Docker-backed local Wrangler Worker and real Durable Object run on the final head, including persisted-controller restart and signed direct and fallback publication results.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body records an after-fix Docker-backed local Wrangler Worker and real Durable Object run on the final head, including persisted-controller restart and signed direct and fallback publication results.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P1: The change addresses dead-letter and retry behavior that can prevent completed reviews from reaching canonical publication.
  • merge-risk: 🚨 availability: Lowering production publication concurrency can change backlog-drain rate and fresh-publication latency.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body records an after-fix Docker-backed local Wrangler Worker and real Durable Object run on the final head, including persisted-controller restart and signed direct and fallback publication results.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body records an after-fix Docker-backed local Wrangler Worker and real Durable Object run on the final head, including persisted-controller restart and signed direct and fallback publication results.

Evidence

What I checked:

  • Current main still needs the capacity change: Current main pins the publication minimum, base, and maximum at 50, so the staged policy is not already implemented. (dashboard/wrangler.toml:58, 2cc2c0df8d53)
  • Current main exposes the mixed-case validation defect: Both fallback tuple and direct-plan validation derive a repository slug without lowercasing it before comparing canonical paths. (dashboard/exact-review-direct-publication.ts:1406, 2cc2c0df8d53)
  • Persisted-controller downgrade is narrowly handled: The branch recognizes a former fixed policy above the new maximum, restores demand to the staged base, and writes normalized state rather than retaining a fixed maximum target. (dashboard/exact-review-queue.ts:11830, 1767e1eea72d)
  • Regression coverage exercises both boundaries: The branch tests 50/50 persisted-state normalization plus mixed-case fallback acceptance, dedupe, lowercase continuity, and uppercase-path rejection. (test/dashboard-worker.test.ts:1651, 1767e1eea72d)
  • Feature-history provenance: The direct publication validator on current main dates to the focused publication split, providing an ownership trail for the affected boundary. (dashboard/exact-review-direct-publication.ts:1589, 0036015e1dd0)
  • The branch is not on current main: The proposed head is not an ancestor of the reviewed main SHA, so this remains necessary work rather than an implemented-on-main cleanup. (1767e1eea72d)

Likely related people:

  • Peter Steinberger: Introduced the current direct-publication validation boundary and most recently maintained its rejection behavior. (role: publication-boundary introducer and recent area contributor; confidence: high; commits: 0036015e1dd0, e699e83d2707; files: dashboard/exact-review-direct-publication.ts, dashboard/exact-review-queue.ts)
  • Martin Cleary: Recent merged queue work covers GitHub quota headroom adjacent to this production publication-capacity policy. (role: recent queue-capacity contributor; confidence: medium; commits: 13f8ffdea32a; files: dashboard/exact-review-queue.ts)
  • brokemac79: The earlier merged temporary 50-worker publication policy is the persisted-state predecessor this PR replaces. (role: introduced temporary capacity override; confidence: high; commits: 360074f1dbaa; files: dashboard/wrangler.toml)

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 (3 earlier review cycles)
  • reviewed 2026-08-10T08:52:44.357Z sha a39f19e :: needs real behavior proof before merge. :: [P2] State the OpenClaw Bay impact in the PR body
  • reviewed 2026-08-10T09:01:26.372Z sha a39f19e :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-10T09:04:51.847Z sha a39f19e :: needs real behavior proof before merge. :: [P1] Normalize the persisted demand target on downgrade

@brokemac79

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

1 similar comment

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 10, 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 proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 10, 2026
@brokemac79
brokemac79 marked this pull request as ready for review August 10, 2026 09:45
@brokemac79
brokemac79 merged commit 50f90ea into main Aug 10, 2026
22 checks passed
@brokemac79
brokemac79 deleted the codex/csw-115-publication-containment branch August 10, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 Merging this PR could cause crashes, hangs, restart loops, stalls, or process outages. P1 Urgent regression or broken agent/channel workflow affecting real users now. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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