[PR #4029] [MERGED] fix(kuna): preserve ownership through cancellation and failed verification #6001

Closed
opened 2026-10-31 01:11:05 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4029
Author: @N0zoM1z0
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/kuna-cancellation-cleanup-20261015


📝 Commits (1)

  • a7341f5 fix(kuna): preserve ownership through cancellation and failed verification

📊 Changes

6 files changed (+404 additions, -57 deletions)

View changed files

📝 docs/kuna-provider.md (+4 -0)
📝 scripts/verify-real-kuna.mjs (+97 -25)
📝 src/kuna/KunaProjectReader.ts (+22 -7)
📝 src/kuna/KunaSessionClient.ts (+37 -23)
➕ tests/boundary/providers/kuna/kunaReaderCancellation.test.ts (+130 -0)
📝 tests/boundary/providers/kuna/kunaVerifier.test.ts (+114 -2)

📄 Description

Summary

Fix the two remaining lifecycle findings from #3854 (cancelled reads, verifier cleanup). That PR merged while these fixes were being verified; this follow-up starts from main at 6688ed6db.

A request cancelled during the shared assembly-index scan now returns independently. The session owns, aborts and drains the producer before releasing files. Cancelling one waiter preserves the scan for another.

The real-Kuna verifier now checks process lineage on failed runs, attempts provider/client/transport cleanup independently, and preserves the workspace unless all cleanup is confirmed. Failed reports retain the original verification and cleanup errors. Sampling is shared and drained; the version probe uses the existing stoppable subprocess helper.

Contract and boundary impact

  • Owners: immutable Kuna project reader, session work lifetime, and verifier workspace lifetime. No new tools, schemas, capabilities, target authority, or installation changes.
  • Ordinary fixes within the existing read-only provider; maintainer scope decision: not applicable.
  • Existing source-file digests, spans and project identity are preserved. Public CLI/MCP result shapes are unchanged.
  • Reads local artifacts, launches the existing static analyzer, and writes/removes only owned cache/workspace files. Targets are never executed. No network operation is added.

Evidence and validation

  • Before-fix production-boundary regression: all four cancellation tests and both original failure-path verifier tests fail on b8fc27c9a; the caller remains blocked or no failure report is written. The existing three matrix-selection tests pass.
  • npm run check — passed, including typecheck, lint, formatting, module boundaries and architecture guards.
  • npx vitest run tests/boundary/providers/kuna tests/boundary/process/regexMatcher.test.ts src/ida src/doctorRuntime.test.ts — 412 passed in 29 files before adding the combined verification/cleanup-failure case; final focused verifier/cancellation run passed all 10 tests, including simultaneous verification and cleanup failures.
  • npm run docs:check — passed, including five README consistency checks.
  • Real Kuna 1.833, Debian Linux x86-64: compiled symbol-bearing and stripped source fixtures through public MCP; pseudocode, assembly and combined dossier source spans/digests, fresh-server reuse, empty staging and final verified process lineage all passed. No real macOS run for this follow-up; no real IDA/Hopper coverage claimed.
  • Completed real-fixture run: 11.11 s elapsed, 12.98 s user + 4.13 s system CPU, sampled process-family peak 805.5 MiB (50 ms; brief peaks can be missed), highest single-process RSS 378.6 MiB. Cold first pseudocode 257/272 ms; same-session cached reads 4–6 ms; first fresh-server read 117/119 ms. Shared VM, one final sample; no speedup claim. Agent tokens were not remeasured; tool declarations/results did not change. Failure-path tests simulate a provider and MCP cleanup rejection; they do not establish real-provider failure reproduction.

Author readiness

Human owner: @N0zoM1z0

The owner explicitly authorized continuing work, opening ready PRs and merging. Human-review claims below are left unchecked because the agent cannot establish that review occurred.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/4029 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/kuna-cancellation-cleanup-20261015` --- ### 📝 Commits (1) - [`a7341f5`](https://github.com/morluto/rea/commit/a7341f5ab13c54d9a4e109bbbcc879ed369275c4) fix(kuna): preserve ownership through cancellation and failed verification ### 📊 Changes **6 files changed** (+404 additions, -57 deletions) <details> <summary>View changed files</summary> 📝 `docs/kuna-provider.md` (+4 -0) 📝 `scripts/verify-real-kuna.mjs` (+97 -25) 📝 `src/kuna/KunaProjectReader.ts` (+22 -7) 📝 `src/kuna/KunaSessionClient.ts` (+37 -23) ➕ `tests/boundary/providers/kuna/kunaReaderCancellation.test.ts` (+130 -0) 📝 `tests/boundary/providers/kuna/kunaVerifier.test.ts` (+114 -2) </details> ### 📄 Description ## Summary Fix the two remaining lifecycle findings from #3854 ([cancelled reads](https://github.com/morluto/rea/pull/3854#discussion_r4280346337), [verifier cleanup](https://github.com/morluto/rea/pull/3854#discussion_r4280346328)). That PR merged while these fixes were being verified; this follow-up starts from main at `6688ed6db`. A request cancelled during the shared assembly-index scan now returns independently. The session owns, aborts and drains the producer before releasing files. Cancelling one waiter preserves the scan for another. The real-Kuna verifier now checks process lineage on failed runs, attempts provider/client/transport cleanup independently, and preserves the workspace unless all cleanup is confirmed. Failed reports retain the original verification and cleanup errors. Sampling is shared and drained; the version probe uses the existing stoppable subprocess helper. ## Contract and boundary impact - Owners: immutable Kuna project reader, session work lifetime, and verifier workspace lifetime. No new tools, schemas, capabilities, target authority, or installation changes. - Ordinary fixes within the existing read-only provider; maintainer scope decision: not applicable. - Existing source-file digests, spans and project identity are preserved. Public CLI/MCP result shapes are unchanged. - Reads local artifacts, launches the existing static analyzer, and writes/removes only owned cache/workspace files. Targets are never executed. No network operation is added. ## Evidence and validation - Before-fix production-boundary regression: all four cancellation tests and both original failure-path verifier tests fail on `b8fc27c9a`; the caller remains blocked or no failure report is written. The existing three matrix-selection tests pass. - `npm run check` — passed, including typecheck, lint, formatting, module boundaries and architecture guards. - `npx vitest run tests/boundary/providers/kuna tests/boundary/process/regexMatcher.test.ts src/ida src/doctorRuntime.test.ts` — 412 passed in 29 files before adding the combined verification/cleanup-failure case; final focused verifier/cancellation run passed all 10 tests, including simultaneous verification and cleanup failures. - `npm run docs:check` — passed, including five README consistency checks. - Real Kuna 1.833, Debian Linux x86-64: compiled symbol-bearing and stripped source fixtures through public MCP; pseudocode, assembly and combined dossier source spans/digests, fresh-server reuse, empty staging and final verified process lineage all passed. No real macOS run for this follow-up; no real IDA/Hopper coverage claimed. - Completed real-fixture run: 11.11 s elapsed, 12.98 s user + 4.13 s system CPU, sampled process-family peak 805.5 MiB (50 ms; brief peaks can be missed), highest single-process RSS 378.6 MiB. Cold first pseudocode 257/272 ms; same-session cached reads 4–6 ms; first fresh-server read 117/119 ms. Shared VM, one final sample; no speedup claim. Agent tokens were not remeasured; tool declarations/results did not change. Failure-path tests simulate a provider and MCP cleanup rejection; they do not establish real-provider failure reproduction. ## Author readiness Human owner: @N0zoM1z0 The owner explicitly authorized continuing work, opening ready PRs and merging. Human-review claims below are left unchecked because the agent cannot establish that review occurred. - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:11:05 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6001
No description provided.