fix(desktop): clean ANSI escapes from agent log tail + drop dead AppHandle plumbing#756
Merged
Conversation
The agent harness (sprout-acp) emits colorized tracing output. When its stdout/stderr is redirected to a log file by the desktop spawn path, the ANSI escape codes get baked into the file and render as `ESC[2m`-style gunk in the log viewer's <pre>. Strip the escapes in `read_log_tail` (desktop-only) using the `strip-ansi-escapes` crate, which delegates to `vte` — the same terminal parser Alacritty uses. Handles CSI, OSC, DCS, and C1 codes correctly, where a hand-rolled scrubber would silently mangle them. Leaves sprout-acp's logging untouched so terminals, `tail -f`, and CI remain colorized. Signed-off-by: Wes <wesbillman@users.noreply.github.com>
The `app: Option<&AppHandle>` parameter was threaded through five functions in `managed_agents/discovery.rs` (`command_search_dirs`, `resolve_workspace_command`, `resolve_command`, `resolve_command_uncached`, `command_availability`) and never read by any of them. This produced an unused-variable warning and carried ghost intent across the public API. Remove the parameter at every layer, drop the now-unused `AppHandle` imports, and update the six call sites in `agent_discovery`, `agent_models`, `media`, and `runtime`. The `discover_managed_agent_prereqs` Tauri command no longer needs the injected `AppHandle` either. If a future change needs `AppHandle` (e.g. for `resolve_resource` to locate bundled sidecars), threading it back in will be a self-documenting diff rather than dead plumbing. No behavior change. Signed-off-by: Wes <wesbillman@users.noreply.github.com>
Collaborator
Author
|
BEFORE: AFTER: |
This was referenced May 28, 2026
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
Two related fixes for the desktop agent log viewer:
sprout-acp) emits colorized tracing output. When its stdout/stderr is redirected to a log file by the desktop spawn path, the escape codes get baked into the file and render asESC[2m-style gunk in the desktop log viewer's<pre>.AppHandleplumbing in command discovery. While in the area, removed a deadapp: Option<&AppHandle>parameter that was threaded through five functions inmanaged_agents/discovery.rsand never read at any layer. The unused-variable warning that surfaced this is now silenced.How
read_log_tailindesktop/src-tauri/src/managed_agents/storage.rspipes the buffer throughstrip-ansi-escapes::strip_strbefore returning. The crate delegates tovte— the same terminal parser Alacritty uses — so it correctly handles CSI, OSC, DCS, and C1 codes that a hand-rolled scrubber would silently mangle.sprout-acpitself is not changed. Terminals,tail -f, CI logs, etc. still get the colors.app: Option<&AppHandle>is removed fromcommand_search_dirs,resolve_workspace_command,resolve_command,resolve_command_uncached, andcommand_availability. All six call sites (agent_discovery,agent_models,media,runtime) updated. Thediscover_managed_agent_prereqsTauri command no longer needs the injectedAppHandleeither. Frontend invoke contract unchanged.Why
strip-ansi-escapesis one line, well-maintained, and the standard Rust answer (~70M downloads). Net new transitive dep is justvte.AppHandleparameter was carrying ghost intent across the public API. If a future change needsAppHandle(e.g.resolve_resourcefor bundled sidecars), threading it back in will be a self-documenting diff rather than dead plumbing.Tests
storage.rscovers a typical colorized tracing line.cargo check --no-default-featuresclean with no warnings.