[PR #4104] [MERGED] fix(kuna): suggest no restart when a fixed buffer stopped the export #6060

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

📋 Pull Request Information

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

Base: main ← Head: fix/kuna-fixed-buffer-no-restart


📝 Commits (1)

  • 743ace9 fix(kuna): suggest no restart when a fixed buffer stopped the export

📊 Changes

3 files changed (+36 additions, -20 deletions)

View changed files

📝 src/kuna/KunaSessionClient.ts (+2 -1)
📝 tests/boundary/providers/kuna/fakeKuna.ts (+4 -1)
📝 tests/boundary/providers/kuna/kunaProvider.test.ts (+30 -18)

📄 Description

Summary

#4070 made requests that need a failed export return a non-retryable error. For a resource-constraint cause, that error appends the cause's remediation and then "REA reads Kuna settings when it starts, so restart REA, then reopen the target." #4098 then classified output overflows as fixed memory bounds, with the remediation "REA buffers at most N bytes of kuna output, so repeating this request for this target fails the same way." After both merged, an export stopped by its own output overflow tells the caller in one message that repeating fails the same way and that a restart will help. No setting controls those buffers, so the restart cannot help. Refs #1957.

Problem and expected behavior

Trigger (fake Kuna): kuna decompile-project writes more than REA's 8 MiB export output buffer, then a procedure_assembly or analyze_function request in that session. Before, the message ended as follows. This text is reconstructed from the code; the base-revision test failure confirms the restart sentence:

… so procedure_assembly is unavailable in this session: Resource constraint during kuna:decompile-project: kuna decompile-project wrote more than 8388608 bytes of output. REA buffers at most 8388608 bytes of kuna decompile-project output, so repeating this request for this target fails the same way. Use another provider for it. REA reads Kuna settings when it starts, so restart REA, then reopen the target.

Expected: no restart advice for a fixed buffer. The cache-capacity remediation (REA_KUNA_CACHE_MAX_BYTES) is a setting and keeps it.

Change and scope

In exportUnavailable, the restart sentence follows a resource-constraint remediation only when the cause's resource is not memory. One conditional. Timeout and other failures are unchanged.

Test cleanup in the same file: the failed-export cases now carry their expected projected details instead of branching on the cause's type, and each case has a distinct name; two cases used to share the title "(AnalysisResourceConstraintError)". The fake Kuna gains a noisy export mode, 9 MiB of stdout before its summary.

Not reproduced with real Kuna: a real export's stdout is one summary line, so its 8 MiB buffer cannot be reached on the targets I have. The other fixed buffer on this path, the 128 MiB inventory, is reached by no app here; Telegram's inventory is 124 MB.

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: KunaSessionClient.exportUnavailable (failed-export message).
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: unchanged except the message text for this case.
  • 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: "reports a failed export as not retryable in its session" gets a fourth case, fixed output buffer. It checks the exact message ending (no restart sentence) and the projected resource: "memory" with reported_limits.output_limit_bytes: 8388608. The other three cases keep their expectations, now as per-case details.

  • Base reproduction: on the base revision (git stash of src/kuna) only the new case fails, because its message ends with the restart sentence.

  • Remaining proof gaps: no real-Kuna reproduction (see above); no Linux run.

  • 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: 145 passed, two consecutive runs.
  • New case on the base revision: 1 failed, 29 passed in kunaProvider.test.ts.
  • 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, cleanup: "complete".

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: real Kuna lane on macOS arm64 (unaffected path only).
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

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/4104 **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-fixed-buffer-no-restart` --- ### 📝 Commits (1) - [`743ace9`](https://github.com/morluto/rea/commit/743ace95204acd5f931e46a3d6c3d87414072840) fix(kuna): suggest no restart when a fixed buffer stopped the export ### 📊 Changes **3 files changed** (+36 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `src/kuna/KunaSessionClient.ts` (+2 -1) 📝 `tests/boundary/providers/kuna/fakeKuna.ts` (+4 -1) 📝 `tests/boundary/providers/kuna/kunaProvider.test.ts` (+30 -18) </details> ### 📄 Description ## Summary #4070 made requests that need a failed export return a non-retryable error. For a resource-constraint cause, that error appends the cause's remediation and then "REA reads Kuna settings when it starts, so restart REA, then reopen the target." #4098 then classified output overflows as fixed `memory` bounds, with the remediation "REA buffers at most N bytes of kuna <subcommand> output, so repeating this request for this target fails the same way." After both merged, an export stopped by its own output overflow tells the caller in one message that repeating fails the same way and that a restart will help. No setting controls those buffers, so the restart cannot help. Refs #1957. ## Problem and expected behavior Trigger (fake Kuna): `kuna decompile-project` writes more than REA's 8 MiB export output buffer, then a `procedure_assembly` or `analyze_function` request in that session. Before, the message ended as follows. This text is reconstructed from the code; the base-revision test failure confirms the restart sentence: ``` … so procedure_assembly is unavailable in this session: Resource constraint during kuna:decompile-project: kuna decompile-project wrote more than 8388608 bytes of output. REA buffers at most 8388608 bytes of kuna decompile-project output, so repeating this request for this target fails the same way. Use another provider for it. REA reads Kuna settings when it starts, so restart REA, then reopen the target. ``` Expected: no restart advice for a fixed buffer. The cache-capacity remediation (`REA_KUNA_CACHE_MAX_BYTES`) is a setting and keeps it. ## Change and scope In `exportUnavailable`, the restart sentence follows a resource-constraint remediation only when the cause's resource is not `memory`. One conditional. Timeout and other failures are unchanged. Test cleanup in the same file: the failed-export cases now carry their expected projected `details` instead of branching on the cause's type, and each case has a distinct name; two cases used to share the title "(AnalysisResourceConstraintError)". The fake Kuna gains a `noisy` export mode, 9 MiB of stdout before its summary. Not reproduced with real Kuna: a real export's stdout is one summary line, so its 8 MiB buffer cannot be reached on the targets I have. The other fixed buffer on this path, the 128 MiB inventory, is reached by no app here; Telegram's inventory is 124 MB. 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: `KunaSessionClient.exportUnavailable` (failed-export message). - Contribution scope fit and linked maintainer decision: not applicable. - CLI and MCP/tool-catalog contract: unchanged except the message text for this case. - 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: "reports a failed export as not retryable in its session" gets a fourth case, `fixed output buffer`. It checks the exact message ending (no restart sentence) and the projected `resource: "memory"` with `reported_limits.output_limit_bytes: 8388608`. The other three cases keep their expectations, now as per-case `details`. - Base reproduction: on the base revision (`git stash` of `src/kuna`) only the new case fails, because its message ends with the restart sentence. - Remaining proof gaps: no real-Kuna reproduction (see above); no Linux run. - [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`: 145 passed, two consecutive runs. - New case on the base revision: 1 failed, 29 passed in `kunaProvider.test.ts`. - `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, `cleanup: "complete"`. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: real Kuna lane on macOS arm64 (unaffected path only). - Package or release metadata impact: none. - Security, privacy, process, or containment review: none. ## 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:32 +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#6060
No description provided.