Skip to content

impl: fleet content-creation throttle — shared ledger, pacing budgets, and verify-by-read filing #2227

Open

Description

@dezren39

Implementation for the design in #2013 — design record: doc/2026-10-29T10-08-00Z_design_github-content-creation-pacing/ (PR #2226).

Problem

Every fleet lane authenticates as one account, so GitHub's content-creation ceiling (documented: ~80/min, 500/hour) is a single shared budget no job can see. On 2026-10-28 developing-today/code alone produced 2 916 content-creating events (479 issues/PRs + 2 437 comments), peaking at 511 in the 22:00Z hour; creation then stopped for 31m48s after #1999. gh issue create exited 0 with empty output while creating nothing, so no caller noticed.

Scope

Code lands with the fleet tooling (~/hatch/tools, repo-queue.py, producer/filing scripts), not in this repository. This issue is the tracking record and the spec pointer.

  1. Creation ledger — ~/.local/state/fleet/content-ledger.sqlite, one row per content-creating call (ts_utc, actor, job, repo, kind, ref, outcome), written as a reservation before the call and finalised after the verifying read; windows computed from the ledger (60 s, 3 600 s), atomic across processes via BEGIN IMMEDIATE.
  2. Throttle wrapper — reserve(job, kind) before every create. Account-wide 45/min and 300/hour; ≥ 1 s between POSTs; ≤ 8 in flight; per-lane 50/hour sustained with idle share reclaimable; 75/hour reserve for priority-10 breakage work; bulk programs ≤ 20 issues per 30-minute window.
  3. Verify-by-read — success only when a read confirms the object: require non-empty stdout with a number/URL, else search for the <!-- fleet-nonce:… --> marker in the body; record created | verified_existing | failed. Empty output is a failure, never a success.
  4. Circuit breaker — honour retry-after; without it wait 60 s then exponential ×2 (5 attempts); after 5 failures stop content creation for 15 minutes, park the calling task with a resume brief, alert. Never spin (GitHub warns retrying while limited can ban the integration).
  5. Structural reduction — one live agent note per task, edited in place, instead of one comment per checkpoint (comments are 5× the issue volume). Target ≤ 2 comments per task.
  6. Gap detector — alert when queued filing work exists and no creation is seen for > 5 minutes (belongs in the fleet monitor).

Acceptance

  • A filing script run through the wrapper cannot exceed the throttle budgets, proven by a test that replays a 100-create batch and asserts the ledger shape.
  • A simulated empty-output/403 create is recorded as failed, and the batch tally does not count it — regression test for the 2026-10-28 silent failure.
  • A simulated 403 with retry-after and one without both back off per the rules, and five failures open the circuit.
  • Warn-only run for one week: the throttle logs what it would have delayed without delaying, and the log is reviewed before enforcing.
  • Success measure after enforcement: no creation 403 for 14 days, account-wide hourly total under 300, and queue throughput unchanged.

Order

Ledger + verify-by-read first (additive, fixes the silent-success bug), then the throttle in warn-only mode, then enforcing, then the comment-reduction change in the note-writing path.

Out of scope

  • The 42-issue program's partial filing (unknown whether items were lost; the ledger makes it answerable next time).
  • Multi-host coordination (open question in the design if a sandbox lane ever files).

Acceptance criteria

  • The creation ledger exists at the design's path and records every fleet content-creating call (issues, PRs, comments) with actor/job/repo/kind/ref/outcome, written as a reservation before the call.
  • Pacing budgets from the design (investigate: GitHub secondary rate limits — fleet content-creation pacing so filing bursts stop blocking the account #2013) are enforced at the shared choke point(s): a caller that would exceed the budget is delayed or visibly refused — never silently dropped — and the gh issue create exits-0-but-creates-nothing failure mode is detected and surfaced to the caller.
  • A verify-by-read pass demonstrates the ledger's counts against GitHub's actual creation events for one busy hour (the 2026-10-28 22:00Z peak hour, 511 events, is the natural test case).

Activity

  1. added
    enhancement
    priority/high
    kind/infrastructure
    on Oct 29, 2026
  2. developing-today commented on Oct 29, 2026

    @developing-today
    Contributor
  3. added
    status/needs-triage
    effort/l
    meta/enriched
    on Oct 29, 2026
  4. dezren39 commented on Oct 29, 2026

    @dezren39
    MemberAuthor

    Intake review

  5. added
    queue/queued
    source/creator
    task/triage
    on Nov 3, 2026
  6. developing-today commented on Nov 3, 2026

    @developing-today
    Contributor

    agent-note:v1
    state: reviewed (coverage loop-back)
    Coverage pass 2026-11-03, loop-back review: this issue was re-reviewed (drift / overlap / already-handled / stale / blockers / ordering) so every open issue in the four repos is reviewed and in the system. Verdict: still live; in the system as task 7310 (triage, queued, priority 50) in repo-health-code-pilot. Labels audited and synced. If it is already handled at current main, its triage closes it with evidence; if oversized, the triage files the split; blockers belong on this issue.
    Found via: coverage loop-back 2026-11-03

  7. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: picked-up
    task: 7310
    worker: repo-worker-code
    lane: 335a5d1f-bfc1-4831-99ea-850c8939a727
    origin: openchamber-scheduled-lane
    next: Revalidate current state of issue #2227 and inspect the implementation on current main before deciding whether it is done, blocked, needs a split, or needs implementation.

  8. added
    queue/claimed
    on Nov 3, 2026
  9. 113 remaining items

  10. added a commit that references this issue on Nov 28, 2026
  11. developing-today-fleet commented on Nov 28, 2026

    @developing-today-fleet
    Contributor

    Agent note — #2227 re-verified from lane code-g (priority rung), no code-repo slice exists

    Fresh first-hand verification this run (2026-11-28 ~02:15Z), per feature-slice step 1 (states checked against origin/main + live fleet state, not prior notes):

    • AC1 — creation ledger at the design path: SATISFIED EXTERNALLY, nothing to land here. ~/.local/state/fleet/content-ledger.sqlite exists with table events(ts_utc, actor, job, repo, kind, ref, outcome, nonce, detail); 3,266 rows, span 2026-11-24T01:58Z to 2026-11-28T02:13Z (minutes old), outcomes created 3,231 / failed 35. Delivered by merged content-ledger: shared creation ledger + verify-by-read filing (hatch#3) dezren39/hatch#17 (hatch#3 COMPLETED 2026-11-23). No ledger/throttle/verify-by-read code exists in developing-today/code outside the design doc itself (doc/2026-10-29T10-08-00Z_design_github-content-creation-pacing/) — confirmed by repo-wide grep.
    • AC2 — pacing budgets enforced: IN PROGRESS EXTERNALLY. content-throttle: pacing wrapper (warn-only), circuit breaker, gap detector; gh-post gate + live note (hatch#13) dezren39/hatch#18 merged (throttle wrapper, circuit breaker live, one-live-note, gap detector); throttle in WARN mode since 2026-11-23T01:12Z, enforce flip pending the warn-week review (~2026-11-30). Tracked in hatch#13 (OPEN rollout record).
    • AC3 — verify-by-read pass vs GitHub actuals for a busy hour: OPEN, owned by the hatch rollout. The 2026-11-24 review note already flags it: reconcile-or-waive explicitly at the warn-week review. (The ledger post-dates the 2026-10-28 peak, so this must be a recent-hour reconciliation, with the known fleet-gh/gh-shim bypass caveat.)
    • Scope stands: this issue's own Scope section puts all code in hatch tooling, not this repo. Four prior independent triages (tasks 15217/16746/18210/19724) reached the same verdict; the hatch delivery since confirms it rather than reopening it.

    Verdict: no landable code-repo slice — no PR from this lane (a competing throttle/ledger here would violate the routed design). Next slice, in its home repo: warn-week review on hatch#13 (~2026-11-30), then the enforce flip; fold the AC3 reconcile-or-waive into that review. After the flip, the post-enforcement success measure (no creation 403 for 14 days, hourly under 300) becomes measurable.

  12. developing-today-fleet commented on Nov 28, 2026

    @developing-today-fleet
    Contributor

    Agent note — lane 2137-K stand-down (alpha DRIVE 2026-11-27 21:37 CST, priority-rung draw): no landable slice; concurring with the 02:15Z code-g verification, re-checked fresh this run.

    Verdict: tracking record / spec pointer whose work is shipped or routed — no PR from this lane, no duplicate implementation. Wake: hatch#13 warn-week review ~2026-11-30.

  13. developing-today-fleet commented on Nov 28, 2026

    @developing-today-fleet
    Contributor

    🤖 Agent note — lane oc-code-05 stand-down (priority rung, 2026-11-28 ~04:10Z): no landable slice; concurring with code-g / 2137-K, re-verified fresh.

  14. developing-today-fleet commented on Nov 28, 2026

    @developing-today-fleet
    Contributor

    🤖 Agent note · slice landed for review — lane oc-code-04 (OpenChamber scheduled lane, priority rung)

    • PR: fleet-monitor: report-only content-creation gap adapter (#2227 item 6) #16510 — report-only content-creation gap adapter (spec item 6) in pm-stack/fleet-monitor/: runs the throttle's gap-check on the monitor cycle, exit 2 becomes an alert record, detector failures exit non-zero and never fake a clear record. 9-test golden-corpus suite + pm-stack-tests wiring.
    • Evidence: red state shown (suite fails with module absent), green (9 OK), live run against the laptop throttle returns a clear record (exit 0); existing monitor suites still pass (6 + 20 OK). CI evidence pending nightly pm-stack-tests.
    • State re-verified this run: hatch#3 CLOSED (ledger live at ~/.local/state/fleet/content-ledger.sqlite), throttle in warn mode since 2026-11-23T18:18:43Z (warn week not yet elapsed — enforce flip correctly not taken), hatch#13 still OPEN for the remaining phases. Gap-detector CLI was the unwired piece on the code-repo side; this slice wires it.
    • Next slice: warn-week review + enforce flip (hatch-side, due after 2026-11-30), or a hatch#13 phase if the warn log review lands first.
  15. added a commit that references this issue on Nov 28, 2026
  16. developing-today-fleet commented on Nov 28, 2026

    @developing-today-fleet
    Contributor

    Agent note — lane 0937-D stand-down (alpha DRIVE 2026-11-28, shortlist rank 3 draw; queue rung down this draw, no queue task): no landable slice, re-verified fresh.

    No claim, no PR, no duplicate slice from this lane. Wake: warn-week review on hatch#13 after ~2026-11-30.

  17. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    Progress — oc-code-04 (2026-11-29): I added an hourly verify-by-read reconciliation command and evidence for the busiest hour available in the host ledger (2026-11-26 23:00–24:00Z). GitHub reports 640 events (42 issues/PRs, 598 comments); the ledger has 455 successful rows and 4 failed attempts, leaving a 185-event gap (25 objects, 160 comments). The historical 2026-10-28 peak predates this ledger, so it cannot be reconciled from local data. The command and report are committed locally as 05e59e4 on oc-code-04/2227-verify-hour in the worktree at /home/user/git/fleet/oc-code-04-2227-verify-20261129T092513Z-a0677987. I could not publish the branch: the Fleet GitHub credential was denied write access to dezren39/hatch. This slice is parked locally, not complete. Next slice: trace the 185-event gap to missing create paths, wire them through the shared choke point, then rerun the reconciliation to exit 0. No owner decision is required.

  18. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    Drawn via fleet agent next (priority rung), 2026-11-29. Standing down: oc-code-04 is actively on this issue (verify-by-read reconciliation progress note 09:38Z today, following PR #16510). No claim taken; the lane pulls its next item.

  19. dezren39 commented on Nov 29, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · census 2026-11-29 (lane CEN-C03)

    Census verified: spec is complete and pickup-ready (creation ledger, throttle wrapper, verify-by-read, circuit breaker; design in #2013 / PR #2226). Blocker: none found. One pickup note from the body: the code lands with the fleet tooling (~/hatch/tools, repo-queue.py, producer/filing scripts), not in this repository — this issue is the tracking record and spec pointer. Priority: high (unchanged).

  20. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    Census 2026-11-29 (Felix): full re-read (body, labels, all comments, native edges) in the CODE-6 recovery pass.

    STRENGTHS: complete implementation record (PRs #14175/#14176 and hatch PRs #17/#18 landed the fleet side); the calendar gate is documented in-thread.
    GAPS: carried no status/* label at all despite active work.
    FIXES I APPLIED: added status/in-progress (oc-code-04 is actively working the OpenClaw side; a Felix lane stood down today to avoid collision).
    REMAINS: the OpenClaw-side landing, then the calendar verification owned by hatch#13 (warn-log review + enforce flip due ~2026-11-30).

  21. developing-today-fleet commented on Nov 29, 2026

    @developing-today-fleet
    Contributor

    Issue census — 2026-11-29

    Wave-2 census pass (group code-01409-03205): rechecked live state, body, labels and recent comments firsthand via fleet gh immediately before editing.

    Strengths: detailed body (4208 chars) with context a picker-up can start from; acceptance criteria present in the body; single taxonomy priority band (priority/high) — verified against live labels; kind label present (kind/infrastructure).

    Gaps found: bare non-taxonomy enhancement label duplicating kind/*.

    Actions taken this pass: labels: +[] -['enhancement'].

    Priority: priority/high — checked against content, unchanged (no reprioritization). No closing keywords used; issue left open.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lepic/fleet-orchestrationkind/infrastructuremeta/enrichedpriority/highsource/creatorstatus/in-progress

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions