Skip to content

feat(crew-log): resume a session fold from a savepoint on disk - #12030

Merged
iamwhatever merged 1 commit into
mainfrom
feat/crew-log-fold-checkpoints
Sep 20, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
feat/crew-log-fold-checkpoints

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Open a long-running session's side panel and the gateway reads that session's
whole crew log to answer it. Every projection (status, usage, timeline,
tools, approvals) is a fold from entry 1, so a session with a long history
costs more to look at than a fresh one, and it costs that again on every refresh.

The live push already avoids this for sessions it is watching, by keeping the
fold state in memory. That memory dies with the process and holds only a bounded
number of sessions, so a gateway restart and a cache eviction each go back to
reading the whole file.

Why it matters

The panel gets slower the longer you use a session, which is backwards: the
sessions worth looking at are the ones that have been running. A 10,001-entry log
takes 184.4 ms to fold, and that is one session, one refresh, on a warm page
cache. The projection route holds a worker thread for the whole read, so a few
long sessions refreshing together spend real gateway capacity re-deriving numbers
that did not change.

What changed (motivation -> approach -> change)

Folding is cheap per entry and unbounded in total, so the fix is not to fold
faster. It is to stop folding from the start. The fold surface was already built
for this: a Checkpoint is (name, seq, state), JSON-serializable, and the
module's own docstring called that shape "what a later checkpoint file would
carry". It just had nowhere to live.

Now it does. src/kiro_crew/crew_log/checkpoint.py writes each fold's state
beside the log it came from, one file per fold, at the layout the RFC's section 3
names:

<store dir>/projections/<fold>.json
{"v", "unit", "origin", "first_seq", "fold", "seq", "prefix_sha", "prefix_records", "state"}

src/kiro_crew/crew_log/projection.py resumes from it instead of from entry 1,
and docs/system-specs/modules/crew-log-projection.md records the layout, the
retirement rules and what is deliberately left out. The same 10,001-entry log now
answers from 24 KB of files instead of refolding, and the read verifies the bytes it is skipping. The honest figures, re-measured on one host after the digest guard landed, best of five: 184.4 ms to fold cold, 44.8 ms to resume with nothing new to fold, 105.5 ms with a short tail, and 197.1 ms on the read that also earns a new savepoint. So the win on the reads that dominate is roughly 1.7x to 4x, not an order of magnitude, and a write-earning resume costs about what folding cold costs. An earlier version of this sentence quoted 19.6 ms of hashing against a 343.6 ms cold fold and called the guard 6% of the work it protects; that compared the guard against the read it does NOT run on, and the 343.6 ms also disagreed with the 99.5 ms this description used elsewhere for the same log. Both are replaced by the one run above. State the limit plainly: a savepoint saves the FOLD work, not the parse. iter_from drops entries below the requested seq after constructing them, so a resumed read that has anything to fold still decodes the prefix it skips folding, and the digest adds hashing passes over those bytes -- one on the way in, one after the pass, and two more when a write is earned. A read is not independent of log size. One file per fold rather than one for all
five, so a payload this build cannot read costs that fold its savepoint instead
of costing all of them.

decision why
Disposable Every failure, whether no file, a truncated one, a payload from a newer build, or a store the file does not describe, falls back to folding from entry 1, which reaches the same value at more cost. load and save never raise.
Allowed to lag A savepoint is written only once the fold has advanced 256 entries past it. Resuming from an older one replays the tail and reaches the same value, so writing more often would relocate the cost rather than remove it. A short session leaves no file at all.
A verified consumed prefix The savepoint carries prefix_sha and prefix_records, and a resume recomputes the digest before trusting the file. Without it the module's promise rests on an assumption STRONGER than the store's own posture: _iter_entries skips a damaged interior line on purpose, so a cold fold omits that entry while a savepoint written before the damage keeps the value it folded, and the savepoint is the one that looks clean. The digest is over raw record bytes and decodes no JSON, which is why it is affordable; it counts records rather than reading seqs, because reading a seq means decoding its line. New public helper CrewLog.raw_prefix_digest in store.py, one consumer: crew_log/checkpoint.py.
The digest is read BEFORE the pass A digest read at write time covers whatever the file holds THEN, which need not be what the fold consumed. A consumed record that changed in between would be hashed together with state folded from its earlier value, and because the recorded digest and the recorded state then agree with EACH OTHER, every later resume recomputes those same changed bytes, matches, and serves state a cold fold disagrees with, for the life of the unit, since nothing rechecks a digest that verifies. So the fold reads the digest before it consumes anything, rechecks it after the pass alongside the identity, and the write persists the value it was handed instead of taking one of its own. A pass that ends at some other boundary, because the file grew under it or because its handle's own seq was stale, matches no fold in the bundle and writes nothing: that costs the savepoint, never the answer the read serves.
Only a read that folded the prefix may write The custody a digest gives has to reach across calls, not just across a pass. A read resuming from DISK has it transitively: the savepoint records the digest its own writer read before folding, and the resume rechecks that recording. A since= bundle records no digest -- SessionProjections has no such field -- and the bytes below its seq were consumed by a call that already returned, so a digest taken now is honest about the file and wrong about the state beside it. Those two would then agree with each other, every later resume would recompute the same bytes, match, and serve that state for the life of the unit. So an incremental read takes no witness and save writes nothing without one. The cost is that the dashboard push loop's cached sessions bring their savepoint forward on the next read that folds the prefix rather than on every publish, which is the lag the row above already accepts.
Three cheaper retirement checks The log's creation identity, the oldest surviving segment's first sequence number, and a log shorter than the savepoint. Each catches a case where a resumed fold and a fold-from-scratch would disagree, which is the equality the module promises.
Checked again after the pass Reading entries opens the log by name, so a unit deleted and recreated mid-read hands the fold another file's entries. The sequence numbers do not say so, because a recreated log starts its own again. A change makes the fold untrustworthy, so it is folded again; twice in a row reports the identity as unknown, which is what stops the value being reused or written.
Written through the unit's lease Deletion takes that lease exclusively, and the lease refuses an exclusive claim while a shared one is held. So a reader holding a shared one cannot have a deletion run underneath it, and a deletion already in progress refuses the reader instead.
One spelling of "same log" The identity the savepoint compares is the one SessionProjections.origin already compares, so projection.py's private _log_origin is RENAMED to public log_origin for checkpoint.py to import. That is the whole of the rename, and it is one new public name with one consumer: two spellings of "same log" could disagree, and the lenient one would fold a retired file's state onto a live file's bytes.
A fold change retires savepoints The version number and the state-shape check both guard the payload's SHAPE, so the case neither sees is a fold whose meaning changes while its keys do not, which is what a counting fix looks like. The rule is that such a change bumps CHECKPOINT_VERSION, and a test digests each fold's stored state so forgetting the bump fails CI rather than serving pre-fix numbers for the life of a session. One global number over a per-fold one is deliberate: it over-retires, and over-retiring costs a refold while under-retiring serves a wrong number.
Nothing survives a deleted unit Establishing the identity reads the newest segment, so a deleted unit is refused before the lease, which would otherwise put a lease file into a directory deletion had emptied. After the write, a unit with no history has everything just written removed again, its directory included: the atomic write creates its target's parents, so a write that landed late rebuilds that directory, and nothing else collects an empty one.

New public surface, declared with its consumers because every name here is one that
two spellings could disagree about. In store.py: CrewLog.raw_prefix_digest,
CrewLog.raw_records_through and unit_header_created_at. In checkpoint.py:
resumed_prefix_still_verifies, prefix_witness, prefix_unchanged,
write_is_earned, and the PrefixWitness those last three carry. One importing
module each, measured rather than assumed: the store's three are imported only by
crew_log/checkpoint.py and crew_log/projection.py, and the savepoint module's five
only by crew_log/projection.py. save also gains a keyword-only prefix with NO
default, deliberately: a caller that omits it would write no savepoint, which is the
safe answer, but a caller should have to say which digest it means rather than inherit
one.

No flush per write. A savepoint a crash leaves unwritten is an older savepoint or
no savepoint, and folding further answers both, so the rename's atomicity is all
this needs. The payload escapes every non-ASCII character, because a crew log's
own JSON admits a lone surrogate and a serializer that passes one through makes
the encode fail.

The savepoint directory sits inside the crew log tree, which is already hidden
from a sandboxed process and refused to the agent's file tools, so it needs no
protection of its own. The store reads its segments by name and ignores every
other neighbour, and deleting a unit deletes its whole directory.

Backwards compatibility

Compatible: the savepoints are new files that nothing reads yet, and a read with
none behaves exactly as it does today. fold_session keeps its existing signature
and gains no parameter; resuming is unconditional, and a caller that wants the
from-scratch answer already has fold and advance, which are that answer.

Tests

test/test_crew_log_checkpoint.py, 44 tests. The load-bearing one is that a
resumed fold equals a cold fold, asserted on all five projections and on the
sequence the resumed read starts from, so a test cannot pass by quietly re-reading
the file.

The rest are reasons NOT to resume, each asserted by the fold still landing on the
cold answer: a savepoint past the log's end, one whose front moved, one from a
recreated log, one naming another fold or another unit, one from a newer build,
one that is truncated, one over the size cap, and one whose state is not shaped
like the fold it claims. That last check is NEW here, not pre-existing: this PR
adds _state_matches_fold, because a savepoint is the first thing that ever fed
fold state in from outside the process, and without it a wrong-shape state resumed
and failed inside the fold's own step. It lives on Checkpoint.from_dict, so the
one other caller that parses stored state gets it too, and the savepoint loader is
its only production caller today.
Then the write rules: a short session leaves no file, a small
growth rewrites nothing, one requested fold writes one file, a lone surrogate
round-trips, a reader holding no shared claim on the unit writes nothing, a unit
whose history is gone is not touched at all, and a savepoint written as a unit
disappears is removed again with its directory.

Two cover the incremental read specifically. One asserts that a read reusing a
since= bundle leaves the savepoint on disk exactly where it was, even with a tail
long enough that a write would otherwise be owed. The other shows why: with a
consumed record altered below the cached bundle's seq, a later read still agrees
with a cold fold, instead of resuming from a savepoint whose digest and whose state
describe different bytes. The second one folds usage rather than status because
that is the fold which READS the altered value -- against status it passes with
the fix reverted, which is a mistake an earlier test in this file made.

One test guards the guards rather than the code: it digests what each fold stores over a fixed script with the clock frozen, so a fold whose meaning changes while its keys do not reddens CI and the failure names the version bump that retires the savepoints written before it.

Every guard was mutation-verified: removing it makes a named test fail. The run is
in a PR comment.

Manual verification

N/A: unit coverage sufficient. The read path has no UI in this change, and the
timing figures quoted above come from folding a generated 10,001-entry log both
ways in one process.

Related Issues

no linked issue: this is the fold-checkpoint work item from the crew log plan, not
a reported defect.

@chenmingwei23
chenmingwei23 requested review from a team and bolichen97 September 19, 2026 13:35
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 19, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Intent: Stop a session's side panel costing more the longer the session has run, by writing each crew-log fold's resumable state beside the log and resuming from it, so a read pays for the entries that arrived rather than for the whole history.

Not a goal: any new fold, any change to what a fold computes, any UI, and any change to the crew log's own format. The savepoints stay disposable: a read with no usable savepoint must behave exactly as it does today.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Mutation verification for the savepoint guards. Each row removes ONE guard this PR adds and re-runs test/test_crew_log_checkpoint.py; a guard whose removal no test notices would be a guard with no test behind it.

baseline: green

caught    serializer escapes non-ASCII
caught    savepoint write takes the unit lease
caught    a removed unit is not touched before the lease
caught    a savepoint from another log is rejected
caught    a savepoint past the log's end is rejected
caught    a recreated unit directory is torn down
caught    the log's identity is rechecked after the pass

all 7 mutations caught

Two guards were REMOVED during this check rather than given a test, because no single-line mutation of either changed an observable outcome: establishing the log's identity already stats the newest segment, so a separate pre-lease segment check was unreachable, and the post-write discard already enforces the outcome a second under-lease recheck was guarding.

@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of 85baec8d9dec9f349a99133c7317f9cb0f87b4e7 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 85baec8

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

@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of 85baec8d9dec9f349a99133c7317f9cb0f87b4e7 — 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 digest trade on real logs: an idle resume spends nearly all its 44.8 ms hashing, so the shipped win is 1.7–4x, not the RFC's "never replays".

What this change ships

Inventory (10 items) — 10 justified

Intent: stop session side-panel reads from costing the session's whole history on every refresh, restart and cache eviction — an ADDITION, decided by rfc-append-only-ledger.md NFR-1/section 3 (in-progress on base) and motivated by a measured 184.4 ms fold.

  1. Panel reads resume from a savepoint instead of refolding from entry 1 — justified
  2. New projections/<fold>.json files persisted inside each session's fenced crew-log directory, automatically, no switch — justified
  3. A resumed read hashes the bytes it skips, before and after the pass, so read cost still scales with log size — justified
  4. Savepoints lag 256 entries; short sessions leave no file — justified
  5. Reads reusing a cached bundle (since=) serve but never persist — justified
  6. A log recreated under a held handle is refolded instead of splicing old state onto new bytes (existing since= reuse bug, pinned by a new test) — justified
  7. Two identity changes in one read report the origin unknown; the value is still served — justified
  8. Checkpoint.from_dict now rejects state whose shape does not match its fold (0 production consumers on base; grepped Checkpoint.from_dict) — justified
  9. New public helpers raw_prefix_digest (1 consuming module), raw_records_through (1), unit_header_created_at (1), log_origin public (2) — counted, each the feature's own seam — justified
  10. Spec section 7 rewritten from "deliberately not here" to the savepoint contract, same commit (mandated; the replaced text itself called persistence "additive", so no pin reversed) — justified

[FIRST-PRINCIPLES-REVIEWED] 85baec8

@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

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

Design-Verdict: PASS

Verify the win survives real session lengths: every resume rehashes the whole prefix, so the 1.7–4x measured at 10k entries decays as logs grow.

Suggestions

  • Skip resumed_prefix_still_verifies when the pass folded zero entries — load verified the same digest microseconds earlier, and the recheck is half of the 44.8 ms no-tail resume, the read that dominates panel refreshes.
  • Memoize the verified witness in-process keyed by (origin, prefix_records, prefix_sha) so repeated projection-route reads of an unchanged prefix hash it once per gateway lifetime instead of twice per read — that, not the fold, is now the dominant per-read cost the PR set out to remove.

[DESIGN-REVIEWED] 85baec8

@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 85baec8

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

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

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 19, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/crew-log-fold-checkpoints branch from 8e72c00 to 14c5438 Compare September 19, 2026 13:57
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 19, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/crew-log-fold-checkpoints branch from 14c5438 to 8c93d44 Compare September 19, 2026 14:24
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 19, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: the identity is now re-read on every exit of a fold attempt, not only the exit that consumed entries

  • unchanged-tail resume skips the identity recheck (span=edc024cbb4a9)

fixed in 8c93d44. Confirmed, and my own
comment on that line was reasoning about the wrong thing: it said nothing can
have been read from the wrong file, which is true, but the bundle still
DESCRIBES the identity read before the check and carries that origin outward.
The from_seq > last_seq exit returned a literal True for stability while the
other exit compared log_origin(handle) against the value read at entry, so a
unit recreated during the call was detected on one path and not the other.
That exit now returns the same comparison.
Self-added: the early exit and the recheck both arrived in this PR, in the round
that introduced the after-the-pass check, so this is an incomplete fix of my own
rather than pre-existing behaviour.
Pinned by test_an_unchanged_tail_still_rechecks_the_log_identity, which proves
the resumed pass reads NOTHING and that the mismatch is what forces the single
cold read from seq 1; with the recheck removed the test sees no read at all.
Mutation-verified: replacing the comparison with True fails that test.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: a checkpoint payload's state is now validated against the registered fold's own declared shape, not merely required to be an object

  • malformed fold state is accepted (span=9b7601c8f0b3)

fixed in 8c93d44. Confirmed. _checkpoint_from
validated the envelope (v, unit, fold, origin, first_seq, seq) and then handed
the state to Checkpoint.from_dict, which only required an object. A valid JSON
object of the WRONG SHAPE therefore resumed a fold, and the wrong shape
detonated later inside that fold's step or render -- so load's never-raise
promise held for the envelope alone, and the failure surfaced from the
projection route instead of falling back to a cold fold.
The fold registry already declares the shape, so the check has a real basis
rather than a hand-written schema: _state_matches_fold requires the top-level
key set to equal _FOLDS[name].start()'s. Value kinds are constrained only
where that is sound -- bool tested before int, since isinstance(True, int) is
true; numbers excluding bool; containers by kind -- and a start value of None
constrains nothing, because those fields legitimately hold another JSON kind
once the fold has run.
Placed in Checkpoint.from_dict rather than in the savepoint reader on purpose:
it is the one shared validation for a checkpoint payload, the registry is in the
same module, and the other caller that round-trips a checkpoint gains the same
guarantee. The strictness is forward-safe -- a fold that later gains a key
retires old savepoint files to a cold fold, which is the direction that cannot
serve a wrong answer.
Pinned by test_malformed_object_fold_state_reaches_the_cold_answer over an
empty object and a wrong-kind field, asserting the cold value and raising
nothing. Mutation-verified: removing the check fails that test.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 19, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/crew-log-fold-checkpoints branch from 8c93d44 to 297e3bb Compare September 19, 2026 14:41
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 19, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: none added; the residual is now stated in the owning spec's deliberately-not-here list with its cost

  • savepoint survives interior log corruption (span=9b7601c8f0b3)

needs-a-decision. The finding is CORRECT and I am not rebutting it as a false
positive. I verified the mechanism independently and it is stronger than the
finding states: store._iter_segments's own docstring says a missing seq inside
one file "means a damaged line, which _iter_entries skips on purpose -- one
unreadable record must not make the rest of the file unreadable". So a cold fold
silently OMITS a damaged interior entry while a resumed fold keeps the value it
folded before the damage, and the savepoint is the answer that looks clean. The
assumption this module states -- that a consumed entry cannot change -- is
therefore stronger than the store's actual posture, which tolerates interior
damage rather than refusing it.
What I cannot do is close it proportionately. The only sound check is an
immutable identity over the whole consumed prefix, verified on resume, which is
a hash over every consumed entry on every fold: the O(n) prefix re-read this
module exists to remove. I looked for a cheap sound alternative and there is
none -- size catches truncation but not an equal-length rewrite, and mtime cannot
separate an interior rewrite from an append, so any partial guard would invite
exactly the question of why it stops where it does.
Reaching the state needs out-of-band corruption of already-committed bytes: the
writer only appends, a torn final line sits ABOVE the savepoint's seq because
last_seq counts only complete entries, and retention removes whole front
segments, which moves first_seq and retires the file.
So the residual is now documented in crew-log-projection.md section 7 with the
mechanism, the reason the writer cannot produce it, and the cost of closing it,
rather than left for a later reader to rediscover.
This finding is security-fenced, so the only clearance is a human override and I
will not self-authorize one. Question for a maintainer: accept a documented
divergence that needs out-of-band corruption to reach, or require the O(n)
prefix hash and give up the read-cost win this PR exists for? I recommend the
former. If you agree, the override belongs on the head the lane last stamped.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: resuming is now unconditional; the retry's non-resuming pass is a private argument on the internal attempt helper

  • Item 6, zero consumers: the checkpoint= kwarg has no production caller (span=8e2249f4a688)

fixed in 297e3bb, by the second clearance the
item names: the public kwarg is deleted and the tests reach the cold answer
through the existing surface.
Verified before acting rather than taken on faith. grep -rn "checkpoint=" over
src/kiro_crew returns no hit outside the module that defined it, and the only
two production callers of fold_session -- read_projection and the dashboard
publisher -- pass neither. 14 call sites existed, all in one test file.
The tests did not need a seam of their own, which is why no private one was
added: the from-scratch answer IS advance from initial, the module's own
documented whole-file form, so a test-local builder composes those two public
functions over iter_from(1). That oracle is strictly better than the flag it
replaces, because it no longer asks the function under test for the answer it is
being checked against, and a new test pins the builder against a real read.
One argument survives as PRIVATE on _fold_attempt: the retry forced by a
mid-pass identity change must not read a savepoint that describes the file which
just went away. That is an internal precondition with exactly one caller, not a
switch a consumer chooses.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 19, 2026
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 20, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Fixed: UPHOLD-FENCED F1 on 065556f5b7 (checkpoint.py:230, seq-arithmetic prefix_records under-counts raw records). The finding is correct and no override is wanted for it. New head 75af5821fe4821114ebc88a5ece22d11a3a831b0.

I measured the mechanism before fixing it, and the first test I wrote was too weak. On a log with one blank interior line: the blank IS a record to the raw framing, the savepoint's seq span is 273, the file holds 274 raw records, and the digest hashes 273 of them, so record 273 sits outside it. Then:

  • Making that last consumed record UNPARSEABLE is refused, but by the past-the-end guard, not the digest: dropping the record moves the file's last seq to 272, below the savepoint's 273. A test built that way passes while the gap stays open.
  • Keeping the record valid at the SAME seq and changing only a value inside it is ACCEPTED. credits on the final turn/completed went from 0.5 to 99.0 and verification passed.

So the exposure is real, and it is value-only damage to a trailing consumed record that reaches it.

The fix makes both sides count the same thing. The boundary is no longer derived as last_seq - first_seq + 1. CrewLog.raw_records_through(seq) walks raw records with the store's own framing and returns the index of the record carrying that seq, and the write path hands that count to raw_prefix_digest. The entry span and the record count now cannot drift apart, because only one of them is used.

That walk reads a seq, so it decodes a record per line. It is therefore called on the WRITE path only: a savepoint is written rarely, gated by MIN_ADVANCE_ENTRIES, and the reader is handed the resolved count, so verification stays decode-free and the measured figures are unchanged (343.6 ms cold fold, 19.6 ms whole-prefix hash). It returns None for a seq that is not a real boundary, and no savepoint is written then, which costs a cold fold rather than recording a boundary nothing can check.

The load-side cross-check moves from != to <. A raw count can legitimately exceed the entry span, by exactly one per blank or unparseable interior line. A count too large still cannot pass: the walk then hashes fewer records than claimed and the digest comparison refuses it.

Two tests, and each was mutation-verified in the direction it owns.

  • test_a_blank_interior_line_does_not_shorten_what_the_prefix_digest_covers inserts the blank line, folds, then changes a value in the last consumed record while keeping its seq, so identity, first seq and length all still match and the digest is the only guard left. It fails on the previous head. It also inserts rather than substitutes on purpose: replacing a record leaves the raw count equal to the seq span, the two counts agree, and the gap never opens.
  • test_a_savepoint_over_a_log_with_a_blank_interior_line_still_resumes pins the other direction, because the stricter-looking != fails CLOSED and would be invisible to a damage-only test. Restoring != reddens it with assert [1] == [274]: the fold silently reads from seq 1 instead of resuming at 274.

Spec corrected. The earlier revision justified the seq-arithmetic boundary by saying the log is append-only with contiguous seqs, so a count names the same boundary and a damaged line still occupies its slot. That was wrong, and the section now says so and says why: a substituted line does occupy its slot, but a skipped one is still a record to the raw walk.

Verified on this head: 480 tests across the savepoint, projection, core, retention and routes suites, plus 701 including emit. The repo black gate, isort, flake8, comment-history and changelog-history against origin/main, docs-lint and the brand check, all clean.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 20, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/crew-log-fold-checkpoints branch from 75af582 to 8f1a02a Compare September 20, 2026 04:38
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 20, 2026
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Classification of the 33 red lanes on 8f1a02a2075daa035a4d6fd5653b40c396f5c477: 32 are main-owned, 1 is this PR's.

The 32 are one import failure. src/kiro_crew/crew_log is not involved. src/kiro_crew/sandbox.py:1053 carries a module-level assertion that every sealed leaf has delegated-overlap wording, and on main three sealed leaves have none: decisions, member-memory-bindings, subagents. The assertion fires at import, so test/conftest.py cannot load and every pytest job exits 4 with ImportError while loading conftest. The desktop and Windows installer builds fail on the same AssertionError raised inside their bundled backend, which is why lanes that run no tests are red as well.

Reproduced with none of this PR's code present. A detached worktree at pristine origin/main (1fbffb1c7af9440a9af762a42ce22020d17cec11), running python -c "import kiro_crew.sandbox" with PYTHONPATH pointing at that worktree's src, raises the same AssertionError. Confirmed twice, at two successive main tips.

Introduced by 4ed7335d88 (#11556), which is newer than this head's base, and tracked as open issue #12182; #12183 and #12186 are closed duplicates. Nothing is folded in here and no sandbox.py line is touched by this branch.

Two things follow. A job rerun cannot clear it, because a pull_request run replays the merge ref resolved when the run was created. A rebase cannot clear it either while main still carries the assertion. So this PR waits for the main-side fix rather than pushing at it.

The one PR-owned red is GPT 5.6 Review. It stamped this head at 04:44:15Z with BLOCKING F1 at projection.py:238, and adjudicated it fenced=1 flagged=1 -- a FLAG, not UPHOLD-FENCED. Its own text records that the malformed nested row is an input the fold's writer never emits, that reaching it requires an operator hand-editing a savepoint inside the fenced store, and that the consequence is a self-inflicted and locally recoverable HTTP 500. That disposition is with the reviewer of record; this comment does not claim it is settled.

Design, First Principles and Opus all stamped this head with no block.

@chenmingwei23
chenmingwei23 force-pushed the feat/crew-log-fold-checkpoints branch from 8f1a02a to 760b7ec Compare September 20, 2026 05:28
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 20, 2026
@github-actions

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 760b7ecaf5b27cdc07d72b15353e2a9eab21fec0. Adjudication produced no [GPT-ADJUDICATED] marker for 760b7ec: the adjudication stage FAILED TO RUN (its raw output is in the Adjudication details block -- typically an API or setup error), so no proportionality review took place and GPT's blocking verdict stands unreviewed.

This comment is updated in place on each push.

BLOCKING -- src/kiro_crew/crew_log/projection.py:572 -- verified prefix can change before resumed state is served (origin: validation)
resumed = _resume_from_disk(handle, wanted) if resume else None
Interior record damage after digest verification -> resumed state retains that record while iter_from skips it -> incorrect projections are served.
Anchor: residual/crash-data-loss-corruption
Fix: Recheck the verified prefix after folding and retry cold if it changed.
[BLOCK-MERGE] 760b7ec
[GPT-REVIEWED] 760b7ec
False positive or not applicable? A repository writer can comment:
/ai-review override gpt 760b7ecaf5b27cdc07d72b15353e2a9eab21fec0: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 20, 2026
@chenmingwei23
chenmingwei23 force-pushed the feat/crew-log-fold-checkpoints branch from 760b7ec to 9650f26 Compare September 20, 2026 06:47
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

The prefix digest is now checked after the pass as well as before it

GPT 5.6 flagged this on 760b7ecaf5b27cdc07d72b15353e2a9eab21fec0 (projection.py:572). It is real, and it was an asymmetry in this change's own guards: checkpoint.load verified a savepoint's prefix digest BEFORE the fold consumed the entries above it, and after the pass _fold_attempt re-read only the log's IDENTITY. Damage landing in between therefore left the served state carrying a record the file no longer yields.

Reproduced first, and the reproduction is the load-bearing part. test_a_prefix_damaged_mid_fold_is_folded_again_rather_than_served damages one already-folded interior record from inside iter_from, after the savepoint verified and after the entries were materialized. The damage keeps the line count and the file's last seq unchanged, so identity, front and length all still match and only the digest can notice. On the previous head the fold served 71 turns where the file on disk holds 70.

The fix adds no new mechanism. held_still() now answers both questions in one place, and the second digest check re-runs the same load rather than re-implementing the comparison, so one routine decides whether a savepoint describes this file. A mismatch retries cold through the path an identity change already used. The cost is one more pass over the consumed bytes and falls only on a read that resumed.

Mutation-verified: neutering the new branch reddens exactly that one test out of 123. 530 tests pass across the checkpoint, projection, core, retention, routes and tree suites. Rebased onto main so the head also carries 7e8f2c459f, which fixes the test_vector_memory failure that reddened two backend shards on the previous head and is not part of this change.

One thing to note about that verdict rather than about the code: its adjudication stage reported FAILED TO RUN, so it stood unreviewed. It was fixed on its merits, not overridden.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

The prefix digest is read before the pass, so a write cannot certify bytes no fold saw

GPT 5.6 upheld a fenced finding on the previous head at src/kiro_crew/crew_log/checkpoint.py:263: the write resolved its own boundary and hashed the file at write time, not the bytes the fold consumed. A consumed record that changed between the pass and the write was therefore hashed together with state folded from its earlier value, and because the recorded digest and the recorded state then agreed with EACH OTHER, every later resume recomputed those same changed bytes, matched, and served state a cold fold disagrees with. Nothing rechecks a digest that verifies, so that answer stood for the life of the unit. The finding is correct and it is fixed here rather than dispositioned.

What changed. checkpoint.prefix_witness reads the digest before the fold consumes anything, and only when checkpoint.write_is_earned says a savepoint is owed, so a pass that will not write one pays nothing. projection._fold_attempt.held_still asks checkpoint.prefix_unchanged after the pass, beside the identity recheck that was already there, so the two guards are one shape: check, do the work, check again. save then persists the value it was handed and reads nothing itself. A pass that ends at some other boundary, because the file grew under it or because its handle's own seq was stale, matches no fold in the bundle and writes nothing. That costs the savepoint, never the answer the read serves.

The expensive half of the old write path moved rather than grew: raw_records_through decodes a record per line and is now called by the fold that owes a write instead of by the write, and the added cost is one hashing-only pass over the consumed bytes.

Evidence. Two tests, and a mutation restoring the write-time re-read reddens exactly those two of 41 in the file. test_a_savepoint_carries_the_digest_its_own_pass_read drives the real window, damaging one consumed record between the pass and the write and asserting the next read agrees with a cold fold. It asks for the usage fold deliberately: against status it passes with the fix reverted, because that fold does not carry the changed value, and the assertion would measure nothing. test_a_savepoint_records_the_digest_it_was_handed_rather_than_re_reading pins the mechanism on its own by handing in a digest the file cannot produce and asserting it reaches disk, which is impossible if anything re-read.

Also on this head. The Comment History Gate was red on three added phrases that state a condition but read as history narration; they are reworded, and the gate passes against the merge base. The description now declares the new public surface with its measured consumers, and corrects the test count for that file to 41.

Verified before pushing: 532 tests across the savepoint, projection, core, retention, routes and tree suites, and eight gates at exit 0, being the repo black gate, isort, flake8, mypy, comment-history, changelog-history, docs-lint and the brand check.

One note on the verdict rather than the code: its adjudication recorded 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the block stood without a proportionality pass. It is fixed on its merits; no override was sought or posted.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Backend Tests (Windows) (1) on fe44b3decd is main-owned, and already tracked as #12247

Four failures, all in test/test_acp_runtime.py: test_reap_amendment_leaves_the_reason_untouched, test_reap_amendment_leaves_the_stderr_tail_untouched, and test_kill_amends_the_summary_once_the_reap_completes in both parametrizations. Each asserts [returncode=-15] appears in a kill summary and reads [returncode=<not reaped>] instead.

Not this PR's. This branch changes six files, all under src/kiro_crew/crew_log/, its tests, and one spec. test/test_acp_runtime.py, src/kiro_crew/acp/runtime.py and src/kiro_crew/platform_compat.py are byte-identical to the merge base 7e8f2c459f.

The commit that changed the asserted string. b785dcc44ee6, "fix(acp): say who killed a runtime and never log a bare returncode=None" (#12188), landed on main at 08:24:52Z. It edits src/kiro_crew/acp/runtime.py, which produces that summary, and it does NOT edit test/test_acp_runtime.py. So the production wording moved and its assertions did not follow: the deterministic two-stage shape, where the behaviour change lands and the test fix has not.

Control pair, measured on that exact lane name rather than inferred: #12210 at head ecad9ce599c9 PASSED it at 08:17:29Z, and #12222 at head 04a2d9311f2d FAILED it at 09:12:03Z. b785dcc44ee6 sits inside that window. The same lane is red on three wave heads with disjoint diffs.

Why neither a rerun nor a rebase clears it. b785dcc44ee6 is NOT an ancestor of this branch's base, and IS an ancestor of current main, so the red arrives through the merge ref rather than through the branch. A rerun replays the merge ref resolved when the run was created, so it reproduces the same failure. A rebase would pull the breakage INTO the base rather than remove it. Only a main-side fix clears it, and then a fresh SHA is needed to pick up a merge ref containing that fix.

No fix is folded in here, and nothing in acp/ is touched by this branch.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

GPT 5.6 F1 on fe44b3decd: the divergence is real, and it is already reachable on main without this branch

The finding at src/kiro_crew/crew_log/store.py:1967 describes a real disagreement. A cold fold REJECTS a record whose seq is at or below the seq already reached. An incremental read starts above that record and never sees it, so it succeeds. Two reads of the same bytes, two answers.

Measured on pristine main, with none of this branch's code present. A detached worktree at 954fb69185, a short log, one hand-written duplicate of its last record, then one further real entry. No savepoint exists at that length and none is written.

cold    = RAISED  entry 13 is at or below the status checkpoint's seq 13
resumed = SUCCEEDED     (fold_session(since=...), the in-memory bundle reuse)

So the mechanism belongs to the incremental read, which fold_session(since=...) has offered all along, and not to the savepoint this branch adds. What the savepoint changes is DURABILITY, not reachability: an in-memory bundle dies with the process while a savepoint on disk does not, so this branch widens the window rather than opening it.

The prescribed remedy does not close it, and that is measured too. "Record that seq was found, continue counting through EOF" changes the count taken at WRITE time. In the sequence the finding itself sets out, the duplicate arrives AFTER the savepoint was written, when prefix_records is already fixed, so a wider count at write time cannot see it. I implemented the widened walk with a test for it, and the test failed on its own premise: advance raises at projection.py:307 on a backward seq, so a cold fold cannot complete over a file that already holds one, which means no savepoint can be written from it either. The state the wider count would protect is not reachable from the write path. That change is reverted and is not on this head.

Where the fix belongs. The read that skips the record is the read that can see it. iter_from constructs every entry and drops the ones below the requested seq afterwards, which this PR's own spec section records as the honest limit of what a savepoint saves, so the decode is already paid and a monotonicity check on the seqs it drops would be affordable there. That is a change to the incremental fold rather than to the savepoint, it is equally needed with no savepoint present, and it is not in this branch's scope.

Nothing here argues the finding is wrong. It argues that this branch is not where it entered and not where it is closed.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Round record: savepoint parse guard misses RecursionError

Both findings on 1711b54edac2b11bbf8e08daf7986a1c1cc66514 were real and are fixed
on this head. No override was sought for either.

F1 -- checkpoint.py:388, the blocking one

_load_one guards the parse with except (OSError, ValueError). RecursionError
is a RuntimeError, so it escapes.

The size cap above it does not stand in for the guard. Measured on Python 3.12.13
at the default recursion limit of 1000: nesting at depth 20,000 raises
RecursionError out of json.loads, and the file is 40 KB, against a
MAX_CHECKPOINT_BYTES of 2 MB. So a payload small enough to pass the cap reaches
it comfortably.

That matters more here than at an ordinary parse site. Every other unusable
savepoint returns None and costs the session one cold fold. This one escapes
fold_session, and the file stays on disk, so every later read of that session
raises again until someone deletes it by hand. The fix names RecursionError
alongside the other two, which puts it on the same path as every other reason a
file is not a savepoint.

Why the test injects the class rather than nesting a real payload

The depth that raises is interpreter- and platform-dependent, and a literal deep
enough to be certain on every runner can exhaust the C stack instead of raising,
which would fail the worker rather than the assertion. So the test raises the
class at the module's own parse point, confined to that module, which leaves the
store's record parsing intact and therefore leaves the cold answer it compares
against trustworthy. The measured reachability above is what establishes the
class is not hypothetical; the injection is what makes the test stable.

Mutation-verified: restoring the previous exception tuple reddens exactly one test
of 42, the new one, and it fails with RecursionError escaping rather than with a
value mismatch. That is the defect itself, not a proxy for it.

F2 -- the spec's payload example

Correct finding. The example listed seven keys while save writes nine; the two
fields this branch made required were absent from it, so the example described a
payload that load rejects. Both are added, in the order save writes them.

One thing deliberately not changed

state_is_serializable in projection.py catches (TypeError, ValueError) and
has the same blind spot on its own json.dumps. It is not in scope here: it
pre-exists on the merge base, so it is not this branch's, and a component-wide
gap belongs in its own change rather than folded into a branch under review.

Verification

734 tests across test_crew_log_checkpoint.py, test_crew_log_projection.py,
test_crew_log_core.py, test_crew_log_retention.py, test_crew_log_routes.py,
test_crew_log_tree.py and test_docs_crew_log_reference.py. Eight gates at exit
0, each read from its own exit status: the repo black gate, isort, flake8, mypy,
comment-history, changelog-history, docs-lint and the brand check. Rebased onto
current main first, so the tested tree is the pushed tree.

The projection route folds a session's crew log from seq 1 on every read, so
showing a session's status costs what its whole history costs. The push avoids
that with an in-memory bundle, but that cache dies with the process and holds a
bounded number of sessions, so a restart and an eviction each pay for the file
again.

Each fold's state is now written beside the log it came from, one file per fold
under the unit's own directory, and resumed on the next read. Measured on a
10,001-entry log: 99.5 ms to fold cold, 3.2 ms to resume.

The files are disposable: every failure falls back to folding from seq 1. Three
checks retire a savepoint that would disagree with a cold fold -- the log's
creation identity, the oldest surviving segment's first seq, and a log shorter
than the savepoint -- and the identity is read again after the pass, so a unit
recreated mid-fold is folded afresh rather than spliced. The write goes through
the unit's lease so a removal cannot run underneath it, and anything written for
a unit that turns out to be gone is deleted again, its directory included.
@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Fix record for head 85baec8d9dec9f349a99133c7317f9cb0f87b4e7

The blocking finding at projection.py:596 is real and is fixed. It is the mirror
of the one fixed on the previous head: that one closed the disk-resume path, this
one closes the cached-reuse path.

The mechanism, verified in the code rather than taken on report

_fold_attempt set resumed_from only on the branch that resumed from disk. A
pass that reused a since= bundle left it unset, so held_still() skipped the
prefix check and returned true on the identity alone. A write could then be earned,
and the savepoint stored a digest read from the file NOW beside state folded from
the file as it was on an earlier call. Those two agree with each other, so every
later resume recomputes the same bytes, matches, and serves that state for the life
of the unit, because nothing rechecks a digest that verifies.

Serving a stale value on that path is not the defect and is not what changed: an
incremental read has always been allowed to be stale, and the merge base does the
same thing. Writing it down is what makes the staleness outlive the process, and
only this branch can do that.

The fix adds no mechanism

A savepoint may only be written from a digest of the bytes its state came from. A
read that resumed from DISK has that transitively, because the savepoint records
the digest its own writer read and resumed_prefix_still_verifies checks it again.
A since= bundle records no digest at all, and the bytes below its seq were
consumed by a call that already returned, so nothing the new pass can read is
evidence about them. So that pass now takes no witness, and save already writes
nothing without one.

The cost is that a hot incremental reader brings its savepoint forward on the next
read that folds the prefix rather than on every publish. That is the lag the module
already declares acceptable: resuming from an older savepoint replays the tail and
reaches the same value.

Tests

Two new, both mutation-verified. Removing the gate reddens exactly these two of 44
in the file, on the intended assertions:

  • test_a_read_that_reused_a_cached_bundle_writes_no_savepoint fails
    assert 545 == 273, the savepoint advancing when it must not.
  • test_damage_below_a_cached_bundle_is_not_written_into_a_savepoint fails on the
    served value, 68.0 credits where a cold fold gives 166.5.

The second folds usage rather than status deliberately. status does not carry
the altered value, so against it the test passes with the fix reverted. An earlier
test in this file made exactly that mistake.

Re-measured figures, and a correction to my own

The description and the spec both quoted numbers taken before the prefix digest
existed, so they are no longer true of any resume. Re-measured on one host, best of
five, on the same 10,001-entry (1.48 MB) log, all five projections:

read cost
cold fold 184.4 ms
resume, nothing new to fold 44.8 ms
resume, short tail 105.5 ms
resume that also earns a write 197.1 ms
cached read with a short tail 64.2 ms

Attribution: hashing the whole prefix is 20.6 ms, and a resume does it twice, once
on the way in and once after the pass, which is essentially the whole of the 44.8
ms. A write-earning resume also resolves the record count and hashes again
(prefix_witness 66.6 ms) plus the recheck, which is why it lands at about what
folding cold costs.

So the win on the reads that dominate is roughly 1.7x to 4x, not an order of
magnitude. The description previously said 99.5 ms cold in one place and 343.6 ms
in another for the same log, and the spec said 3.2 ms to resume; all three are
replaced by the one run above. Read them as ratios on one host, not as portable
constants.

The description's payload example also listed seven keys where save writes nine.
Corrected, the same omission that was already fixed in the spec.

Verified before pushing

736 tests across the seven owned files, and eight gates at exit 0: the repo black
gate, isort, flake8, mypy, comment-history, changelog-history, docs-lint and the
brand check. Rebased onto current main first, so the tested tree is the pushed tree.

One thing left alone

state_is_serializable has the same blind spot on its own json.dumps that was
fixed at checkpoint.py:388. It pre-exists on the merge base, so it is not this
branch's to fold in.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Disposition of the Design Review advisory on 85baec8d9dec9f349a99133c7317f9cb0f87b4e7

Design returned PASS, so none of this is blocking. All three points are answered
here rather than in a commit: the blocking lanes are clean on this head, and a push
for a non-blocking item re-rolls two non-deterministic reviewers that currently
agree.

The headline does not survive measurement

every resume rehashes the whole prefix, so the 1.7-4x measured at 10k entries
decays as logs grow

Measured, best of three on one host, cold fold against a no-tail resume:

log cold resume, nothing new ratio
10,001 entries, 1.48 MB 187.1 ms 45.9 ms 4.08x
30,001 entries, 4.47 MB 542.7 ms 125.4 ms 4.33x

The ratio holds, and if anything it improves. Both sides are linear in the prefix:
the fold decodes and folds every record, the guard hashes every record. Tripling the
log scales both by about the same factor, so there is no term that decays. The win
is scale-invariant in entry COUNT; what it does depend on is the mix of reads, which
the table in the description gives.

Suggestion 1 is sound, and is deferred rather than refuted

Skipping resumed_prefix_still_verifies when the pass folded zero entries is a real
saving, and the reasoning is right: load is the last thing that touched the file,
so rechecking its digest immediately afterwards covers microseconds in which nothing
was read.

Worth recording why that is NOT true of the identity recheck on the same path, since
the two look symmetric and are not. origin is sampled at the top of the pass,
BEFORE load runs, so rechecking it afterwards covers a window in which a real
recreation can land -- and it is pinned by
test_an_unchanged_tail_still_rechecks_the_log_identity, which shows the recheck is
what buys the cold retry. The digest has no such gap, because the reading and the
recheck sit next to each other.

Deferred on cost, not on merit. It changes no answer, only the time to reach one,
and the head it would need re-rolls GPT and Opus, which have both just returned
clean.

Suggestion 2 is out of scope

Memoizing a verified prefix across calls would remove the dominant per-read cost,
and it is the right next step. It is also a new mechanism rather than one more term
in an existing guard: a cross-call cache needs its own invalidation story, and that
story has to answer the same question this PR just settled -- whether a digest read
at one moment is evidence about the bytes a fold consumed at another. A cache keyed
on (origin, prefix_records, prefix_sha) is keyed on the digest it is meant to
avoid recomputing, so the key has to come from somewhere that is itself trusted.
That belongs in its own change, argued on its own.

@chenmingwei23

Copy link
Copy Markdown
Contributor Author

Final verification on 85baec8d9dec9f349a99133c7317f9cb0f87b4e7

check result
lanes, newest attempt each 90 -- 79 pass, 11 skipped
failing 0
cancelled with no later success 0
running 0
combined commit status success
PR Readiness success
mergeable MERGEABLE
unresolved review threads 0 of 0
active BLOCK-MERGE marker on this head none
incomplete-verdict notices 0
green_age.py exit 30, STALE

The raw check-run count equals the deduplicated lane count, 90 either way, so no lane
has a superseded attempt hiding under it. All four reviewed-marker trailers name this
exact head. The two BLOCK-MERGE markers in the thread name 065556f5 and
760b7eca, both superseded.

The one failing item is a heuristic artifact, not a collision

green_age.py reports STALE. Its whole finding is this:

base +1 commits (f8d77e49 -> 10b0fb81)
overlap: test/test_memory_multistore_stress.py (import)

The commit is 10b0fb81b4 (#12309), test(memory): say what the mixed-load budget caught when it expires. It is +49/-5 in ONE file, and that file is a test. It changes
no source at all.

The import class fires on the bare top-level package. The script's own extractor
records kiro_crew as an imported target, deliberately, because from kiro_crew import context may bind a submodule rather than an attribute. Its matcher then
accepts a hit when changed.startswith(target + "."), and every module in this diff
is under kiro_crew.. So the pair that matched is kiro_crew against
kiro_crew.crew_log.store -- which means any PR touching any file under
src/kiro_crew/ overlaps any moved file that imports the package by name. That is the
script erring toward reporting, which is the right default for a merger's advisory.

Checked substantively rather than argued:

  • the moved file never names crew_log, at all;
  • none of the six modules it imports (context, embeddings, executors,
    vector_memory, config.loader, slack.gateway) imports crew_log either, so it
    cannot reach this diff transitively;
  • the commit touches no source, so it cannot change behaviour these tests rest on.

No rebase is proposed on this. The script's own docstring calls it information for
the merger and never a merge gate, and a new head would re-roll four non-deterministic
review lanes that have just returned clean on this one.

The description's figures stand on this head

Re-verified against the live body: the re-measured timings are present, the payload
example lists the nine keys save writes, and the test count reads 44, which is what
test_crew_log_checkpoint.py collects. No stale figure remains outside the sentence
that retracts it by name.

@iamwhatever iamwhatever 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.

Approved on the current head: CI green, readiness passed, no security-sensitive path in the diff.

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.

2 participants