Repository navigation
fix(ui): show a relayed agent's file changes in Outputs, Changes and Undo - #5553
Conversation
Files the flagship sidecar wrote never showed in the session panel's Outputs: the relay emitted tool events straight onto the queue and skipped the turn ledger the summary is built from, and the summary view a relayed result is reduced to dropped the resolved path the tool returned.
|
Verdict: Approve with suggestions Files the agent writes in a desktop (relayed) chat now show up in the chat's Outputs panel. Before this, the relay never recorded the turn's tool calls, so Outputs stayed on "Nothing yet". The fix is small. It reuses the bookkeeping the in-process path already has, and the new tests run a write through the real sidecar handler, translator and relay. I found no correctness problems.
Real-world evidenceN/A: no evidence bundle was produced for this run. The verdict rests on static review alone. The user-visible surface is the Agent UI Outputs panel, and its live check is still pending in the PR's test plan. I couldn't run the unit tests either, because this runner has no pytest installed. 🔍 Technical detailsIssues 🟡 No live evidence for an Agent UI change. This changes what the Outputs panel shows, but the PR has no screenshot and no captured route or response for a relayed turn. The unit tests cover the logic end to end (sidecar 🟢 Relay skips the dict check the in-process path has ( Strengths
|
…Undo Desktop chats run in the flagship sidecar, which never copied the files a turn changed, so the Changes view and per-answer Undo stayed empty. The Agent UI now sends a turn id on /query (contract 2.19, changes_turn_id); the sidecar records that turn's changes in the shared snapshot store and finishes the recording before its terminal event. The UI links the turn to its answer through a file beside the manifest, so the two processes never write the same file.
A refused confirmation ended the stream before the recording was saved, and an end state that failed to save left the turn looking interrupted. The refusal now saves it first, and a failed save is tried again when the run ends.
server.py moved to 2.19 for changes_turn_id, but the npm package still declared 2.18, so its contract test failed on every platform.
|
Fixed the npm package build: the package still declared contract 2.18 after the agent moved to 2.19. I didn't apply the suggested args guard, because replacing a malformed event with
🔍 Technical details
|
…-folders Main shipped contract 2.19 for changes_turn_id (amd#5553), so surface moves to contract 2.20: the server, relay floor, npm API_VERSION, OpenAPI artifact, bundled docs and tests now say 2.20, and the relay sends both fields to a sidecar that takes them.
In a private chat, "Please remember …" was correctly not saved, but the session panel's Outputs still listed "Memory saved" for that turn: a false claim on a privacy feature. A relayed turn's tool results reach the Agent UI as a summary view that kept only the summary text and `success`, so the turn summary never saw that `remember` returned `status: "skipped"`. The summary view now carries the tool's own `status`, so a skipped save, and any other tool that reports a skip, is no longer listed as made. <details> <summary>🔍 Technical details</summary> - Fixed at the wire, not by string-sniffing `"skipped:"` in `TurnSummary`: `SSEOutputHandler.pretty_print_json` puts the result's `status` on the `tool_result` event, and `SUMMARY_VIEW_KEYS` carries it into the canonical `data`. `TurnSummary._produced` already skips `error`/`skipped`, so it needs no change. - Sidecar contract: an additive field on `tool_result.data`, so there's no `API_VERSION` bump. The gaia npm CHANGELOG notes it. It takes effect once the sidecar binary is rebuilt. An older sidecar still sends no `status`, and its skipped saves stay listed. - Other Outputs kinds: `error` results were already dropped (they fail `success`), so only a `skipped` status leaked. In practice that's `remember`. `generate_image`, the index tools and `schedule_send` never return `skipped`, and the generic fix covers them if they ever do. The email sidecar has its own translator and isn't touched here. - On `main` the relay doesn't feed the turn ledger yet; amd#5553 adds that, and this is the bug that shows up once it does. The two merge cleanly in code. Both edit the same lines in `agent-ui.mdx` and the CHANGELOG, so whichever lands second needs a small rebase. Checked on a local merge of the two: a relayed skipped `remember` gives no outputs, and a stored one gives "Memory saved". </details> ## Test plan - [x] `pytest tests/unit/test_sidecar_relay_fidelity.py`: new pipeline tests (sidecar handler → canonical translator → relay → turn ledger). A private chat's skipped `remember` lists nothing, and a stored one is still listed. The skipped case fails on `main`. - [x] `pytest tests/unit/chat/ui` plus the relay suites (`test_email_sidecar_relay`, `test_relay_*`, `test_daemon_relay`), `tests/unit/api`, and the SSE narration/usage tests: all pass. - [x] `python util/lint.py --black --isort` - [x] Desktop app with a rebuilt sidecar: in a private chat, a "please remember…" message is refused and Outputs shows no "Memory saved"; in a normal chat a real save shows it ## Live evidence Desktop app, re-frozen gaia-agent sidecar: the private chat refuses the save, and Outputs stays empty.  --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]>
…d#5561) When the agent deleted a file with a shell command (`del notes.txt`, `rm notes.txt`, `Remove-Item notes.txt`), the turn's Changes view only said it ran a command GAIA can't track, and Undo couldn't bring the file back. Now a plain delete of named files in the workspace shows each file as deleted, with its old contents in the diff, and Undo this turn restores it. A delete GAIA can't read exactly (a wildcard, a variable, a folder, a file outside the workspace, or extra steps on the line) still shows as untracked shell work, so Undo never claims more than it has. Relayed (desktop) chats get this once amd#5553 lands: the shell tool records into the same turn recorder the sidecar opens there. On `main` today, relayed turns record nothing at all, shell or otherwise. ## Test plan - [x] `pytest tests/unit/test_shell_undo_marks.py`: `del`/`rm` of a workspace file shows as deleted by `run_shell_command`, with no untracked entry, its old text in the diff, and `restore_turn` puts it back. `del *.txt` stays untracked with no files. Deleting a file outside the allowed paths stays untracked and isn't recorded as restorable. A copy that fails leaves the file and doesn't run the command. - [x] `pytest tests/unit/agents/test_shell_deletes.py`: which delete forms are read (cmd, sh, PowerShell) and which are left as unknown. - [x] On top of amd#5553's branch, a stand-in sidecar agent that runs the real shell tool with `del notes.txt` under `changes_turn_id`: the relayed turn lists the file as deleted, with no untracked work, and Undo restores it. This was a local check only, not added here, because it depends on amd#5553. - [x] `pytest tests/unit/test_shell_*.py tests/unit/chat tests/unit/agents -n 4`: 7688 passed. There was 1 setup error from a thread left running by an earlier test (`test_step_timing`), and that test passes when run alone. `origin/main` also had 1 setup error in the same run, in a different test (`test_email_phishing_guard`). - [x] `python util/lint.py --black --isort --pylint --flake8` <details> <summary>🔍 Technical details</summary> - Approach: parse the delete, not diff the tree. A before/after file list can show that a file vanished, but it has no copy of the contents to restore. Copying the whole tree before every command would be unbounded. - `shell_deletes.split_exact` splits a step the way cmd.exe or sh will hand it to the program. It returns None for anything that could expand or re-split: `%`, `^`, `!`, `*`, `?`, `$`, backticks, `~`, redirections, cmd's `,;=` name separators, or single quotes under cmd. `delete_operands` reads `del`/`erase` (`/f`, `/q`), `rm` (`-f`, `-v`, `--`), `unlink`, and `powershell`/`pwsh` running one `Remove-Item` statement (`-Path`/`-LiteralPath`/positional, `-Force`, `-Confirm:$false`). Recursive flags, `/s`, `/p`, `-i`, drive-relative paths, ADS/device paths and names Windows trims are all refused. - `ShellToolsMixin._snapshot_shell_deletes` runs where `note_untracked("shell", …)` used to, after the cancel check and before anything spawns. It calls `before_change(path, "run_shell_command")` for each operand that is a regular file (not a link), at most 64 MiB, outside credential folders, and inside `_path_allowed(..., prompt_user=False)`. The untracked note is skipped only when every step is a `cd` or a fully copied delete. A `SnapshotError` returns NOT_EXECUTED, the same rule the file tools follow. - The one-time-approval path (raw shell text) is unchanged. Destructive lines are never offered there anyway. - Deletes in the existing turn ledger already come through as `change: "deleted"` with a diff, and the webui already renders that, so there's no frontend change. </details>
In the desktop app, a file the flagship agent wrote never reached the chat's session panel. Outputs stayed on "Nothing yet", and Changes and Undo had nothing to show. Desktop chats run in the daemon's agent sidecar and the Agent UI relays them. The relay skipped the bookkeeping that Outputs is built from, and the sidecar never kept copies of the files it changed. Now a relayed turn's written and deleted files show under the answer that changed them, in Outputs and Changes, and that answer's Undo puts them back.
/query(contract 2.19,changes_turn_id). The sidecar copies each file before changing it, into the same undo store the Agent UI reads, and finishes before it reports the turn done. An older sidecar is never sent the field. Its turns still show in Outputs, just without Changes or Undo.del notes.txt) still show as "untracked shell work" rather than as a deleted file. In-process chats behave the same way, because the shell tool doesn't copy files before running a command./greeting) merges first, this PR moves to 2.20 when it's rebased.Test plan
pytest tests/unit/chat/ui/test_turn_changes_recording.py: the real streaming chat path relays to a stand-in sidecar that records on its own thread, creating one file and deleting another. Both appear in Changes and Outputs under the saved answer, and Undo restores them. A 2.18 sidecar is not sent the field.pytest hub/agents/gaia/python/tests/test_server_changes.py: the recording is finished beforefinal, while the agent is still working after its answer. It is also finished when a confirmation is refused. A save that fails is reported before the turn ends. Bad ids, and ids sent without a session, get a 422.pytest tests/unit/test_sidecar_relay_fidelity.py tests/unit/agents/test_file_snapshots.py: a write goes through the sidecar handler, the translator and the relay into the turn summary. Linking the answer can't overwrite the sidecar's own save. Finishing twice keeps an undo made in between.mainand on this branch (two tool-bundle tests and one tool-count test, about 7,500 tests in all). No new failures.python util/lint.py --black --isort, andpython -m gaia_agent.export_openapi --check🔍 Screenshots
After the relayed write:
After Undo: