Skip to content

fix: align local file operands with built-in decoding - #2095

Merged
JAORMX merged 1 commit into
mainfrom
fix/2094-local-file-operands
Oct 5, 2026
Merged

JAORMX merged 1 commit into
mainfrom
fix/2094-local-file-operands

Conversation

@JAORMX

@JAORMX JAORMX commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Relates to #2094.

  • Decode local-file operands with the same typed session.ParseArgs semantics used by built-in tools, including case variants, duplicate keys, nulls, and operand type errors.
  • Return both Copy/Move operands or neither; preserve restricted Shell-script recognition and custom/MCP non-inference.
  • Verify actual built-in execution against extracted operands, and prove contextual evidence and dependency revalidation follow the executed target.

This is a direct bug fix under the operator-approved scope, with no new acceptance plan, exported signatures, tool schemas, or global argument-validation policy. Operand extraction intentionally does not validate unrelated tool arguments.

Verification

Passed:

  • Focused regressions and race tests for engine/adapter/fstools, engine/agent, and internal/app.
  • Full task lint (the first 600-second attempt timed out; a subsequent run with a larger budget passed).
  • task docs.
  • task api:update — no API snapshot changes.
  • go run ./cmd/mecademo — tool call, permission ask/approval, and result demonstrated.
  • git diff --check.

Local full task test and task test:race did not pass: existing cmd/mecatui embedded-socket fixtures reject this checkout's path length. compositionScratchRoot requires a generated socket path shorter than 100 bytes; neither the worktree nor its main-checkout ancestor satisfies that bound.

CI completed successfully for 568216f254e5c472926b67a190660cf20b63a3a1: all executed checks passed, including the non-race draft test suite, analysis, build, docs, API compatibility, standalone modules, MicroVM checks, and the PR performance gate. Draft CI does not run the full race suite; that qualification remains outstanding. This PR remains draft.

Review and remaining scope

Four-axis review found no blocking in-scope code defects. The outstanding important finding is the dependency/invariant amendment in the separate hierarchy plan PR #2092: applicability targets must match effective executed operands. This PR does not copy or modify that separate plan.

The previously identified discrepancies in authorityPathNamed, nonShellPattern, and ShellCommandFromArgs are separate security companion work. This patch does not claim to resolve those enforcement paths or qualify a production permission bypass.

Documentation

The owning artifact for library consumers is engine/CHANGELOG.md, updated under Fixed. No public configuration or workflow changes; generated references and API snapshots are unchanged.

Use typed operand decoding for contextual evidence and target selection. Cover actual built-in execution, complete transfer operands, and selected-target evidence and dependency revalidation.

Relates to #2094

Co-authored-by: Mecatl <[email protected]>
@JAORMX
JAORMX marked this pull request as ready for review October 5, 2026 09:35

@jhrozek jhrozek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. LocalFileOperands now decodes through the same session.ParseArgs struct path as the built-in tools, so review and execution select the same operand (case variants, duplicate keys, null, Unicode folding). Both callers (actionreview.go, contextual_evidence.go) follow the executed target, and custom/MCP non-inference is preserved. The tests check against real built-in execution on memfs, which is the right oracle.

Optional nit: the "wrong-typed unrelated field still yields the operand" case is pinned only for Read (offset). Rows for Shell timeout_ms:"x" and for null / [] / empty args would guard against a future change in failure policy.

The test:race qualification noted in the description is still outstanding before this leaves draft.

@JAORMX
JAORMX merged commit f8b2d7f into main Oct 5, 2026
64 checks passed
@JAORMX
JAORMX deleted the fix/2094-local-file-operands branch October 5, 2026 10:52
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 7, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants