Skip to content

fix: turn main green after three concurrent merges (#25937) - #25947

Merged
bolichen97 merged 1 commit into
mainfrom
fix/main-red-25937
Oct 29, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/main-red-25937

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Turn main green again: three backend tests fail on it after PRs that were each green alone merged within minutes of each other.

On main at d328624 these three fail on every OS, so every open PR's backend shards fail too:

  • test/test_dir_fd_create_race_ratchet.py::test_no_lock_file_is_created_with_a_nonexclusive_open
  • test/test_security_gate_liveness.py::test_the_package_stays_within_its_line_budget
  • test/test_subagent_prompt_hooks.py::test_hook_time_is_not_charged_to_the_first_prompt_watchdog

Why it matters

Every open PR is red on its backend shards until these pass, so nothing can land green.

Not a goal

  • No change to any security rule or to the security/ package's code.
  • No change to how sub-agent hooks fire or how the watchdog judges a run.
  • No loosening of the lock ratchet or its allow-list.

What changed (motivation → approach → change)

Red test Root cause Change
Lock ratchet #25591 added the ratchet while #25708, #23855 and others added four lock opens with O_CREAT and no O_EXCL, which can return ENOENT on Darwin when two callers race The four opens use platform_compat.open_create_or_existing, the race-safe helper the ratchet names
Security line budget #23499 raised the budget for its own growth; #25266 grew redaction.py by 10 lines and fit the old budget alone Budget re-measured to 32,909 with a recorded reason for the SRI-digest growth
Hook watchdog #25127 added a Stop hook fire after a child prompt ends; the test's probe ran in every fire, so it saw that third fire too The probe runs only in the two prompt-hook fires it is about

The four lock sites are cli_commands_secrets.py (_handle_secrets_authorize), history_locks.py (_try_acquire_named_sidecar), template_mcp_additions.py (_locked) and workflows/library.py (create). Each keeps its other flags (O_NOFOLLOW, O_NONBLOCK), its mode and its fstat checks. The watchdog code is right: a Stop hook runs after the first prompt, outside the prompt-hook window.

Backwards compatibility

Compatible: each lock file is still created owner-only when absent and opened when present; only the create step is now exclusive.
Removes nothing: no path, key, record or function goes away.

Tests

The three node ids above fail on main at d328624 and pass on this head. Related suites pass: secrets authorize, template MCP additions, workflows library and service, history locking and bindings, staging sweep, the full ratchet, liveness and prompt-hook files (800 tests).

Proof: not provable -- other: the lock fix is guarded by the unchanged ratchet test, red on main and green here

Manual verification

N/A — the failing tests are the check, and they run in CI.

Related Issues

Closes #25937

Sibling sweep

Swept: the lock ratchet's own scan of src/kiro_crew/ for os.open of a lock path with O_CREAT and no O_EXCL
Sibling: src/kiro_crew/sel_append.py -- not affected -- on the ratchet's allow-list, it opens the SEL data file under the chain lock

Pattern harvest

Not generalizable: each red is a merge race between PRs that were green alone; the ratchet and budget tests already catch the class.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners October 29, 2026 20:47
@bolichen97
bolichen97 requested a review from mbriones98 October 29, 2026 20:47
@bolichen97
bolichen97 enabled auto-merge (squash) October 29, 2026 20:47
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 29, 2026

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Kiro Crew Auto-Pipeline [operator: buluoray]:

Approving at a13e48f. An independent fix for the same three main reds reached the same diff: the four lock sites go through platform_compat.open_create_or_existing with O_CREAT dropped and O_NOFOLLOW/O_NONBLOCK kept; the security budget moves to the measured 32,909 with the reason (#25266 landed on top of #23499's raise); and the hook test only calls on_fire for the two prompt events, since #25127's Stop fire runs after the watchdog window. Reproduced both test reds on d328624 and saw 85 passed on the fixed tree for the ratchet, liveness and facade-mirror tests. Note: subagent_manager/run_turn.py is still 2,030 lines on main; #25950 splits it and will be rebased onto this.

@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision a13e48f0e9f0acb740fc9bd7afd0f84098db691e touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of a13e48f0e9f0acb740fc9bd7afd0f84098db691e — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks: each of the three items fixes one red test on main. The lock fix uses the existing helper the ratchet names, and the test edits are scoped to what each test asserts.

What this change ships

Inventory (3 items) — 3 justified

Intent: get main green again so open PRs can land. FIX.

  1. Four lock-sidecar opens (secrets authorize, history sidecar, template MCP additions, workflow library) now create the file exclusively and fall back to opening the existing one, through platform_compat.open_create_or_existing. This removes the create race on Darwin. — justified
  2. The security package line budget goes from 32,899 to 32,909, with a recorded reason for the SRI-digest hold in redaction.py. — justified
  3. The sub-agent prompt-hook watchdog test's probe now runs only on AgentSpawn and UserPromptSubmit fires, not on the later Stop fire. — justified

[FIRST-PRINCIPLES-REVIEWED] a13e48f

Description read

[DESCRIPTION-READ] 3c6780304188c0cd0ea5ee57ffa2fe13b67ea36516a77cfdbabfe87be7cb0f6c

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of a13e48f0e9f0acb740fc9bd7afd0f84098db691e — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. Each red test is traced to the merge that caused it, and each fix is the smallest one that works: the race-safe open helper the ratchet already names, a budget re-measured with a reason, and a probe limited to the two hook fires the test is about.

Notes

  • Raising _PACKAGE_LINE_BUDGET after a merge race only re-measures the package; it does not judge whether redaction.py's 10 extra lines belong there. The comment records why it grew, which is enough for this PR.

[DESIGN-REVIEWED] a13e48f

Description read

[DESCRIPTION-READ] fbbc24d9fd94b29487ab37a769cceca50f6ed699aed71c71b4692cfccd3d3d65

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed a13e48f0e9f0acb740fc9bd7afd0f84098db691e — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] a13e48f

Verdict parsed from the review's SHA-scoped output markers for commit a13e48f0e9f0acb740fc9bd7afd0f84098db691e.

False positive or not applicable? A repository writer can comment:
/ai-review override fable a13e48f0e9f0acb740fc9bd7afd0f84098db691e false-positive: <reason, 20 to 500 characters>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of a13e48f0e9f0acb740fc9bd7afd0f84098db691e and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] a13e48f

False positive or not applicable? A repository writer can comment:
/ai-review override gpt a13e48f0e9f0acb740fc9bd7afd0f84098db691e false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 29, 2026
@bolichen97
bolichen97 merged commit 7e09632 into main Oct 29, 2026
94 checks passed
@bolichen97
bolichen97 deleted the fix/main-red-25937 branch October 29, 2026 21:50
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 29, 2026
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.

main red: three backend tests fail after concurrent merges (lock ratchet, security line budget, subagent hook watchdog)

2 participants