Skip to content

fix: backport the boot, crash and data-loss fixes to release/0.8.0 - #15634

Merged
bolichen97 merged 1 commit into
release/0.8.0from
backport/0.8.0-crash-data-loss
Oct 1, 2026
Merged

bolichen97 merged 1 commit into
release/0.8.0from
backport/0.8.0-crash-data-loss

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On a 0.8.0.x build, the gateway no longer dies on a laptop resume or on a denied mise candidate, and no longer destroys the SEL key, the shared OMC ledger or a user's standing lesson rule. main already fixes all five.

Backport of 5 P0 fixes, all merged on main (root causes and designs are in each source PR):

Why it matters

0.8.0.x is on the stable channel, and insider.3 / 0.8.0.4 are built from it. Each row is a P0 in the 2026-09-30 backport triage.

Not a goal

  • Anything beyond the 5 source PRs as merged on main. No version bump, no CHANGELOG.md.

What changed (motivation → approach → change)

git cherry-pick -x of each source in main's merge order onto the current release/0.8.0 (a68fbe9). The picks have five different authors, so PR Hygiene's two-commit cap means one commit. It keeps every source's subject and (cherry picked from commit …) line, plus a Co-authored-by for each author. Merge commits: 998b045, 1d37ab1, b8ea16b, e054c95, dd5e840.

Four picked cleanly. One conflict, docs only: #15070's docs/system-specs/modules/memory-skills-hooks.md. The "Crossing a budget…" paragraph differs between release and main earlier on, because main-only #15161 changed the lesson-ranking sentences. I applied #15070's own rewritten span (the contradiction-verdict sentences, located by the source's common prefix and suffix) to release's paragraph and left release's ranking text alone. Every other +/- line of every pick equals its source's.

Backwards compatibility

Same as the source PRs.

Tests

The source PRs' own tests, unchanged. Every touched test file: 1108 passed, 2 skipped, 3 failed. The 3 failures are #14302's new test_loop_watchdog.py end-to-end alarm tests (test_real_stall_ends_the_process_by_the_alarm and two siblings). They fail identically on main HEAD (6697253) on this host, where the child exits 1 instead of on SIGALRM. They are a host artifact, not a backport defect. Regression proof: with each pick's source reverted and its tests kept, every source's tests fail (#13308 13, #14302 4 + 1 error, #14860 1, #14961 2, #15070 2). black baseline, subprocess-encoding, isort, flake8 and mypy (0 issues) pass.

Related Issues

Backport of #13308, #14302, #14860, #14961 and #15070 to release/0.8.0.

Pattern harvest

Not generalizable here: each source PR carries its own harvest.

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

Contribution License Agreement

Backport of #13308, #14302, #14860, #14961, #15070 to release/0.8.0, cherry-picked in main's merge order.

* fix(sel): anchor the chain lock on the log directory (#13308)
  (cherry picked from commit 998b045)
* fix(watchdog): decide the loop-stall exit on the monotonic clock (#14302)
  (cherry picked from commit 1d37ab1)
* fix(ops-mission-control): strict read in ledger resolve_conflict (#14860)
  (cherry picked from commit b8ea16b)
* fix(env): skip a mise candidate whose probe is denied instead of aborting boot (#14961)
  (cherry picked from commit e054c95)
* fix(lessons): retire only a finding on a contradiction verdict (#15070)
  (cherry picked from commit dd5e840)
@bolichen97
bolichen97 requested a review from a team as a code owner October 1, 2026 00:53
@bolichen97
bolichen97 requested review from dodgeblaster and removed request for a team October 1, 2026 00:53
@bolichen97
bolichen97 merged commit 8fcf100 into release/0.8.0 Oct 1, 2026
17 of 19 checks passed
@bolichen97
bolichen97 deleted the backport/0.8.0-crash-data-loss branch October 1, 2026 00:53
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of e09062d9c4564c2d0b816260a6226025dab4527e — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Confirm release-branch CI runs the three test_loop_watchdog.py alarm tests green, since the author's host could not.

[DESIGN-REVIEWED] e09062d

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of e09062d9c4564c2d0b816260a6226025dab4527e — 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/CONCERNS are advisory.

First-Principles-Verdict: PASS

Verify the fidelity claim: this reviewer cannot read the five source commits, so "every +/- line equals its source's" and the hand-merged memory-skills-hooks.md span rest on the author's word.

Every hunk in the diff maps to one of the five named source PRs; nothing ships beyond them (no CHANGELOG, no version bump, matching ## Not a goal). Each defect's provenance is checkable: a merged main PR, a linked issue (#7077), and tests this PR carries that the author reports fail with each pick reverted. The fixes reuse existing mechanisms rather than minting new ones — resolve_conflict moves onto the pre-existing read_entries_for_update (ledger.py:213), the sweep guard onto the pre-existing _candidate_applies (cron.py:310, fail-safe to the protected side). boottime_now's move into platform_compat is forced by the agent-SDK boundary gate (application code may not import from kiro_crew.acp) and keeps a re-export for the 5 existing acp-side importers I counted (grep boottime_now, 6 files). The rewritten sel.py and cron.py pins are reversed with the evidence stated in place, not on symmetry.

What this change ships

Inventory (10 items) — 10 justified

Intent: FIX — backport five merged P0 fixes from main onto release/0.8.0 so a stable-channel gateway stops dying on resume or a denied mise probe and stops destroying the SEL key, the shared OMC ledger, or a standing lesson rule.

  1. A laptop resume no longer kills the gateway: the stall exit moved onto the kernel alarm, which pauses through a suspend — justified
  2. A host suspend is now reported once at INFO instead of silently — justified
  3. An in-app restart can no longer end the successor gateway with an inherited alarm (exec seams cancel it; the entrypoint disarms) — justified
  4. A short legacy SEL key beside a usable migrated one now fails init with a named remedy instead of destroying the signing key — justified
  5. The SEL chain lock no longer follows the key's location and never creates a file at the key path — removes the cause that minted the 0-byte key — justified
  6. A transient read fault in OMC conflict resolution now raises and skips the sync instead of truncating and pushing the team's ledger — justified
  7. A permission-denied mise candidate is skipped like a missing one instead of aborting gateway boot — justified
  8. The background contradiction sweep can no longer delete a standing or unstated lesson rule, whatever tier the submission carries — justified
  9. boottime_now moved from acp/liveness to platform_compat, re-exported for existing importers — justified
  10. The watchdog startup line now names which mechanism carries the exit — justified

[FIRST-PRINCIPLES-REVIEWED] e09062d

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — 🔴 changes requested (blocking)

GPT 5.6 found at least one blocking issue that must be resolved before merging e09062d9c4564c2d0b816260a6226025dab4527e. 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/sel.py:3672 -- Windows leaves the chain-lock directory swappable
if not _PIN_BY_FD_SUPPORTED: return None
Writable trust renamed and replaced with a junction -> _chain_lock opens different sidecars -> concurrent writers corrupt the SEL chain.
Anchor: residual/security
Fix: Hold platform_compat.pin_directory(path) through the absolute sidecar open on Windows.
[BLOCK-MERGE] e09062d
[GPT-REVIEWED] e09062d

Adjudication (Opus 5) — is blocking on each finding proportionate?

UNBOUNDED as written (audit-chain corruption), but subsumed: the same actor already holds the signing key.
Conditions confirmed: _PIN_BY_FD_SUPPORTED is False on Windows (sel.py:3288, requires O_DIRECTORY + supports_dir_fd), so _pin_lock_dir returns None (sel.py:3672) and the sidecar is opened by name after the probe at sel.py:970; the swap needs write on trust's parent, and Windows has no sandbox backend at all (sandbox.py:12279), while trust/sel_hmac.key are read-write to a sandboxed process even on POSIX (sandbox.py:752-763) — so that actor can read the key the chain is signed and verified with (sel.py:2344, sel.py:2921) and re-sign an arbitrary chain, which strictly dominates forking it. Recovery: none for the fork; verify_integrity reports the divergence (sel.py:2921-2922), so it is loud but history must be rebuilt. This is the identical rationale the module already carries for the legacy-key path (sel.py:927-932) and the residual the Windows branch documents (sel.py:3665-3670).
Real fix is cheap and ready-made — hold platform_compat.pin_directory (platform_compat.py:7214-7254, whose Windows branch pins by omitting FILE_SHARE_DELETE for exactly this rename-and-plant threat) across the open — which is why this is a FLAG rather than an argument that no fix exists.

[ADJUDICATION] e09062d9c4564c2d0b816260a6226025dab4527e total=0 uphold=0 downgrade=0
[GPT-ADJUDICATED] e09062d9c4564c2d0b816260a6226025dab4527e

[ADJUDICATION-FENCED] e09062d9c4564c2d0b816260a6226025dab4527e fenced=1 flagged=1
FLAG F1 src/kiro_crew/sel.py:3672 -- Reaching this race requires an actor with write access to `trust`'s parent on Windows, where no OS sandbox backend exists (sandbox.py:12279) and `trust`/`sel_hmac.key` are read-write leaves (sandbox.py:752-763); that actor can read the HMAC key the chain is signed and verified with (sel.py:2344, sel.py:2921) and forge any chain outright, which strictly dominates forking it — the same residual the module already accepts for the legacy-key path (sel.py:927-932) and the Windows split `_SegmentDirPin` already carries, with `verify_integrity` reporting the divergence rather than hiding it.
[GPT-ADJUDICATED-FENCED] e09062d9c4564c2d0b816260a6226025dab4527e

🏷️ Fenced finding(s) machine-flagged as likely edge case

The security fence keeps these findings blocking regardless of adjudication; the only clearance path is a human override. The annotate-only pass judged the condition combination each one requires extreme, and pre-drafted the override rationale below. A repository writer must independently verify a rationale before posting it — it is machine-authored, and a wrong override on a security-class finding ships exactly the class the fence exists to stop.

  • F1 src/kiro_crew/sel.py:3672 — Reaching this race requires an actor with write access to trust's parent on Windows, where no OS sandbox backend exists (sandbox.py:12279) and trust/sel_hmac.key are read-write leaves (sandbox.py:752-763); that actor can read the HMAC key the chain is signed and verified with (sel.py:2344, sel.py:2921) and forge any chain outright, which strictly dominates forking it — the same residual the module already accepts for the legacy-key path (sel.py:927-932) and the Windows split _SegmentDirPin already carries, with verify_integrity reporting the divergence rather than hiding it.

    /ai-review override gpt e09062d9c4564c2d0b816260a6226025dab4527e: Reaching this race requires an actor with write access to trust's parent on Windows, where no OS sandbox backend exists (sandbox.py:12279) and trust/sel_hmac.key are read-write leaves (sandbox.py:752-763); that actor can read the HMAC key the chain is signed and verified with (sel.py:2344, sel.py:2921) and forge any chain outright, which strictly dominates forking it — the same residual the module already accepts for the legacy-key path (sel.py:927-932) and the Windows split _SegmentDirPin already carries, with verify_integrity reporting the divergence rather than hiding it.
    

False positive or not applicable? A repository writer can comment:
/ai-review override gpt e09062d9c4564c2d0b816260a6226025dab4527e: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

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

Review details

One advisory finding: the new pre-exec alarm cancel is unconditional, so it clears a deadline the process may not own.

FINDING — src/kiro_crew/platform_compat.py:87 — _disarm_process_alarm_before_exec's bare arm_process_alarm(0.0) cancels ITIMER_REAL with no ownership check, so a pytest worker reaching either reexec seam with os.execv patched (test_platform_compat.py's TestReexecPythonModule, which leaves the real signal.setitimer in place) loses pytest-timeout's --timeout=120 signal-method deadline and a later hang becomes an unbounded, un-killable run instead of a failed test → Fix: cancel only while signal.getsignal(signal.SIGALRM) is signal.SIG_DFL, the same ownership rule the sibling loop_watchdog.disarm_inherited_alarm already applies.

[OPUS-REVIEWED] e09062d

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable e09062d9c4564c2d0b816260a6226025dab4527e: <one-sentence reason>

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