Repository navigation
feat(tools): run_command + uteke first-class + startup probing (B4/B5) - #45
Merged
Merged
Conversation
run_command (B4): generic dynamic tool, owner-approved design. Input command line is split to argv with a shlex-compatible subset (single/ double quotes, backslash escapes) — NO shell, so pipes/&&/redirects are literal characters. Runs cwd-jailed to the session dir with the hard subprocess timeout. Risk ceiling is structurally Write. The approval prompt shows the exact argv: what you approve is what runs. 9 tests incl. jail cwd + exit-code passthrough + unterminated-quote errors. uteke first-class (B4): UtekeRecallTool (B5 rename of uteke_search — the name now matches the verb; gains real room-scoped recall via 'uteke room recall <room> <query>', which the old spec advertised but never wired) + UtekeDocumentTool (owner's markdown-to-room workflow: doc create via stdin — no argv length limits, no content in ps output — then room add-document; slug/room validated against leading-hyphen argv-flag injection). 11 tests. Startup probing (B4): binary_available() gates CLI-backed tools; a missing uteke binary degrades to an explicit warning — no phantom tools that fail on every call. Live validation: run_command approved and executed (uname -s → Linux) via the interactive gate; uteke_recall called room-scoped from the durable log; the host's broken uteke binary surfaced its error to the model gracefully and the conversation survived.
| })) | ||
| } | ||
|
|
||
| fn execute(&self, input: Value) -> Result<Value, String> { |
| if !out.status.success() { | ||
| let stderr = String::from_utf8_lossy(&out.stderr); | ||
| let snippet: String = stderr.chars().take(500).collect(); | ||
| return Err(format!( |
| } | ||
|
|
||
| // 2) Link to the room when one is resolved. | ||
| let mut linked = false; |
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
1. Pipe deadlock (uteke.rs): doc-create wrote markdown to the child's stdin while stdout/stderr sat unread — classic pipe-buffer deadlock for large documents or chatty CLIs. New shared helper run_with_timeout_stdin: writer thread for stdin, drain threads for stdout/stderr, hard timeout. Regression test feeds stdin AND reads 200KB of output simultaneously. 2. Missing timeout (uteke.rs): doc-create bypassed run_with_timeout — a hung uteke would freeze the agent loop forever. Now on the same SUBPROCESS_TIMEOUT ceiling as every other invocation. 3. Inconsistent room validation (uteke.rs): UtekeRecallTool passed input[room] straight into argv — a model-supplied '--json' would be parsed as a CLI flag. Recall now applies the same leading-hyphen + charset defense as the document tool. 2 regression tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
run_command(B4 — owner-approved design, TOML DSL rejected for UX): generic dynamic tool. The command line is split to argv with a shlex-compatible subset (single/double quotes, backslash escapes) — no shell, so pipes/&&/redirects are literal argv characters. Runs cwd-jailed to the session dir with the hard subprocess timeout. Risk ceiling structurallyWrite. The approval prompt shows the exact argv — what you approve is what runs.Uteke first-class (B4/B5):
UtekeRecallTool— the B5 rename ofuteke_search(name now matches the verb) plus a real fix: the old spec advertised aroomparameter thatexecutesilently ignored; recall is now genuinely room-scoped viauteke room recall <room> <query> --json.UtekeDocumentTool— the owner's markdown-to-room workflow:doc createwith content piped via stdin (no argv length limits, no document content visible inps), thenroom add-document; slug and room are validated against leading-hyphen argv-flag injection (--jsonas a slug passes a charset check but would be parsed as a flag).Startup probing (B4):
binary_available()gates CLI-backed tools — a missingutekebinary degrades to an explicit warning at startup, never phantom tools that fail on every call.Why
B4/B5 close Track B of the v1.1 roadmap: dynamic tools without a DSL (generic + approval-gated beats config-as-code for this product), uteke as the only first-class memory integration, and honest startup behavior when engines are absent.
Testing
run_command— approval prompt showedrun: uname -s, approved, executed, answeredLinux; (2)uteke_recallcalled room-scoped ({"query":"tole","room":"tole-dev"}) — visible in the durable log; (3) this host'sutekebinary is binfmt-broken, and the error was surfaced to the model as a tool error while the session survived — graceful degradation by design. The uteke CLI contract (doc create --file -,room add-document) was verified directly from the uteke source (cli.rs + docs/cli-reference.md).