[PR #4113] [MERGED] fix(kuna): say why Kuna cannot answer instead of a generic message #6064

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4113
Author: @kaoru0822-kitauji
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/kuna-unavailable-says-why


📝 Commits (1)

  • 21fc731 fix(kuna): say why Kuna cannot answer instead of a generic message

📊 Changes

6 files changed (+68 additions, -42 deletions)

View changed files

📝 src/kuna/KunaProjectReader.ts (+2 -3)
📝 src/kuna/KunaProvider.ts (+4 -19)
📝 src/kuna/KunaReferenceQueries.ts (+2 -3)
📝 src/kuna/KunaSessionClient.ts (+4 -17)
➕ src/kuna/KunaUnavailable.ts (+18 -0)
📝 tests/boundary/providers/kuna/kunaCommandFailures.test.ts (+38 -0)

📄 Description

Summary

Several Kuna capability gaps were built as AnalysisCapabilityUnavailableError without a user message. The MCP/CLI projection then shows its generic text for that tag: "This analysis is unavailable for the current target. Choose another analysis or target." The precise Kuna reason stayed in details.reason. That text is wrong for these cases: the target is fine, the requested address is just not code, or not a function node. An agent that follows "choose another analysis or target" abandons a target that works. Refs #1957.

Problem and expected behavior

Real Kuna 1.833, a small arm64 test program (odd, built with cc -O1), main b2257653c:

procedure_assembly 0x100004000   (printf's import slot)
  message: "This analysis is unavailable for the current target. Choose another analysis or target."
  details.reason: "Kuna's export lists no code at 0x100004000; import slots and data entries have no listing."
procedure_callers 0x100000504    (inside a function, not an entry)
  message: "This analysis is unavailable for the current target. Choose another analysis or target."
  details.reason: "Kuna's graph has no function node at 0x100000504; its relationships are unknown."
analyze_function 0x100004000     same as procedure_assembly

Expected: the message (and the remediation, which the projection derives from it) states the Kuna reason.

Change and scope

  • New kunaUnavailable(operation, reason, options) in src/kuna/KunaUnavailable.ts builds the capability error with the reason as its user message. Every Kuna site that presents its reason as-is now uses it:
    • assembly with no code at an address (KunaProjectReader);
    • an address without a graph node (KunaReferenceQueries);
    • a closed session;
    • an unsupported operation;
    • an unconfigured provider at client creation (KunaProvider);
    • the two installation checks that already passed userMessage: reason by hand.
  • The unsupported-operation reason now lists call relationships and xrefs, which Kuna has answered since c9f9b83c6.
  • The failed-export error (exportUnavailable) keeps its own composed message.

Not included: changing the generic presentation for other providers. Their AnalysisCapabilityUnavailableError uses are outside this track.

Scope: an ordinary fix within the existing Kuna provider boundary; no maintainer scope decision applies.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the Kuna sites that construct these errors.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: no schema change. message and remediation.action carry the Kuna reason; code, category, retryable and details are unchanged.
  • Provider, bridge, target-format, or platform compatibility: Kuna only.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged.
  • Target selection, authority, upstream behavior, and cleanup details: none.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: kunaCommandFailures.test.ts gets "says why Kuna cannot answer instead of a generic unavailable message". It checks the projected message for assembly at an import slot, callers at a non-entry address and an unsupported operation (search_strings), with code: capability_unavailable and retryable: false.

  • Base reproduction: the test fails on the base revision (git stash of src/kuna).

  • Real Kuna 1.833, same calls as above, after the fix:

    procedure_assembly 0x100004000  message/action: "Kuna's export lists no code at 0x100004000; import slots and data entries have no listing."
    procedure_callers 0x100000504   message/action: "Kuna's graph has no function node at 0x100000504; its relationships are unknown."
    

    Response sizes are about the same (645 → 651 and 634 → 620 bytes).

  • Remaining proof gaps: no Linux run; the closed-session and unconfigured-provider sites are covered by type and source review, not by a dedicated test of their message.

  • 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/*.test.ts: 189 passed twice after rebasing onto main with the Kuna string feature (#4095); 145 ×2 before. The rebase took main's updated unsupported-operation reason, and the test now uses list_segments, because Kuna answers search_strings since #4095.
  • New test on the base revision: failed.
  • npm run check:fast: typecheck and lint passed.
  • npm run docs:check: passed.
  • REA_KUNA_COMMAND=… npm run verify:kuna (real Kuna 1.833, darwin/arm64): passed before the rebase. On the rebased head it fails exactly as main does ("Required string "REA wide marker" was not recovered"), because of a layout-dependent string fixture from #4095 that is unrelated to this change. #4116 fixes the fixture, and the lane passes with it.
  • Real MCP calls before and after, above.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; only message text changes.
  • Real Hopper/Ghidra, browser, or OS coverage: real Kuna on macOS arm64 only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: the reasons contain target addresses and REA's own Kuna settings text, already present in details.reason.

Author readiness

Human owner:

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

🤖 Generated with Claude Code


🔄 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/4113 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/kuna-unavailable-says-why` --- ### 📝 Commits (1) - [`21fc731`](https://github.com/morluto/rea/commit/21fc7318e5fde9139f2faaf08340828d42216ccf) fix(kuna): say why Kuna cannot answer instead of a generic message ### 📊 Changes **6 files changed** (+68 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `src/kuna/KunaProjectReader.ts` (+2 -3) 📝 `src/kuna/KunaProvider.ts` (+4 -19) 📝 `src/kuna/KunaReferenceQueries.ts` (+2 -3) 📝 `src/kuna/KunaSessionClient.ts` (+4 -17) ➕ `src/kuna/KunaUnavailable.ts` (+18 -0) 📝 `tests/boundary/providers/kuna/kunaCommandFailures.test.ts` (+38 -0) </details> ### 📄 Description ## Summary Several Kuna capability gaps were built as `AnalysisCapabilityUnavailableError` without a user message. The MCP/CLI projection then shows its generic text for that tag: "This analysis is unavailable for the current target. Choose another analysis or target." The precise Kuna reason stayed in `details.reason`. That text is wrong for these cases: the target is fine, the requested address is just not code, or not a function node. An agent that follows "choose another analysis or target" abandons a target that works. Refs #1957. ## Problem and expected behavior Real Kuna 1.833, a small arm64 test program (`odd`, built with `cc -O1`), main b2257653c: ``` procedure_assembly 0x100004000 (printf's import slot) message: "This analysis is unavailable for the current target. Choose another analysis or target." details.reason: "Kuna's export lists no code at 0x100004000; import slots and data entries have no listing." procedure_callers 0x100000504 (inside a function, not an entry) message: "This analysis is unavailable for the current target. Choose another analysis or target." details.reason: "Kuna's graph has no function node at 0x100000504; its relationships are unknown." analyze_function 0x100004000 same as procedure_assembly ``` Expected: the message (and the remediation, which the projection derives from it) states the Kuna reason. ## Change and scope - New `kunaUnavailable(operation, reason, options)` in `src/kuna/KunaUnavailable.ts` builds the capability error with the reason as its user message. Every Kuna site that presents its reason as-is now uses it: - assembly with no code at an address (`KunaProjectReader`); - an address without a graph node (`KunaReferenceQueries`); - a closed session; - an unsupported operation; - an unconfigured provider at client creation (`KunaProvider`); - the two installation checks that already passed `userMessage: reason` by hand. - The unsupported-operation reason now lists call relationships and xrefs, which Kuna has answered since c9f9b83c6. - The failed-export error (`exportUnavailable`) keeps its own composed message. Not included: changing the generic presentation for other providers. Their `AnalysisCapabilityUnavailableError` uses are outside this track. Scope: an ordinary fix within the existing Kuna provider boundary; no maintainer scope decision applies. ## Contract and boundary impact - Semantic owner and earliest changed stage: the Kuna sites that construct these errors. - Contribution scope fit and linked maintainer decision: not applicable. - CLI and MCP/tool-catalog contract: no schema change. `message` and `remediation.action` carry the Kuna reason; `code`, `category`, `retryable` and `details` are unchanged. - Provider, bridge, target-format, or platform compatibility: Kuna only. - Evidence, artifact, provenance, or reconstruction contract: unchanged. - Target selection, authority, upstream behavior, and cleanup details: none. - Generated metadata, package, or installation impact: none. Expected effects: - [ ] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [x] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: `kunaCommandFailures.test.ts` gets "says why Kuna cannot answer instead of a generic unavailable message". It checks the projected `message` for assembly at an import slot, callers at a non-entry address and an unsupported operation (`search_strings`), with `code: capability_unavailable` and `retryable: false`. - Base reproduction: the test fails on the base revision (`git stash` of `src/kuna`). - Real Kuna 1.833, same calls as above, after the fix: ``` procedure_assembly 0x100004000 message/action: "Kuna's export lists no code at 0x100004000; import slots and data entries have no listing." procedure_callers 0x100000504 message/action: "Kuna's graph has no function node at 0x100000504; its relationships are unknown." ``` Response sizes are about the same (645 → 651 and 634 → 620 bytes). - Remaining proof gaps: no Linux run; the closed-session and unconfigured-provider sites are covered by type and source review, not by a dedicated test of their message. - [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/*.test.ts`: 189 passed twice after rebasing onto main with the Kuna string feature (#4095); 145 ×2 before. The rebase took main's updated unsupported-operation reason, and the test now uses `list_segments`, because Kuna answers `search_strings` since #4095. - New test on the base revision: failed. - `npm run check:fast`: typecheck and lint passed. - `npm run docs:check`: passed. - `REA_KUNA_COMMAND=… npm run verify:kuna` (real Kuna 1.833, darwin/arm64): passed before the rebase. On the rebased head it fails exactly as main does ("Required string \"REA wide marker\" was not recovered"), because of a layout-dependent string fixture from #4095 that is unrelated to this change. #4116 fixes the fixture, and the lane passes with it. - Real MCP calls before and after, above. ## Compatibility, safety, and release - Breaking changes or migration steps: none; only message text changes. - Real Hopper/Ghidra, browser, or OS coverage: real Kuna on macOS arm64 only. - Package or release metadata impact: none. - Security, privacy, process, or containment review: the reasons contain target addresses and REA's own Kuna settings text, already present in `details.reason`. ## Author readiness Human owner: <!-- @GitHub-handle --> - [ ] 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. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <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: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#6064
No description provided.