Skip to content

fix: error_rate in incident #1 - #6

Merged
1816x merged 1 commit into
demo/b1-8f2e079from
fix/incident-1
Jul 31, 2026
Merged

1816x merged 1 commit into
demo/b1-8f2e079from
fix/incident-1

Conversation

@1816x

@1816x 1816x commented Jul 31, 2026 •

Copy link
Copy Markdown
Owner

Automated fix for incident #1 (error_rate).

What the monitor saw

  • Kind: error_rate
  • Window: 2026-07-31T16:20:50Z → 2026-07-31T16:21:08Z
  • Times fired: 7
  • Summary: 5 errors across 1 route(s)

Root cause

PRICE_CENTS_BY_ID is built with str(p["id"]) as its keys, while validation checks the incoming product_id against KNOWN_IDS, which holds the raw ints. A request with a valid integer id therefore passes validation and then misses the price table, raising KeyError. Because the miss happens after validation succeeds, every well-formed checkout fails with an unhandled 500 rather than a 4xx.

Suspect commit: HEAD

Why this fix

Key the price table by the same type validation checks against, so a value that passes KNOWN_IDS cannot miss PRICE_CENTS_BY_ID. Fixing the key type addresses the mismatch itself; coercing at the call site or catching KeyError would only hide it while leaving the two structures disagreeing.

What was verified

  • Applied to a throwaway checkout of demo/b1-8f2e079: yes
  • Demo app tests before the patch: failed
  • Demo app tests after the patch: passed
  • The suite was red before this diff and green after it, so the change is demonstrably responsible for the difference.

Provenance

  • Diagnosis replayed from a hand-authored transcript — these turns are scripted, not model output.
  • Tools used: read_logs, git_log_recent, git_blame, read_source
  • Model turns: 5

Opened by the self-healing agent. Nothing here was merged automatically — this branch exists for a human to review.

How this PR was submitted: the agent produced the branch, this body, and the validation evidence above on its own. The final POST /pulls went through the session's GitHub tooling rather than the agent's own HTTP call, because this sandbox's GITHUB_TOKEN is proxied and returns 403 for direct API calls. The agent handled that correctly — it recorded the incident as fix_validated with the error attached rather than discarding the validation result.

Base branch: demo/b1-8f2e079 carries the deliberately injected B1 bug (see scripts/inject_bug.sh). That is what makes this a real, mergeable fix rather than a diff against code the bug was never in. main never carries an injected bug.

@1816x
1816x force-pushed the fix/incident-1 branch 2 times, most recently from b1e97a4 to 6074d8f Compare July 31, 2026 16:28
Key the price table by the same type validation checks against, so a value that passes KNOWN_IDS cannot miss PRICE_CENTS_BY_ID. Fixing the key type addresses the mismatch itself; coercing at the call site or catching KeyError would only hide it while leaving the two structures disagreeing.
@1816x
1816x changed the base branch from demo/b1-97e70ad to demo/b1-8f2e079 July 31, 2026 16:34
1816x pushed a commit that referenced this pull request Jul 31, 2026
Marks F4 closed with the live verification that closes the MVP: PR #6,
a one-line B1 fix against demo/b1-8f2e079, all three CI jobs green.

The design-decisions entry covers why the injected bug had to be
published to its own branch (the MVP gate was literally unreachable
otherwise), why validation happens in a worktree cut from the PR's base
rather than HEAD, why red-before is recorded but not required, and why
the PR opener's guardrails are about blast radius rather than
correctness.

It also records what Phase 4 did not verify — the opener's own HTTP
request has never been accepted by GitHub, the same shape of gap as
Phase 3's unproven LiveCompleter — and the four defects the phase
surfaced, none of which were in the new code's happy path: a monitor that
died at startup under a concurrent reader, a Phase 3 transcript whose
diff could never have applied, a gate validating the wrong tree, and an
unbounded ruff that let CI and local machines disagree.

README and PLAN.md now state the narrowed injected-bug policy ("never to
main" rather than "never") instead of the old absolute, and document the
--dry-run-pr / --open-pr flow.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ED78yHTbDpHFfQ7n8tWja
@1816x
1816x merged commit 928409f into demo/b1-8f2e079 Jul 31, 2026
3 checks passed
@1816x 1816x mentioned this pull request Jul 31, 2026
1816x pushed a commit that referenced this pull request Jul 31, 2026
PR #6 was merged by a human reviewer into demo/b1-8f2e079, which is the
part of the loop worth stating explicitly: the agent investigates,
proposes, proves the fix turns the suite green, and stops. Nothing merges
itself.

PLAN.md and the README said only that the PR was opened with CI green.
True, but it undersold the outcome and left the human-gate design
decision implicit at exactly the point where it is demonstrated.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019ED78yHTbDpHFfQ7n8tWja
1816x pushed a commit that referenced this pull request Jul 31, 2026
What ships per layer, the MVP gate with PR #6 as its evidence, what
Phase 5 added, and the limitations — led by the one that has been open
since Phase 3: neither outward-facing API call has ever been made for
real.

The tag itself is not cut here. A release tag on an unmerged feature
branch would point at history main has never had, so `chore(release):
tag v0.1.0` belongs on the merge commit. PLAN.md's F5 checklist is
corrected to say so rather than claiming a tag that does not exist.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014MpBoJ5sHCxp2WCBQPQ4bh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant