Limit-park history: the marker is live-only — lost-capacity windows per account are not recorded #100

Closed
opened 2026-08-26 03:02:37 +00:00 by matou-build-agent · 3 comments

From the 2026-08-25 observability review — "worth knowing" item.

Symptom. limit-lib.sh's park marker says a host is limit-parked now; when the park began, when it lifted, and which account was exhausted are gone once the marker clears. Real lost capacity per account per week — the number that would justify (or refute) a budget/second-account decision, and the Loss tab's calibration input — is unmeasured.

Direction. On park entry and exit, append an events row (kind limit-pause, already an envisioned kind in swarm-db.py's schema comment) with the account letter and marker contents; or an append-only park log beside the marker. Entry is already a single choke point in limit-lib.sh; exit can be stamped by whichever tick observes the marker expired.

Pairs with the always-on sampler ticket (which samples park state per minute) — events give exact edges, samples give the cross-check.

From the 2026-08-25 observability review — "worth knowing" item. **Symptom.** `limit-lib.sh`'s park marker says a host is limit-parked *now*; when the park began, when it lifted, and which account was exhausted are gone once the marker clears. Real lost capacity per account per week — the number that would justify (or refute) a budget/second-account decision, and the Loss tab's calibration input — is unmeasured. **Direction.** On park entry and exit, append an `events` row (kind `limit-pause`, already an envisioned kind in swarm-db.py's schema comment) with the account letter and marker contents; or an append-only park log beside the marker. Entry is already a single choke point in `limit-lib.sh`; exit can be stamped by whichever tick observes the marker expired. Pairs with the always-on sampler ticket (which samples park state per minute) — events give exact edges, samples give the cross-check.
Author
Member

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.
Ruling: ready-for-agent. Two-way door — additive event writes at a single existing choke point (limit-lib.sh's park entry), using an event kind (limit-pause) already envisioned in swarm-db.py's own schema comment; revertible, provable by limit-lib test coverage.

Agent Brief

Category: enhancement
Summary: Record limit-park entry and exit durably, per account.

Current behavior:
limit-lib.sh's park marker only reflects the current state. Once the marker clears, when the park began, when it lifted, and which account was exhausted are all gone. Real lost capacity per account per week — the number that would justify or refute a budget/second-account decision, and the Loss tab's calibration input — is unmeasured.

Desired behavior:
On park entry, an events row (kind limit-pause) is appended with the account letter and marker contents. On exit — stamped by whichever tick first observes the marker expired — a corresponding record closes it out, either as a paired event or an append-only park log beside the marker.

Key interfaces:

  • limit-lib.sh's single park-entry choke point.
  • Whichever polling path first observes the marker's expiry, for the exit side.
  • swarmdb_event.

Acceptance criteria:

  • Every park entry writes an events row (kind limit-pause) with the account letter and marker contents
  • Park exit is recorded by whichever tick first observes the expired marker, pairing with its entry
  • A weekly/aggregatable view of lost capacity per account is derivable from the recorded events
  • limit-lib tests cover both entry and exit recording

Out of scope:

  • The always-on sampler (#97) — cross-checks this data but is a separate ticket
  • Changing park duration/thresholds
> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** Ruling: `ready-for-agent`. Two-way door — additive event writes at a single existing choke point (`limit-lib.sh`'s park entry), using an event kind (`limit-pause`) already envisioned in `swarm-db.py`'s own schema comment; revertible, provable by limit-lib test coverage. ## Agent Brief **Category:** enhancement **Summary:** Record limit-park entry and exit durably, per account. **Current behavior:** `limit-lib.sh`'s park marker only reflects the *current* state. Once the marker clears, when the park began, when it lifted, and which account was exhausted are all gone. Real lost capacity per account per week — the number that would justify or refute a budget/second-account decision, and the Loss tab's calibration input — is unmeasured. **Desired behavior:** On park entry, an `events` row (kind `limit-pause`) is appended with the account letter and marker contents. On exit — stamped by whichever tick first observes the marker expired — a corresponding record closes it out, either as a paired event or an append-only park log beside the marker. **Key interfaces:** - `limit-lib.sh`'s single park-entry choke point. - Whichever polling path first observes the marker's expiry, for the exit side. - `swarmdb_event`. **Acceptance criteria:** - [ ] Every park entry writes an `events` row (kind `limit-pause`) with the account letter and marker contents - [ ] Park exit is recorded by whichever tick first observes the expired marker, pairing with its entry - [ ] A weekly/aggregatable view of lost capacity per account is derivable from the recorded events - [ ] `limit-lib` tests cover both entry and exit recording **Out of scope:** - The always-on sampler (#97) — cross-checks this data but is a separate ticket - Changing park duration/thresholds
Author
Member

swarm-claim host=matou-dev-server-01 run=1160
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=1160 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #100 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 100,
  "status": "success",
  "commits": [
    "52f617d12f92a675e7a6c9ec18739fc5c25ecc60"
  ],
  "changed_files": [
    "limit-lib.sh",
    "execute-lib.sh",
    "session-runner.sh",
    "swarm-db.py",
    "swarm-db.sh",
    "tests/limit-lib-test.sh",
    "tests/execute-lib-test.sh",
    "tests/swarm-db-test.sh",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "bash tests/limit-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/execute-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/swarm-db-test.sh",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do bash $t; done (offline suite, fakebin/fixtures skipped)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Every park entry writes an events row (kind limit-pause) with the account letter and marker contents": "limit-lib.sh claude_limit_park stamps the active account letter into the marker and calls _claude_limit_event which writes a limit-pause 'park account=X' event; the marker's content IS the account letter. Proven by tests/limit-lib-test.sh (entry group) and tests/execute-lib-test.sh (park edge carries failed-over account B)",
    "Park exit is recorded by whichever tick first observes the expired marker, pairing with its entry": "new claude_limit_sweep records the paired 'unpark account=X' when it sees the marker present-but-STALE and clears it; wired into execute-lib.sh execute_sandcastle_run (every worker tick) and session-runner.sh before its parked guard. Proven by tests/limit-lib-test.sh (exit group) and tests/execute-lib-test.sh (group 7)",
    "A weekly/aggregatable view of lost capacity per account is derivable from the recorded events": "swarm-db.py q_limit_lost query (limit-lost, exposed on swarm-db.sh reader) pairs park/unpark edges into parked seconds per account per ISO week. Proven by tests/swarm-db-test.sh limit-lost group",
    "limit-lib tests cover both entry and exit recording": "tests/limit-lib-test.sh adds two groups: entry (marker stamped with account, one park edge, re-hit adds none, no-ops with no mirror) and exit (sweep records the paired unpark and clears the marker)"
  },
  "summary": "limit-park now records per-account park/unpark edges to swarm.db so lost capacity per account per week is measurable after the live marker clears.",
  "blockers": []
}
**close-report** for #100 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 100, "status": "success", "commits": [ "52f617d12f92a675e7a6c9ec18739fc5c25ecc60" ], "changed_files": [ "limit-lib.sh", "execute-lib.sh", "session-runner.sh", "swarm-db.py", "swarm-db.sh", "tests/limit-lib-test.sh", "tests/execute-lib-test.sh", "tests/swarm-db-test.sh", "STATUS.md" ], "tests": [ { "command": "bash tests/limit-lib-test.sh", "exit_code": 0 }, { "command": "bash tests/execute-lib-test.sh", "exit_code": 0 }, { "command": "bash tests/swarm-db-test.sh", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do bash $t; done (offline suite, fakebin/fixtures skipped)", "exit_code": 0 } ], "criteria": { "Every park entry writes an events row (kind limit-pause) with the account letter and marker contents": "limit-lib.sh claude_limit_park stamps the active account letter into the marker and calls _claude_limit_event which writes a limit-pause 'park account=X' event; the marker's content IS the account letter. Proven by tests/limit-lib-test.sh (entry group) and tests/execute-lib-test.sh (park edge carries failed-over account B)", "Park exit is recorded by whichever tick first observes the expired marker, pairing with its entry": "new claude_limit_sweep records the paired 'unpark account=X' when it sees the marker present-but-STALE and clears it; wired into execute-lib.sh execute_sandcastle_run (every worker tick) and session-runner.sh before its parked guard. Proven by tests/limit-lib-test.sh (exit group) and tests/execute-lib-test.sh (group 7)", "A weekly/aggregatable view of lost capacity per account is derivable from the recorded events": "swarm-db.py q_limit_lost query (limit-lost, exposed on swarm-db.sh reader) pairs park/unpark edges into parked seconds per account per ISO week. Proven by tests/swarm-db-test.sh limit-lost group", "limit-lib tests cover both entry and exit recording": "tests/limit-lib-test.sh adds two groups: entry (marker stamped with account, one park edge, re-hit adds none, no-ops with no mirror) and exit (sweep records the paired unpark and clears the marker)" }, "summary": "limit-park now records per-account park/unpark edges to swarm.db so lost capacity per account per week is measurable after the live marker clears.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory#100
No description provided.