MotirBuilding in public
MOTIR · moooon
onMotir
You’re viewing a public project. Anyone can view it — no account needed. Sign in to submit, upvote, or comment on requests.View-only — you can’t edit work items
MOTIR-3403

Planning bug: a bug card's MECHANISM was taken from an untested code comment, and three candidate fixes were planned off it

Done
Description

Filed by the motir run MOTIR-3245 that submitted plan cmt5jlu6s00g5i3ph9lipk7eq (2026-08-23). The correction is already on that plan; this is the telemetry.

The defect in the PLAN

MOTIR-3245 was authored with an excellent SYMPTOM section — production Inngest measurements, four consumers 17 min 18 s late, volume and retries both excluded — and then took its MECHANISM verbatim from a code comment in lib/jobs/definitions/codeGraphRefresh.ts:

"A stepped supervision loop holds its Inngest concurrency slot for the CONTAINER'S WHOLE LIFE."

The card quoted that sentence as the thing to preserve ("its reasoning is correct and worth preserving verbatim") and derived its entire fix space from it: lane separation, event priority, a waitForEvent rewrite — MOTIR-3247 carries all three.

The sentence is false. MOTIR-3246 measured it (motir-core#2259): at concurrency: { limit: 1 }, three runs sleeping 8 s entered within 294 ms and finished inside 8.6 s, against a control arm holding the same 8 s in a step.run that serialized 8 s apart and finished at 24 s. A supervisor occupies ~128 sub-second steps across a 30-minute index, releasing the slot between every one.

So all three planned remedies address an occupancy of roughly 10% of one slot, and the production correlation runs the other way entirely (fast lane p95 4.6 s while a refresh runs, 29.5 s while none does).

What made it hard to catch, and it is NOT carelessness

The card did the two things that usually protect against this and they did not help:

  1. It measured hard — but it measured the SYMPTOM (event→run lag from the Inngest REST API) and inherited the MECHANISM. A card can be rich in evidence and still have zero evidence for the sentence that selects its architecture.
  2. The comment it quoted was itself careful — three numbered arguments, two cards of provenance (MOTIR-2057 inheriting MOTIR-1990), a ⚠️ marker and an explicit prohibition. Its careful construction is exactly what made it read as settled. The claim had been steering this family of cards since MOTIR-1990 and had never been tested once.

The card even anticipated its own falsification — "if a sleeping run frees its slot … the starvation has a different cause" — and still ordered the fix card as a sibling that inherits the mechanism, rather than treating the whole fix space as contingent.

What the planner should have done

MOTIR-3245 already ordered MOTIR-3246 first, which is right and is why this was caught before any of the three fixes were built — the plan's shape worked. What it did not do is let that ordering reach the fix card's CONTENT: MOTIR-3247 was authored with three concrete mechanisms and a contract sentence asserting the falsified premise, so a run that skipped the decision card would have built one of them against ready: true and a green validate_work_item.

Acceptance criteria

  • The rule (or lesson) says: a card whose FIX SPACE is derived from a claim about runtime behaviour cites the measurement, or names the measurement as its blocker's deliverable and states no mechanism of its own. A code comment, however careful, is a claim.
  • The corollary is covered too: when a decision card is a blocker, the blocked card carries the QUESTION rather than pre-committed answers — the answer is the blocker's output, and enumerating candidates in the dependent's body is what survives the blocker being answered differently.
  • The existing rules are checked before a new one is written — this may be a sharpening of the precondition-verification rule (plan-rules/phase-deepen.md) rather than a new gate.

Evidence

  • docs/decisions/job-lane-occupancy.md §1 (measurement + control), §2 (the arithmetic), §4 (the ranking of the three planned remedies) — on branch subtask/MOTIR-3246-sleep-slot-decision, PR motir-core#2259, not yet merged to main at filing time.
  • scripts/experiments/inngest-sleep-concurrency.mjs — the harness, two trials per arm, reproducing to the millisecond.
  • The three files that carried the sentence: codeGraphRefresh.ts, indexFleetSteps.ts, and codeGraphIndex.tsthe third was missed by the first correction (motir-core#2235) and is where the sentence was first written, which is its own small instance of the same class: a claim corrected at two of its three homes is a claim that gets re-derived from the third.