[PR #7337] [CLOSED] fix(discovery): require an active target for inspect_address_context #7822

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7337
Author: @viniciusdsandrade
Created: 10/27/2026
Status: ❌ Closed

Base: main ← Head: fix/7310-inspect-address-context-target-required


📝 Commits (4)

  • 57a079f fix(discovery): require an active target for inspect_address_context
  • 9beeec5 test(discovery): assert inspect_address_context target requirement
  • 26dffe8 test(discovery): isolate address context availability test block
  • b54b646 Merge remote-tracking branch 'upstream/main' into fix/7310-inspect-address-context-target-required-merge

📊 Changes

4 files changed (+38 additions, -5 deletions)

View changed files

📝 src/application/CapabilityInventory.test.ts (+25 -0)
📝 src/application/CapabilityInventory.ts (+4 -0)
📝 src/contracts/sessionToolContracts.ts (+8 -5)
📝 tests/boundary/mcp/serverWorkflowMcp.test.ts (+1 -0)

📄 Description

Summary

Fixes #7310. In a session without an active target (open: false), binary_session advertised inspect_address_context as available: true, but calling the tool immediately failed with target_unavailable because address context queries execute against an active binary target. This marks inspect_address_context as requiring an active target in SESSION_TOOL_CONTRACTS and evaluates target availability during capability discovery, reporting available: false, reason: "target_required", and remediation to call open_binary when no target is open.

Current main (d48e472fa) is merged into the branch with no code changes beyond the merge; main still advertises inspect_address_context without requiresActiveTarget.

Problem and expected behavior

Trigger: call binary_session in a clean session without an open target.

Observed: binary_session reports inspect_address_context with available: true, reason: "available", and remediation: null. Calling inspect_address_context immediately with {"address": "0x1000"} returns isError: true and target_unavailable, directing the caller to open_binary.

Expected: before a target is opened, inspect_address_context reports available: false, reason: "target_required", and remediation: "Call open_binary with a supported local target.", matching its sibling get_navigation_context.

Change and scope

  • src/contracts/sessionToolContracts.ts: add requiresActiveTarget: true to the inspect_address_context contract.
  • src/application/CapabilityInventory.ts: in availabilityFor, evaluate targetAvailability(context) for inspect_address_context, returning the target decision when present and falling back to available when a target is open.
  • src/application/CapabilityInventory.test.ts: add unit tests asserting that inspect_address_context requires an active target when closed, sets requiresActiveTarget on its contract, and reports available once an executable target is open.
  • tests/boundary/mcp/serverWorkflowMcp.test.ts: assert that inspect_address_context is excluded from available tools in a clean session.

Contract and boundary impact

  • Semantic owner and earliest changed stage: SESSION_TOOL_CONTRACTS in src/contracts/sessionToolContracts.ts and availabilityFor in src/application/CapabilityInventory.ts.
  • Contribution scope fit and linked maintainer decision: not applicable; bug fix within existing capability discovery.
  • CLI and MCP/tool-catalog contract: inspect_address_context now declares requiresActiveTarget: true and reports reason: "target_required" before a target is open.
  • Provider, bridge, target-format, or platform compatibility: not applicable.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), 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: src/application/CapabilityInventory.test.ts, tests/boundary/mcp/serverWorkflowMcp.test.ts.
  • Base reproduction or other evidence: issue #7310 reproduction; verified by code reading across src/contracts/sessionToolContracts.ts, src/application/CapabilityInventory.ts, and src/server/registerSessionTools.ts.
  • User-visible CLI/MCP output: binary_session reports inspect_address_context under target_required when open: false.
  • Remaining proof gaps: no real provider run; the change only affects discovery before a target is open.

Validation performed

On the updated branch (merged with main at d48e472fa; Node 24.22.1, macOS arm64):

  • npm run test:focused -- src/application/CapabilityInventory.test.ts tests/boundary/mcp/serverWorkflowMcp.test.ts tests/composition/analysis-sessions/providerBinding.test.ts tests/boundary/mcp/workflowSnapshotReplayMcp.test.ts: 4 files, 62 tests passed. The last two suites are the ones that failed in the previous CI run of this PR; they failed on main at that base for every job and pass on the current base.
  • npm run check:fast: typecheck and lint passed.
  • Not run: the full check:pr gate and any real provider workflow.

Compatibility, safety, and release

  • Breaking changes or migration steps: none; aligns advertised readiness with actual runtime prerequisite.
  • Real Hopper/Ghidra, browser, or OS coverage: platform-independent.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no security boundaries or sensitive data affected.

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.

🔄 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/7337 **Author:** [@viniciusdsandrade](https://github.com/viniciusdsandrade) **Created:** 10/27/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/7310-inspect-address-context-target-required` --- ### 📝 Commits (4) - [`57a079f`](https://github.com/morluto/rea/commit/57a079f6fa5aadf54fbeba8bd0b2d5ca88291bb9) fix(discovery): require an active target for inspect_address_context - [`9beeec5`](https://github.com/morluto/rea/commit/9beeec5da30f9330812e673ea82ed5d0cbadd460) test(discovery): assert inspect_address_context target requirement - [`26dffe8`](https://github.com/morluto/rea/commit/26dffe8a03f1ed9862a1770ed2cf45cd8b2d9a8c) test(discovery): isolate address context availability test block - [`b54b646`](https://github.com/morluto/rea/commit/b54b646e4a20a97bd772b7159ca385019010a307) Merge remote-tracking branch 'upstream/main' into fix/7310-inspect-address-context-target-required-merge ### 📊 Changes **4 files changed** (+38 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/application/CapabilityInventory.test.ts` (+25 -0) 📝 `src/application/CapabilityInventory.ts` (+4 -0) 📝 `src/contracts/sessionToolContracts.ts` (+8 -5) 📝 `tests/boundary/mcp/serverWorkflowMcp.test.ts` (+1 -0) </details> ### 📄 Description ## Summary Fixes #7310. In a session without an active target (open: false), binary_session advertised inspect_address_context as available: true, but calling the tool immediately failed with target_unavailable because address context queries execute against an active binary target. This marks inspect_address_context as requiring an active target in SESSION_TOOL_CONTRACTS and evaluates target availability during capability discovery, reporting available: false, reason: "target_required", and remediation to call open_binary when no target is open. Current `main` (`d48e472fa`) is merged into the branch with no code changes beyond the merge; `main` still advertises `inspect_address_context` without `requiresActiveTarget`. ## Problem and expected behavior Trigger: call binary_session in a clean session without an open target. Observed: binary_session reports inspect_address_context with available: true, reason: "available", and remediation: null. Calling inspect_address_context immediately with {"address": "0x1000"} returns isError: true and target_unavailable, directing the caller to open_binary. Expected: before a target is opened, inspect_address_context reports available: false, reason: "target_required", and remediation: "Call open_binary with a supported local target.", matching its sibling get_navigation_context. ## Change and scope - src/contracts/sessionToolContracts.ts: add requiresActiveTarget: true to the inspect_address_context contract. - src/application/CapabilityInventory.ts: in availabilityFor, evaluate targetAvailability(context) for inspect_address_context, returning the target decision when present and falling back to available when a target is open. - src/application/CapabilityInventory.test.ts: add unit tests asserting that inspect_address_context requires an active target when closed, sets requiresActiveTarget on its contract, and reports available once an executable target is open. - tests/boundary/mcp/serverWorkflowMcp.test.ts: assert that inspect_address_context is excluded from available tools in a clean session. ## Contract and boundary impact - Semantic owner and earliest changed stage: SESSION_TOOL_CONTRACTS in src/contracts/sessionToolContracts.ts and availabilityFor in src/application/CapabilityInventory.ts. - Contribution scope fit and linked maintainer decision: not applicable; bug fix within existing capability discovery. - CLI and MCP/tool-catalog contract: inspect_address_context now declares requiresActiveTarget: true and reports reason: "target_required" before a target is open. - Provider, bridge, target-format, or platform compatibility: not applicable. - Evidence, artifact, provenance, or reconstruction contract: unchanged. - Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable. - Generated metadata (docs/public/product-catalog.json), 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: src/application/CapabilityInventory.test.ts, tests/boundary/mcp/serverWorkflowMcp.test.ts. - Base reproduction or other evidence: issue #7310 reproduction; verified by code reading across src/contracts/sessionToolContracts.ts, src/application/CapabilityInventory.ts, and src/server/registerSessionTools.ts. - User-visible CLI/MCP output: binary_session reports inspect_address_context under target_required when open: false. - Remaining proof gaps: no real provider run; the change only affects discovery before a target is open. ## Validation performed On the updated branch (merged with `main` at `d48e472fa`; Node 24.22.1, macOS arm64): - `npm run test:focused -- src/application/CapabilityInventory.test.ts tests/boundary/mcp/serverWorkflowMcp.test.ts tests/composition/analysis-sessions/providerBinding.test.ts tests/boundary/mcp/workflowSnapshotReplayMcp.test.ts`: 4 files, 62 tests passed. The last two suites are the ones that failed in the previous CI run of this PR; they failed on `main` at that base for every job and pass on the current base. - `npm run check:fast`: typecheck and lint passed. - Not run: the full `check:pr` gate and any real provider workflow. ## Compatibility, safety, and release - Breaking changes or migration steps: none; aligns advertised readiness with actual runtime prerequisite. - Real Hopper/Ghidra, browser, or OS coverage: platform-independent. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no security boundaries or sensitive data affected. ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-05 01:47:56 +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#7822
No description provided.