Skip to content

fix(cli): reject empty native-call targets - #7464

Closed
ducanhnguyen223 wants to merge 1 commit into
morluto:mainfrom
ducanhnguyen223:codex/fix-7448-observe-empty-target
Closed

ducanhnguyen223 wants to merge 1 commit into
morluto:mainfrom
ducanhnguyen223:codex/fix-7448-observe-empty-target

Conversation

@ducanhnguyen223

Copy link
Copy Markdown
Contributor

Summary

Fixes #7448. Reject an empty observe-native-calls target at CLI argument validation so it cannot be normalized to the current directory. Reuses REA's shared nonempty, NUL-free local-path schema; an explicit . remains valid.

This is an AI-assisted draft. The human PR owner is @ducanhnguyen223; the author-readiness declarations below are intentionally unchecked pending human review.

Problem and expected behavior

The issue reports that an empty target can resolve to the working directory and, when that is an app bundle, launch its executable under LLDB. On the unmodified base, a local compiled-CLI call with an empty target and invalid observation JSON reached domain validation (invalid_request, missing breakpoints) instead of failing at the path boundary. That request did not launch a process. The fix should reject the empty path before the handler; explicit . must continue to mean the caller-selected working directory.

Change and scope

Use localPathStringSchema for the CLI's path argument. This is a focused correction to the existing command boundary; valid nonempty target execution and the MCP contract are unchanged. It adds no provider or capability and requires no separate maintainer scope decision.

Follow the contribution scope. This does not change target authority for valid invocations.

Contract and boundary impact

  • Semantic owner and earliest changed stage: observe-native-calls CLI argument schema, before its handler or target resolution.
  • Contribution scope fit and linked maintainer decision: ordinary input-validation fix within existing behavior; no new capability or separate scope decision.
  • CLI and MCP/tool-catalog contract: CLI rejects empty path; explicit . is accepted. MCP is unchanged.
  • Provider, bridge, target-format, or platform compatibility: no provider-specific changes.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup: valid invocations still use the existing owned LLDB workflow; an empty selection is now rejected before target resolution or launch.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Launch or attach to a process (existing valid-input behavior is unchanged; the reported unintended empty-path launch is prevented).

Evidence and regression coverage

  • Tests added or updated: tests/boundary/cli/nativeCallTargetAdmission.test.ts exercises the public compiled CLI, asserts an empty target yields VALIDATION_ERROR on path with too_small, and confirms . advances to observation-input validation without launching LLDB.
  • Base reproduction or other evidence: before the fix, an empty target passed CLI parsing and reached domain validation; the regression failed because it did not receive the path error. The issue's supplied synthetic-app reproduction reports the target-launch case; this PR did not independently run that LLDB reproduction.
  • User-visible CLI output: after the fix, observe-native-calls "" "{}" --json returns VALIDATION_ERROR with fieldErrors.path / too_small. The explicit . control reaches the expected breakpoints validation error.
  • Remaining proof gaps: no independent valid-target LLDB run; no MCP change is proposed.

Validation performed

  • fnm exec --using=24.22.1 npm run test:focused -- tests/boundary/cli/nativeCallTargetAdmission.test.ts — 1 test passed.
  • fnm exec --using=24.22.1 npm run check:fast — typecheck and lint tasks passed.
  • fnm exec --using=24.22.1 npm exec -- oxfmt -- --check src/cli/nativeCallCommands.ts tests/boundary/cli/nativeCallTargetAdmission.test.ts — passed.
  • git diff --check — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none intended; an empty target is invalid input, while explicit . remains supported.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable to the CLI admission check; LLDB was not run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new execution authority; the change prevents the empty-path case from selecting and launching an unintended working-directory target.

Author readiness

Human owner: @ducanhnguyen223

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

@greptile-apps

greptile-apps Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The code appears safe to merge; no actionable issue was found.

Summary

observe-native-calls now uses the shared localPathStringSchema to reject an empty target while preserving explicit ..

  • The native-call CLI rejects empty targets and still accepts an explicit current directory.

Reviews (1) · Last reviewed commit: "fix(cli): reject empty native-call targe..." · Reviewed by Greptile

@CassieFox23

Copy link
Copy Markdown
Contributor

TL;DR: The new test passes on Node 22.23.4, 24.22.1 and 26.12.1 at draft head b61e5d6. With the old src/cli/nativeCallCommands.ts, the test fails on all three versions. CI and PR title still wait for a maintainer to approve them.

Check Node 22.23.4 Node 24.22.1 Node 26.12.1
Head b61e5d6, tests/boundary/cli/nativeCallTargetAdmission.test.ts pass (1 file, 1 test) pass (1 file, 1 test) pass (1 file, 1 test)
Red run: head with src/cli/nativeCallCommands.ts from 9842299 fail (1 test failed) fail (1 test failed) fail (1 test failed)

The failing test in the red run is rejects an empty native-call target before launch while accepting an explicit current directory. So the new test fails without the fix and passes with it.

CI on b61e5d6: CI and PR title wait for a maintainer to approve them (action_required). Greptile Review and Validate author declaration passed. The PR readiness workflow passed, but its commit status is pending.

The head is 733 commits behind main b81da90. GitHub says the PR is mergeable, and its merge state is blocked.

Not run

  • rea native-call against a real binary.
  • A merge with current main, b81da90.
Test setup
  • Box: Fedora 44 VM (4 vCPUs, 8 GB) on my Nobara 44 PC, Linux 7.2.11
  • Node: 22.23.4, 24.22.1, 26.12.1
  • Head / base: b61e5d6 / 9842299 (merge base with main)
  • Red run: b61e5d6 with src/cli/nativeCallCommands.ts from 9842299
  • Install: npm ci --offline and npm run test:prepare on Node 24.22.1, exit 0, for both trees
Commands
npm ci --offline
npm run test:prepare
xvfb-run -a npm run test:focused -- tests/boundary/cli/nativeCallTargetAdmission.test.ts

🤖 Written and tested with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊

@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Thank you for this fix. The same change is on main: #9465 (25d3c72) makes observe-native-calls take its target from the non-empty local path contract, so an empty target is refused during validation before anything launches. The regression is in tests/acceptance/localPathAdmissionCli.test.ts. Closing as superseded. Please reopen if you still see an empty target get through on current main.

@morluto morluto closed this Nov 15, 2026
@morluto morluto added area: cli CLI adapter and one-shot commands bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] observe-native-calls launches the working app when its target is empty

3 participants