Skip to content

fix(ui): resolve tool-call paths against the live workspace#18

Merged
lavindeep merged 2 commits into
ui-reworkfrom
fix/ui-cwd-toolpath-staleness
Jun 28, 2026
Merged

fix(ui): resolve tool-call paths against the live workspace#18
lavindeep merged 2 commits into
ui-reworkfrom
fix/ui-cwd-toolpath-staleness

Conversation

@lavindeep

Copy link
Copy Markdown
Owner

The tool-call summary line resolved a path argument workspace-relative using a workspace captured once at UI construction, so after a mid-session /cwd set it resolved against the stale old workspace. The approval-panel display (executor._display_value) and the tool action itself already use the live per-turn workspace — so this was a display-consistency gap, not a security issue (the security-critical surface was already correct).

Fix

AppUI and TerminalUI take an optional workspace_fn, evaluated at render time in _tool_call_value, wired at the production construction sites to lambda: runtime.status().workspace (the live workspace, updated by set_workspace). The build-time workspace stays as the static fallback for test doubles. Mirrors the existing status_fn/runtime.status() live-value pattern. The approval display, secret redaction, and the RuntimeUI protocol are untouched (constructor-only param — no FakeUI/ThreadedUI change).

Also closes the latent workspace=None seam in practice: production now always wires a live workspace_fn, so the verbatim-path fallback only remains for test doubles.

Verification

  • Gate green: ruff / format / mypy --strict / 1453 pytest.
  • New tests (red-first): test_tool_call_path_uses_live_workspace in tests/test_app_ui.py and tests/test_terminal_ui.py — a path inside workspace A but outside its subdir B; after the live workspace flips A→B, the second tool-call line shows <outside workspace>, proving live (not stale) resolution. Deterministic; no live model needed.

(The first commit is unrelated repo hygiene: gitignore a local prototype/ mockups folder.) Targets ui-rework. Does not touch main.

Local-only folder for feature mockups and design sketches; never tracked.
Replaces the single thinking-trail-preview.html ignore entry.
The tool-call summary line showed a `path` argument resolved
workspace-relative using a workspace captured once at UI construction,
so after a mid-session `/cwd set` it resolved against the stale old
workspace. The approval-panel display and the tool action itself already
used the live per-turn workspace, so this was a display-consistency gap,
not a security issue.

AppUI and TerminalUI now take an optional workspace_fn, evaluated at
render time, wired to `lambda: runtime.status().workspace`. The build-time
workspace stays as the fallback for test doubles. Mirrors the existing
status_fn/runtime.status() live-value pattern; the approval display and
secret redaction are untouched.
@lavindeep lavindeep merged commit 2e7ab86 into ui-rework Jun 28, 2026
2 checks passed
@lavindeep lavindeep deleted the fix/ui-cwd-toolpath-staleness branch June 28, 2026 14:39
lavindeep added a commit that referenced this pull request Jul 2, 2026
fix(ui): resolve tool-call paths against the live workspace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant