Skip to content

feat(vscode): show approval reason outside workspace reads and writes - #13001

Merged
bagatao-anaconda merged 8 commits into
mainfrom
feat/show-approval-reason-outside-workspace-reads-and-writes
Aug 7, 2026
Merged

feat(vscode): show approval reason outside workspace reads and writes#13001
bagatao-anaconda merged 8 commits into
mainfrom
feat/show-approval-reason-outside-workspace-reads-and-writes

Conversation

@bagatao-anaconda

@bagatao-anaconda bagatao-anaconda commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Issue

No linked issue.

Context

read hides its tool-row details by default (it's high-frequency and low-risk), so it never showed the auto-approval reason line that other tools already surface via metadata.approval (added in #12494/#12995). On top of that, when a file tool's target path is outside the workspace, assertExternalDirectoryEffect issues an external_directory permission ask before the tool's own read/write/edit ask — and the second ask's approval metadata silently clobbered the first's, so even fixing the UI gap alone wouldn't have surfaced why the path was outside the workspace.

This PR makes reads and writes outside the workspace show the approval reason, so an auto-approved external read is clearly explained instead of looking like a bypass — without adding noise to the common case of an ordinary in-workspace read.

Implementation

  • Backend (packages/opencode): added PermissionProvenance.Approval.outsideWorkspace and a small tagOutsideWorkspace(approval, permission) helper that marks an approval when it answers an external_directory ask. session/tools.ts's ctx.ask wiring now tags both the allow and deny paths with this helper — a minimal, single-call-site diff against the shared upstream file.
  • Preserving the marker across two asks: PermissionProvenance.carryApproval previously let a tool's second ask blindly overwrite the first ask's approval metadata. Since a file tool crossing the workspace boundary asks twice (external_directory first, then its own read/write/edit permission), the second ask's approval would silently drop the outsideWorkspace marker from the first. carryApproval now merges that marker forward onto the final approval instead of losing it, while still reporting the real final decision/rule.
  • Frontend (packages/kilo-ui): ToolApproval/ToolApprovalDisplay carry the new outsideWorkspace flag through to a new line in ToolApprovalLine. The read tool's hideDetails is now conditional (!approval()?.approval.outsideWorkspace) instead of hardcoded — so its details (and the approval line) only show when the target was outside the workspace, keeping ordinary reads collapsed. write/edit were not touched; they already showed the approval line when present.
  • i18n: added ui.approval.outsideWorkspace to en.ts, following the existing ui.approval.* key pattern (other locales fall back to English until translated, same as existing untranslated keys).
  • Rebased on top of origin/main after fix(vscode): tool approval source display #12995 merged, which introduced a settings-driven ToolApprovalVisibilityProvider toggle and reordered the approval line's placement in basic-tool.tsx. Verified our outsideWorkspace gating composes correctly with that toggle (disabling "Show Auto-Approval Reason" hides our outside-workspace note too, as expected) and required no changes beyond a two-line import/export merge conflict.
  • Kept the shared-file diff (packages/opencode/src/session/tools.ts) as close to its original shape as possible per the merge-minimizer conventions — no kilocode_change markers needed in provenance.ts (Kilo-owned path).

Screenshots / Video

auto-approve-read

How to Test

Manual/local verification

  • Ran bun run extension to launch the extension in dev mode and manually verified in a real workspace: reading a file inside the workspace stays collapsed with no approval line; reading a file outside the workspace (e.g. /tmp/outside-file.txt) shows the expanded approval line with the "path is outside your workspace" note, both on first prompt and after auto-resolving via a saved "always allow" rule. Confirmed write/edit behavior for in-workspace files is unchanged from before this change.

Reviewer test steps

  1. Open a workspace and start a Kilo chat session.
  2. Ask Kilo to read a file inside the workspace (e.g. README.md) — expand the tool row and confirm no approval-reason line appears (unchanged behavior).
  3. Ask Kilo to read a file outside the workspace, e.g. /tmp/some-file.txt — approve the external_directory prompt, then the read prompt if asked separately.
  4. Expand the read tool row in the transcript and confirm it now shows an approval line including "path is outside your workspace".
  5. Repeat step 3 with a write/edit to a file outside the workspace and confirm the same note appears; then repeat with an in-workspace write/edit and confirm behavior is unchanged from before this PR.
  6. Optionally, toggle Settings → Display → "Show Auto-Approval Reason" off and confirm the outside-workspace note also disappears (composes with fix(vscode): tool approval source display #12995's visibility toggle).

@bagatao-anaconda bagatao-anaconda self-assigned this Aug 7, 2026
@kilo-code-bot

kilo-code-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (26 files, incremental since d1630fc)
  • packages/kilo-ui/src/components/tool-approval.test.ts
  • packages/kilo-ui/src/components/tool-approval.tsx
  • packages/kilo-vscode/webview-ui/src/i18n/ar.ts
  • packages/kilo-vscode/webview-ui/src/i18n/br.ts
  • packages/kilo-vscode/webview-ui/src/i18n/bs.ts
  • packages/kilo-vscode/webview-ui/src/i18n/da.ts
  • packages/kilo-vscode/webview-ui/src/i18n/de.ts
  • packages/kilo-vscode/webview-ui/src/i18n/en.ts
  • packages/kilo-vscode/webview-ui/src/i18n/es.ts
  • packages/kilo-vscode/webview-ui/src/i18n/fa.ts
  • packages/kilo-vscode/webview-ui/src/i18n/fr.ts
  • packages/kilo-vscode/webview-ui/src/i18n/it.ts
  • packages/kilo-vscode/webview-ui/src/i18n/ja.ts
  • packages/kilo-vscode/webview-ui/src/i18n/ko.ts
  • packages/kilo-vscode/webview-ui/src/i18n/nl.ts
  • packages/kilo-vscode/webview-ui/src/i18n/no.ts
  • packages/kilo-vscode/webview-ui/src/i18n/pl.ts
  • packages/kilo-vscode/webview-ui/src/i18n/ru.ts
  • packages/kilo-vscode/webview-ui/src/i18n/th.ts
  • packages/kilo-vscode/webview-ui/src/i18n/tr.ts
  • packages/kilo-vscode/webview-ui/src/i18n/uk.ts
  • packages/kilo-vscode/webview-ui/src/i18n/zh.ts
  • packages/kilo-vscode/webview-ui/src/i18n/zht.ts
  • packages/opencode/src/kilocode/permission/provenance.ts
  • packages/opencode/src/session/tools.ts
  • packages/opencode/test/kilocode/permission/provenance.test.ts
Previous Review Summaries (3 snapshots, latest commit d1630fc)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit d1630fc)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (20 files, incremental since 0c9b640)
  • packages/kilo-vscode/webview-ui/src/i18n/ar.ts
  • packages/kilo-vscode/webview-ui/src/i18n/br.ts
  • packages/kilo-vscode/webview-ui/src/i18n/bs.ts
  • packages/kilo-vscode/webview-ui/src/i18n/da.ts
  • packages/kilo-vscode/webview-ui/src/i18n/de.ts
  • packages/kilo-vscode/webview-ui/src/i18n/es.ts
  • packages/kilo-vscode/webview-ui/src/i18n/fa.ts
  • packages/kilo-vscode/webview-ui/src/i18n/fr.ts
  • packages/kilo-vscode/webview-ui/src/i18n/it.ts
  • packages/kilo-vscode/webview-ui/src/i18n/ja.ts
  • packages/kilo-vscode/webview-ui/src/i18n/ko.ts
  • packages/kilo-vscode/webview-ui/src/i18n/nl.ts
  • packages/kilo-vscode/webview-ui/src/i18n/no.ts
  • packages/kilo-vscode/webview-ui/src/i18n/pl.ts
  • packages/kilo-vscode/webview-ui/src/i18n/ru.ts
  • packages/kilo-vscode/webview-ui/src/i18n/th.ts
  • packages/kilo-vscode/webview-ui/src/i18n/tr.ts
  • packages/kilo-vscode/webview-ui/src/i18n/uk.ts
  • packages/kilo-vscode/webview-ui/src/i18n/zh.ts
  • packages/kilo-vscode/webview-ui/src/i18n/zht.ts

Previous review (commit 0c9b640)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (28 files)
  • .changeset/show-outside-workspace-approval-reason.md
  • packages/kilo-ui/src/components/message-part.tsx
  • packages/kilo-ui/src/components/tool-approval.test.ts
  • packages/kilo-ui/src/components/tool-approval.tsx
  • packages/kilo-vscode/webview-ui/src/i18n/ar.ts
  • packages/kilo-vscode/webview-ui/src/i18n/br.ts
  • packages/kilo-vscode/webview-ui/src/i18n/bs.ts
  • packages/kilo-vscode/webview-ui/src/i18n/da.ts
  • packages/kilo-vscode/webview-ui/src/i18n/de.ts
  • packages/kilo-vscode/webview-ui/src/i18n/en.ts
  • packages/kilo-vscode/webview-ui/src/i18n/es.ts
  • packages/kilo-vscode/webview-ui/src/i18n/fa.ts
  • packages/kilo-vscode/webview-ui/src/i18n/fr.ts
  • packages/kilo-vscode/webview-ui/src/i18n/it.ts
  • packages/kilo-vscode/webview-ui/src/i18n/ja.ts
  • packages/kilo-vscode/webview-ui/src/i18n/ko.ts
  • packages/kilo-vscode/webview-ui/src/i18n/nl.ts
  • packages/kilo-vscode/webview-ui/src/i18n/no.ts
  • packages/kilo-vscode/webview-ui/src/i18n/pl.ts
  • packages/kilo-vscode/webview-ui/src/i18n/ru.ts
  • packages/kilo-vscode/webview-ui/src/i18n/th.ts
  • packages/kilo-vscode/webview-ui/src/i18n/tr.ts
  • packages/kilo-vscode/webview-ui/src/i18n/uk.ts
  • packages/kilo-vscode/webview-ui/src/i18n/zh.ts
  • packages/kilo-vscode/webview-ui/src/i18n/zht.ts
  • packages/opencode/src/kilocode/permission/provenance.ts
  • packages/opencode/src/session/tools.ts
  • packages/opencode/test/kilocode/permission/provenance.test.ts

Previous review (commit 4add8d9)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (8 files)
  • .changeset/show-outside-workspace-approval-reason.md
  • packages/kilo-ui/src/components/message-part.tsx
  • packages/kilo-ui/src/components/tool-approval.test.ts
  • packages/kilo-ui/src/components/tool-approval.tsx
  • packages/kilo-vscode/webview-ui/src/i18n/en.ts
  • packages/opencode/src/kilocode/permission/provenance.ts
  • packages/opencode/src/session/tools.ts
  • packages/opencode/test/kilocode/permission/provenance.test.ts

Reviewed by kimi-k3 · Input: 101.5K · Output: 14.9K · Cached: 1.4M

Review guidance: REVIEW.md from base branch main

@bagatao-anaconda
bagatao-anaconda merged commit 001fb21 into main Aug 7, 2026
31 checks passed
@bagatao-anaconda
bagatao-anaconda deleted the feat/show-approval-reason-outside-workspace-reads-and-writes branch August 7, 2026 17:38
t7tran pushed a commit to t7tran/kilocode that referenced this pull request Aug 14, 2026
…ason-outside-workspace-reads-and-writes

feat(vscode): show approval reason outside workspace reads and writes
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.

2 participants