Repository navigation
[6] Recover accepted work links after restart - #1351
tautvydasLiekis wants to merge 17 commits into
Conversation
Kimchi Code Review
Summary🚫 Merge request too large to review 📏 Size: 14 file(s) changed, +1029 / −60 lines 🧠 Cognitive load: 4/5 (1 = trivial, 5 = extremely demanding) One feature but many interlocking invariants: content-hash identity of accepted bytes, producer pinning, and bounded background repair with lease, budget and rotation rules, all forbidden from overriding corrections. Large failure-mode/concurrency test additions dominate the diff and must be verified against those invariants. ✂️ Suggested split
👉 Please split this merge request into the smaller merge requests suggested above — the AI review will run automatically on each of them. What to expectKimchi will analyze the changes in this pull request and post:
The review typically completes within a few minutes. This comment will be updated once the review is ready. Interact with Kimchi
ConfigurationReviews are configured by your organization admin. Powered by Kimchi — AI-powered code review by CAST AI |
There was a problem hiding this comment.
🚫 Merge request too large to review
📏 Size: 14 file(s) changed, +1029 / −60 lines
🧠 Cognitive load: 4/5 (1 = trivial, 5 = extremely demanding)
One feature but many interlocking invariants: content-hash identity of accepted bytes, producer pinning, and bounded background repair with lease, budget and rotation rules, all forbidden from overriding corrections. Large failure-mode/concurrency test additions dominate the diff and must be verified against those invariants.
✂️ Suggested split
- Hash accepted plan bytes into continuation evidence — Captures content hashes at match time so later edits cannot rewrite accepted evidence.
src/extensions/work-attribution/continuation.tssrc/extensions/work-attribution/continuation.test.ts
- Add budget-checked, validity-reporting ledger scans — Lets record readers bound scan time and surface malformed history rows.
src/extensions/work-attribution/summary.tssrc/extensions/work-attribution/summary.test.ts
- Pin producers and build the continuation repair engine — Core link construction, producer pinning, and bounded repair over saved receipts.
src/extensions/work-attribution/links.tssrc/extensions/work-attribution/links.test.ts
- Record continuation receipts when accepting saved work — Extension persists accepted evidence with scope and pins producers at input time.
src/extensions/work-attribution.tssrc/extensions/work-attribution.test.tssrc/extensions/work-attribution/continuation.integration.test.ts
- Run continuation repair in the reconciliation supervisor — Schedules repair after PR and billing passes under the shared lease and budget.
src/extensions/work-attribution/reconcile-supervisor.tssrc/extensions/work-attribution/reconcile-supervisor.test.ts
- Cover continuation recovery in e2e tests and docs — End-to-end receipt assertions and documentation of retention and repair behavior.
tests/e2e/acp/work-continuation.test.tstests/e2e/tui/work-attribution.test.tsdocs/work-attribution.md
👉 Please split this merge request into the smaller merge requests suggested above — the AI review will run automatically on each of them.
4349d37 to
a76bbb2
Compare
73d174d to
3aec50c
Compare
a76bbb2 to
711e09e
Compare
d28b459 to
c2a41b9
Compare
711e09e to
13cb56f
Compare
6969473 to
dc4fe8b
Compare
cd8b287 to
fbb4685
Compare
dc4fe8b to
c07737f
Compare
fbb4685 to
8a8d570
Compare
3b72231 to
5f61465
Compare
07e8f4d to
eb6f010
Compare
ddd1ee6 to
fc128db
Compare
698a241 to
e715a29
Compare
fc128db to
00cb976
Compare
e715a29 to
a3b50a2
Compare
00cb976 to
06268ba
Compare
a3b50a2 to
d9d7a5a
Compare
06268ba to
48f82a4
Compare
d9d7a5a to
8663368
Compare
ac03776 to
29a3e1a
Compare
f6b6b74 to
3fb2129
Compare
29a3e1a to
9af7f14
Compare
3fb2129 to
82387b5
Compare
9af7f14 to
c296c34
Compare
82387b5 to
a92f821
Compare
c296c34 to
2d3ff9b
Compare
a92f821 to
90c3011
Compare
2d3ff9b to
ec3fd92
Compare
90c3011 to
de9c8d4
Compare
de9c8d4 to
9282247
Compare
ec3fd92 to
69cee61
Compare
…ntinuations # Conflicts: # src/extensions/work-attribution.ts # src/extensions/work-attribution/continuation.owned-reference.test.ts # src/extensions/work-attribution/continuation.ts
When you continue a saved plan, its planning requests now join the implementation work even if the evidence was missing at that moment or Kimchi restarted. Before this, those planning costs could stay unassigned and drop out of the PR total.
Linked issue
Depends on #1350. No public issue is linked.
What does this PR do?
Kimchi saves each accepted continuation with a hash of the accepted plan bytes, the account, repository and accepting input, and the producing request when it is known. It retries the link at startup and during background reconciliation, and links only when:
Missing or competing evidence stays unresolved. Only the planning input is confirmed; other inputs stay separate.
flowchart TD A[Saved continuation] --> B{History readable and valid?} B -->|No| W[Wait for repaired evidence] B -->|Yes| C{Accepted version and one scoped producer?} C -->|No| W C -->|Yes| D{User correction already exists?} D -->|Yes| K[Keep the correction] D -->|No| L[Confirm the planning input]It also hardens the journal that recovery reads:
The choice is saved under
continuationsin~/.config/kimchi/harness/work/<workId>/work.json; a successful link appears underworkLinks. Recovery makes no model or authentication calls and keeps request IDs and prices.Evidence
On
92822475b, after the final review fixes:pr-checks,master-checks, TUI e2e in 4 shards, ACP e2e and MCP e2e pass on this head. A duplicatetui-e2eentry from a superseded workflow run shows as cancelled.95614e7c6(#1389) contains this PR. On it,pnpm checkpasses and the full unit suite passes except 5 tests that need tools this machine lacks: a DAP js-debug adapter, a builtvalidate-skill.mjsand a binary rebuilt for the smoke test.95614e7c6(scripted model; local GitHub, billing and report fixtures): 73/73 default scenarios pass.Model replies are scripted.
Limits
Checklist
pnpm run test)pnpm run check)🤖 Generated with Claude Code