feat(tools,core): background shell execution and completion notifications#3352
Merged
feat(tools,core): background shell execution and completion notifications#3352
Conversation
4646928 to
6e3c3ba
Compare
6782e98 to
2f54d01
Compare
…notifications Add background=true parameter to bash tool: commands spawn immediately and return a run_id stub; completion is delivered as a synthetic user-role block prepended to the next user message (N1 invariant: single user-role block satisfies Anthropic strict alternation). Buffer cap 32 with drop-oldest + sentinel on overflow. New ShellExecutor methods: spawn_background, shutdown, with_background_completion_tx. ToolEventTx changed to bounded mpsc::Sender (cap 1024). New config fields: tools.shell.max_background_runs (default 8) and background_timeout_secs (default 1800). New TaskClass::BackgroundShell isolated from Enrichment tasks. Add per-turn completion notifier: fires after channel.flush_chunks() via macOS osascript (stdin-fed, injection-safe via control-char strip + U+2028/U+2029 + quote strip) and/or ntfy-compatible JSON webhook. Gate: enabled switch, zero-LLM-success skip, only_on_error, min_turn_duration_ms (bypassed for errors). Webhook URL validated for HTTPS scheme at startup (SSRF prevention). New zeph notify test CLI subcommand and /notify-test slash command. New [notifications] config section. Closes #3328, #3329
… for MSRV/rustdoc CI
…ith plain backtick refs
b04a6d4 to
932e5cb
Compare
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.
Summary
bashtool acceptsbackground: trueparameter. Commands spawn immediately and return arun_idstub to close thetool_use_id. Completion is delivered as a synthetic user-role block prepended to the next user message (N1 invariant: merged into single block to satisfy Anthropic strict alternation). Buffer cap 32 with drop-oldest + sentinel on overflow.channel.flush_chunks()via macOS osascript (stdin-fed, injection-safe) and/or ntfy-compatible JSON webhook. Gated by: enabled switch, zero-LLM-success skip,only_on_error,min_turn_duration_ms. Webhook URL validated for HTTPS at startup (SSRF prevention). Newzeph notify testCLI and/notify-testTUI command.Key design decisions
sanitize_applescript_payload: strips",\, U+2028, U+2029 (AppleScript has no backslash escaping)ToolEventTxchanged from unbounded to boundedmpsc::Sender(cap 1024)Test plan
cargo nextest run --workspace --lib --bins— 8323 tests passcargo clippy --workspace -- -D warnings— cleancargo +nightly fmt --check— cleanzeph notify testfires macOS notificationfile://scheme → startup warning, no POST.local/testing/playbooks/background-shell-notifications.mdfor full scenariosCoverage
New rows added to
.local/testing/coverage-status.mdwith statusUntestedfor live scenarios.Closes #3328, #3329