[PR #4711] [CLOSED] fix(kuna): preserve caller cancellation reasons in shared query waits #6366

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4711
Author: @ahmed-husssain
Created: 10/17/2026
Status: ❌ Closed

Base: main ← Head: fix/kuna-cancellation-reasons


📝 Commits (2)

  • c55358a fix(kuna): preserve caller cancellation reasons in shared query waits
  • 64bcaca fix(kuna): preserve explicit null cancellation reasons on thrown execution

📊 Changes

9 files changed (+328 additions, -24 deletions)

View changed files

📝 src/kuna/KunaCommand.ts (+4 -1)
📝 src/kuna/KunaProjectCache.ts (+13 -3)
📝 src/kuna/KunaProjectReader.ts (+4 -1)
📝 src/kuna/KunaQueryWork.ts (+17 -6)
📝 src/kuna/KunaReferenceQueries.ts (+6 -2)
📝 src/kuna/KunaSessionClient.ts (+22 -6)
📝 src/kuna/KunaStringQueries.ts (+9 -3)
📝 src/kuna/KunaTargetCommands.ts (+14 -2)
📝 tests/boundary/providers/kuna/kunaQueryWork.test.ts (+239 -0)

📄 Description

Summary

Fixes #4700. Preserve caller AbortSignal.reason as AnalysisCancelledError.cause in shared Kuna query waits and forward the final waiter's abort reason to the producer.

Problem and expected behavior

Callers aborting during shared query waits received AnalysisCancelledError with cause === undefined, and the final waiter called controller.abort() with no argument, dropping the caller's reason.
Expected: preserve cause === signal.reason across owner boundaries per docs/tool-design.md#own-the-lifecycle.

Change and scope

  • src/kuna/KunaQueryWork.ts: Pass { cause: signal?.reason } and forward pending.controller.abort(signal?.reason).
  • src/kuna/KunaSessionClient.ts: Preserve reason in single-function runs and late session completion.
  • src/kuna/KunaCommand.ts: Extract cause.cancellation?.reason for cancelled command failures.
  • src/kuna/KunaTargetCommands.ts, KunaStringQueries.ts, KunaReferenceQueries.ts, KunaProjectCache.ts, KunaProjectReader.ts: Pass signal.reason on early abort checks.

Contract and boundary impact

  • Semantic owner and earliest changed stage: KunaQueryWork.
  • Contribution scope fit and linked maintainer decision: not applicable; ordinary bug fix.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: preserves exact cancellation cause.
  • Target selection, authority, upstream behavior, and cleanup details: unchanged.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Documentation or usability only; no target interaction.

Evidence and regression coverage

  • Tests: 8 focused tests in tests/boundary/providers/kuna/kunaQueryWork.test.ts (peer departure, final waiter forwarding, diverse reason types, and physical error precedence).

  • Base reproduction: 5 of these tests failed prior to the fix with expected undefined to be <reason>. All 8 pass after the fix.

  • Remaining proof gaps: simulated boundary tests; real Kuna binary not launched.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- tests/boundary/providers/kuna/kunaQueryWork.test.ts — 8 passed.
  • npm run test:focused (all Kuna boundary tests) — 84 passed, 182 skipped (Windows).
  • npm run check:fast — passed (0 errors).
  • npm run docs:check — passed.
  • git diff --check — clean.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: Windows x64.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new authority.

Author readiness

Human owner: @ahmed-husssain

  • 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.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 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/4711 **Author:** [@ahmed-husssain](https://github.com/ahmed-husssain) **Created:** 10/17/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/kuna-cancellation-reasons` --- ### 📝 Commits (2) - [`c55358a`](https://github.com/morluto/rea/commit/c55358ac3f03022f5ef9795859900b3430063411) fix(kuna): preserve caller cancellation reasons in shared query waits - [`64bcaca`](https://github.com/morluto/rea/commit/64bcacad30008be2fd71cc099fc8fa3b804f1f52) fix(kuna): preserve explicit null cancellation reasons on thrown execution ### 📊 Changes **9 files changed** (+328 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `src/kuna/KunaCommand.ts` (+4 -1) 📝 `src/kuna/KunaProjectCache.ts` (+13 -3) 📝 `src/kuna/KunaProjectReader.ts` (+4 -1) 📝 `src/kuna/KunaQueryWork.ts` (+17 -6) 📝 `src/kuna/KunaReferenceQueries.ts` (+6 -2) 📝 `src/kuna/KunaSessionClient.ts` (+22 -6) 📝 `src/kuna/KunaStringQueries.ts` (+9 -3) 📝 `src/kuna/KunaTargetCommands.ts` (+14 -2) 📝 `tests/boundary/providers/kuna/kunaQueryWork.test.ts` (+239 -0) </details> ### 📄 Description ## Summary Fixes #4700. Preserve caller `AbortSignal.reason` as `AnalysisCancelledError.cause` in shared Kuna query waits and forward the final waiter's abort reason to the producer. ## Problem and expected behavior Callers aborting during shared query waits received `AnalysisCancelledError` with `cause === undefined`, and the final waiter called `controller.abort()` with no argument, dropping the caller's reason. Expected: preserve `cause === signal.reason` across owner boundaries per `docs/tool-design.md#own-the-lifecycle`. ## Change and scope - `src/kuna/KunaQueryWork.ts`: Pass `{ cause: signal?.reason }` and forward `pending.controller.abort(signal?.reason)`. - `src/kuna/KunaSessionClient.ts`: Preserve reason in single-function runs and late session completion. - `src/kuna/KunaCommand.ts`: Extract `cause.cancellation?.reason` for cancelled command failures. - `src/kuna/KunaTargetCommands.ts`, `KunaStringQueries.ts`, `KunaReferenceQueries.ts`, `KunaProjectCache.ts`, `KunaProjectReader.ts`: Pass `signal.reason` on early abort checks. ## Contract and boundary impact - Semantic owner and earliest changed stage: `KunaQueryWork`. - Contribution scope fit and linked maintainer decision: not applicable; ordinary bug fix. - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: preserves exact cancellation cause. - Target selection, authority, upstream behavior, and cleanup details: unchanged. - Generated metadata, package, or installation impact: none. Expected effects: - [x] Documentation or usability only; no target interaction. ## Evidence and regression coverage - Tests: 8 focused tests in `tests/boundary/providers/kuna/kunaQueryWork.test.ts` (peer departure, final waiter forwarding, diverse reason types, and physical error precedence). - Base reproduction: 5 of these tests failed prior to the fix with `expected undefined to be <reason>`. All 8 pass after the fix. - Remaining proof gaps: simulated boundary tests; real Kuna binary not launched. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:focused -- tests/boundary/providers/kuna/kunaQueryWork.test.ts` — 8 passed. - `npm run test:focused` (all Kuna boundary tests) — 84 passed, 182 skipped (Windows). - `npm run check:fast` — passed (0 errors). - `npm run docs:check` — passed. - `git diff --check` — clean. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: Windows x64. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no new authority. ## Author readiness Human owner: @ahmed-husssain - [ ] 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. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:13:55 +00:00
bsakaguchi changed title from [PR #4711] [CLOSED] fix(kuna): preserve caller cancellation reasons in shared query waits to [PR #4711] [CLOSED] fix(kuna): preserve caller cancellation reasons in shared query waits 2026-11-01 21:41:34 +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#6366
No description provided.