OMP: mixed AFT and native tool schemas reject valid filesystem calls
What happened
The OMP adapter publishes a combined schema for AFT filesystem calls and native OMP internal-URL calls. A request can satisfy that schema but fail before it reaches AFT. The same local operation succeeds when the caller omits parameters from the other route or edit mode.
A review of 10 recent OMP sessions, including workers, found 591 failed calls with the exact diagnostic invalid AFT filesystem arguments: 453 Bash, 105 grep, 30 edit, and 3 wrapped calls. These are call counts, not unique incidents. OMP 19.2.1 was recorded where version metadata was available. The adapter is still present on AFT main at df341f683a.
Minimal examples
These examples use synthetic paths and text. The fields on the second line of each example are the incompatible part of the advertised schema.
bash: { command: "pwd", workdir: ".", timeout: 500,
cwd: "", async: false, name: "", ready: { log: "", port: 0, host: "", timeout: 0 } }
grep: { pattern: "example", path: ["src", "tests"],
case: false, gitignore: true, paths: [], skip: null }
edit: { path: "src/example.ts",
edits: [{ oldString: "before", newString: "after", op: "update", rename: "", diff: "" }],
input: "", old_string: "", new_string: "", replace_all: false }
Suggested fixes
- Separate the argument contracts at registration. Publish separate filesystem and native schemas, or use an explicit route selector with separate parameter objects if the host must keep one tool. Test the schema after the provider adapts it. Keep native internal-URL delegation and approval behavior intact. A filesystem call must not require native-only fields. Related: #396.
- Bash compatibility. In
packages/pi-plugin/src/omp-internal-urls.ts, remove only absent or inert native defaults on the filesystem route before validation: blankcwdandname,async: false, and a readiness object with no active fields. Refuse a real native working directory, async request, or service configuration on that route. Keepworkdir,background, and millisecond timeouts unchanged. A local prototype passed 26 adapter tests and the plugin typecheck. It is Bash-only. - Edit modes. In
packages/pi-plugin/src/omp-internal-urls.tsandpackages/pi-plugin/src/tools/hoisted.ts, select the route and the edit mode before validating its fields. Give append, symbol replacement, batch find/replace, and batch line-range edits distinct argument shapes. Do not infer a missing value from empty replacement text: it can mean deletion. Refuse two active modes and never discard a native create, delete, rename, or patch operation to make an AFT edit pass. Test that the observed padded AFT update succeeds while real native operations remain native or are refused on the filesystem route. The logs also contained edit-mode conflicts with empty top-level fields and batch entries that carried fields from both edit modes. - Grep paths and flags. Give AFT grep its own path and paging contract. Do not silently discard
case,gitignore, or a non-nullskip. Support those semantics in AFT only if the implementation honors them. Otherwise expose them only on the native route. Test a local multi-directory search in the supported AFT form, native paging and flags, and a refusal when a caller explicitly requests an unsupported local option.
Add registration-to-dispatch regression tests for the three payload families. Keep an internal-URL test that confirms native delegation. For rejected mutations, assert that no filesystem write occurs.
Other error classes from the same review
| Observation | Suggested disposition |
|---|---|
| 76 failed calls classified an edit target as a glob. 70 requested a path with a bracketed name. | Current main already has literal-path handling and tests for bracketed paths in crates/aft/src/subc_translate.rs. Keep that coverage. Add a host-level fixture if a released build still rejects an existing literal file. Do not allow multi-file line-range or batch edits. |
| 26 Bash calls and two read calls reported a bridge timeout. Six Bash calls reported failure to spawn a background process. Shell-session closures also appeared. | Track separately from input validation. Report whether the request reached the daemon or started a process. Distinguish an invalid working directory or missing executable from a transport failure. Retry only where safe. Do not relaunch a state-changing command when its outcome is unknown. |
| Search reported no ready index lane in four failed calls. Some scope and internal-resource lookups failed. | Report index readiness and distinguish unavailable indexing from no matches. Keep a bounded read-only fallback where the tool supports it. For a valid host URI supplied to a filesystem-only tool, direct the caller to the host tool instead of treating the URI as a disk path. |
| Other failures involved missing paths or symbols, unsupported file types or remote resources, invalid ranges or regexes, edit conflicts or evidence guards, access denials, missing job or undo records, and nonzero child-process exits. | Preserve these checks. These outcomes do not establish a fault in AFT. Keep the diagnostics specific enough to correct the request. |
Draft reply: issue #1534
Posted as the AFT bot. The issue stays open until a release ships the fix.
Thanks for the exact payloads. I reproduced all three on current main through the real tool registration. The schema AFT registers for OMP accepts them, but for ordinary paths AFT's filesystem route refused any OMP-only field that was present, even blank, false, null, zero or an empty array. That's why the calls failed before reaching AFT. Native internal-URL calls weren't affected, and they still go to OMP unchanged.
The fix is in review and will ship in the next AFT release. On the filesystem route, empty native values now count as absent:
- bash: blank
cwdandname,async: false, and an emptyready. - edit: blank top-level native fields,
replace_all: false, andop: "update"with emptyrenameanddiffon an AFT find/replace entry. - grep:
paths: [],skip: nullor0, andgitignore: true(AFT's search already respects ignore files). - grep
case: honoured, socase: falsesearches case-insensitively. - grep
patharray: accepted. Every entry gets the same path and permission checks as the string form.
Values that really ask for OMP behaviour are still refused on the filesystem route: a working directory, async: true, readiness settings, a real rename, diff or patch input, gitignore: false, or a non-zero skip. An edit that mixes two modes is refused too. Empty replacement text is never read as padding, because it can mean a deletion. All three of your payloads are now regression tests.
On the other error classes: we don't see an AFT fault behind the bracketed-path, timeout or spawn counts without a specific case. If you have one on the current version, the exact call and its full error would help. For an existing bracketed file, that's the path and whether the file exists. For a timeout or spawn failure, it's the diagnostic and the task's status. We'll keep the registered schema as it is for now.