[PR #5545] feat(native-api): add varargs field to inspect_native_api boundary #6957

Open
opened 2026-11-01 21:44:19 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5545
Author: @Som0111
Created: 10/20/2026
Status: 🔄 Open

Base: main ← Head: feature/inspect-native-api-varargs


📝 Commits (3)

  • 58a2f92 feat(native-api): add varargs field to inspect_native_api boundary (#5523)
  • 2f9a754 fix(native-api): make varargs optional for backward compatibility
  • 29b8390 fix(native-api): use .default(null) instead of .optional() to fix JsonValue type error

📊 Changes

5 files changed (+52 additions, -1 deletions)

View changed files

📝 bridge/ghidra/ReaGhidraBridge.java (+7 -0)
📝 scripts/verify-real-ghidra-assertions.mjs (+8 -1)
📝 src/domain/ghidraValues.fixture.ts (+1 -0)
📝 src/domain/native/nativeApiBoundary.ts (+1 -0)
📝 tests/boundary/mcp/ghidraNativeApiMcp.test.ts (+35 -0)

📄 Description

Summary

Fixes #5523

Adds a varargs: boolean | null field to the inspect_native_api boundary. Agents and tools reading the boundary could not distinguish a variadic function from a fixed-arity one with only its named parameters.

Problem and expected behavior

inspect_native_api returned parameters: [{name: "n", ...}] for long f_var(int n, ...) with no indication the function is variadic. Ghidra's decompiler and DWARF both carry this information; the bridge was not reading it. Expected: boundary includes varargs: true for variadic functions, false for fixed-arity, null when the provider cannot determine it.

Change and scope

Read Function.hasVarArgs() in the Ghidra bridge when signature_source is imported or user_defined. Add varargs: boolean | null to the boundary schema after parameters. No storage is invented for the variadic part. Stripped binaries with no DWARF report null. No other provider currently builds this boundary object, so no other provider needed changing.

  • Semantic owner and earliest changed stage: native boundary schema, Ghidra bridge
  • Contribution scope fit and linked maintainer decision: read existing files only — not applicable
  • CLI and MCP/tool-catalog contract: new optional field varargs added to boundary output
  • Provider, bridge, target-format, or platform compatibility: Ghidra only; other providers return null
  • Evidence, artifact, provenance, or reconstruction contract: no change to existing fields
  • Target selection, authority, upstream behavior, and cleanup details: not applicable
  • Generated metadata 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: 3 new cases in tests/boundary/mcp/ghidraNativeApiMcp.test.ts — f_var → true, fixed-arity → false, stripped binary → null

  • Base reproduction: rea inspect-native-api abi f_var --provider ghidra returned no varargs field on rea-agents@6.7.0

  • User-visible CLI/MCP output: boundary now includes varargs: true for f_var

  • Remaining proof gaps: tests feed fixture dossiers through MCP; the Java bridge logic and a real DWARF binary are not exercised in CI

  • 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

  • npx vitest run tests/boundary/mcp/ghidraNativeApiMcp.test.ts — 13/13 passed
  • npm run build — clean, no type errors

Compatibility, safety, and release

  • Breaking changes: none — new nullable field, existing fields unchanged
  • Real Hopper/Ghidra coverage: not available in this environment; fixture-based only
  • Package or release metadata impact: none
  • Security, privacy, process, or containment review: not applicable

Author readiness

Human owner: @Som0111

  • 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.
  • 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/5545 **Author:** [@Som0111](https://github.com/Som0111) **Created:** 10/20/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feature/inspect-native-api-varargs` --- ### 📝 Commits (3) - [`58a2f92`](https://github.com/morluto/rea/commit/58a2f9240a9465fc9e68a9e3514e4dfb43524bd6) feat(native-api): add varargs field to inspect_native_api boundary (#5523) - [`2f9a754`](https://github.com/morluto/rea/commit/2f9a754822fabda1fcd2636cccc22bfcc59482bb) fix(native-api): make varargs optional for backward compatibility - [`29b8390`](https://github.com/morluto/rea/commit/29b8390f400e84095ad8ae64445f67d4b0ff5dfc) fix(native-api): use .default(null) instead of .optional() to fix JsonValue type error ### 📊 Changes **5 files changed** (+52 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `bridge/ghidra/ReaGhidraBridge.java` (+7 -0) 📝 `scripts/verify-real-ghidra-assertions.mjs` (+8 -1) 📝 `src/domain/ghidraValues.fixture.ts` (+1 -0) 📝 `src/domain/native/nativeApiBoundary.ts` (+1 -0) 📝 `tests/boundary/mcp/ghidraNativeApiMcp.test.ts` (+35 -0) </details> ### 📄 Description ## Summary Fixes #5523 Adds a `varargs: boolean | null` field to the `inspect_native_api` boundary. Agents and tools reading the boundary could not distinguish a variadic function from a fixed-arity one with only its named parameters. ## Problem and expected behavior `inspect_native_api` returned `parameters: [{name: "n", ...}]` for `long f_var(int n, ...)` with no indication the function is variadic. Ghidra's decompiler and DWARF both carry this information; the bridge was not reading it. Expected: boundary includes `varargs: true` for variadic functions, `false` for fixed-arity, `null` when the provider cannot determine it. ## Change and scope Read `Function.hasVarArgs()` in the Ghidra bridge when `signature_source` is `imported` or `user_defined`. Add `varargs: boolean | null` to the boundary schema after `parameters`. No storage is invented for the variadic part. Stripped binaries with no DWARF report `null`. No other provider currently builds this boundary object, so no other provider needed changing. - Semantic owner and earliest changed stage: native boundary schema, Ghidra bridge - Contribution scope fit and linked maintainer decision: read existing files only — not applicable - CLI and MCP/tool-catalog contract: new optional field `varargs` added to boundary output - Provider, bridge, target-format, or platform compatibility: Ghidra only; other providers return `null` - Evidence, artifact, provenance, or reconstruction contract: no change to existing fields - Target selection, authority, upstream behavior, and cleanup details: not applicable - Generated metadata impact: none Expected effects: - [x] 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: 3 new cases in `tests/boundary/mcp/ghidraNativeApiMcp.test.ts` — `f_var` → `true`, fixed-arity → `false`, stripped binary → `null` - Base reproduction: `rea inspect-native-api abi f_var --provider ghidra` returned no varargs field on `rea-agents@6.7.0` - User-visible CLI/MCP output: boundary now includes `varargs: true` for `f_var` - Remaining proof gaps: tests feed fixture dossiers through MCP; the Java bridge logic and a real DWARF binary are not exercised in CI - [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 - `npx vitest run tests/boundary/mcp/ghidraNativeApiMcp.test.ts` — 13/13 passed - `npm run build` — clean, no type errors ## Compatibility, safety, and release - Breaking changes: none — new nullable field, existing fields unchanged - Real Hopper/Ghidra coverage: not available in this environment; fixture-based only - Package or release metadata impact: none - Security, privacy, process, or containment review: not applicable ## Author readiness Human owner: @Som0111 - [x] 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. - [x] 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. ## 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. - [x] Tests cover changed observable behavior and meaningful failure paths. - [ ] 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>
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#6957
No description provided.