Skip to content

feat: add a remote Git panel to session environments - #21995

Merged
kyleseaman merged 2 commits into
mainfrom
feat/session-environments-git-panel
Nov 2, 2026
Merged

kyleseaman merged 2 commits into
mainfrom
feat/session-environments-git-panel

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Let the Git tab of a chat that runs in a remote session environment show that workspace's own repository (branch, changed files, per-file diff and recent history), read-only.

A chat on a Coder workspace (#19833) works in the guest's checkout, but the side panel's Git tab can only read the gateway's local project. For a remote chat it shows a placeholder instead, so the user cannot see what the agent changed, which branch it is on, or whether it has committed, without asking the agent or opening a terminal.

Why it matters

Reviewing the agent's changes is the main reason to open the Git tab. In a remote chat that review currently means typing git status and git diff into a terminal by hand. A read-only view of the guest's checkout gives remote chats the same review loop local chats already have.

Not a goal

  • Writing from the Git tab (stage, commit, push, checkout); the panel is read-only.
  • Any remote access from the panel: it never fetches, so it needs no git login and says nothing about private repositories. Credentialed clone and push are feat: add credentialed git for remote sessions #21256.
  • Reaching the local Git panel's feature set (blame, stash list, branch switching, commit graph).
  • Providers other than Coder; each provider PR in the stack inherits the panel through the same browse endpoint.

What changed (motivation → approach → change)

A remote chat's Git tab now shows the guest workspace's repository: the branch with its ahead/behind counts as plain read-only text, one coloured status letter per changed file, a click-to-open diff for each file, and the last 50 commits. Nothing in it can change the repository.

The panel reads through the browse endpoint the remote Files tab already uses, so it gains no new route and no new credential. The guest runs fixed-argv, read-only git in its own checkout, and a diff path outside the workspace is refused. Every git read runs under coreutils timeout, as the base's run_command now does (one shared _under_timeout wrap and _unwind, used by both), so anything git starts is stopped with it when the 30-second timeout fires; the guest calls no kill primitive. With filters, fsmonitor, textconv, external diff, signature checks and submodule recursion all switched off, that is defence in depth for whatever git starts that this list does not name.

Part What it does
website/src/pages/chat/RemoteGitPanel.tsx (new), ActivityViewer.tsx, SidePanel.tsx the panel, lazy-loaded; the Git tab picks it when the chat has a remote environment. The branch is plain text titled read-only, the ahead/behind pill and each status letter carry a title and an accessible name, a diff the guest cut at 256 KB says so and offers to ask the agent for the full diff, a status list cut at that cap says it is incomplete, a listed file with an empty diff says git lists it as changed, a failed read leads with a plain sentence and keeps git's text as detail, and a git_failed result is always an error, even with no diagnostic text; each diff opens under its row, History dates are formatted in the dashboard's language from the guest's unix seconds, and every Ask the agent link drafts a request without sending it
website/src/components/GitPanel.tsx, website/src/components/ui.tsx, website/src/components/AskAgentButton.tsx GitPanel exports statusColor and relativeTime, so both panels colour letters and word commit dates from one source; AskAgentButton gains optional prompt, title, accent and onStage props, so the panel's "Draft a request to the agent…" links reuse its offline gate and stage their draft in THIS chat's composer (stageToMainComposer, the channel SideChat uses), the chat bound to the workspace, rather than the error hand-off's fresh chat (existing callers unchanged); PanelSectionHeader also accepts a translated count string ("14 or more")
website/src/api chatSlotEnvironmentGit(slot, op, path) and the RemoteGitResult type
website/src/i18n sessionEnvironments.remoteGit.* strings in all 13 catalogs (the commit-count labels are plurals, registered in pluralKeys.json)
src/kiro_crew/remote_session/workspace_tools.py browse ops git_status (NUL porcelain, every untracked file), git_log, git_bodies (the HEAD blob via ls-tree/cat-file, which runs no filter, and the worktree file read directly, never a patch; an untracked file has no old body; an unborn branch has none either; the path's parent directory is confined and a symlink's body is its link text; a gitlink is its Subproject commit line; a directory, including an untracked nested repository, is git_failed; binary bodies are flagged; the HEAD blob is streamed and kept to the read cap, never buffered whole; over the cap, the reply is marked truncated and carries no body, so the panel says "This diff is too large to show. Only its mode or rename lines appear, if any." (with any mode, rename or new/deleted file lines), as the local panel does; a gitlink whose index entry was replaced by staged files is refused as a directory before git builds its patch, and every body read (blob, index listing, submodule summary) is streamed to the cap; a gitlink replaced by a file or symlink is read with the same bounded worktree read; a worktree file git would store with LF (text, text=auto, eol, core.autocrlf) is compared with CRLF folded to LF, except that, like git's own check, automatic conversion leaves a file whose HEAD blob already holds CRLF unchanged); --no-lazy-fetch (and GIT_NO_LAZY_FETCH=1) so a partial clone's missing object is git_failed, never fetched through a configured transport; on git older than 2.44, which lacks the flag, a partial clone still lists status (with --no-renames) and history but refuses file bodies, and those reads run with GIT_ALLOW_PROTOCOL empty, so a read that would need a missing object fails instead of fetching; core.hooksPath=/dev/null and GIT_OPTIONAL_LOCKS=0, as the base's git_status now does, so no hook runs and the index is never refreshed; core.fsmonitor, pager, external diff, textconv and log.showSignature disabled, and every filter driver the repository configures blanked for the read, as the base's git_status does (a driver that cannot be named stops the read); status and the gitlink read pass --ignore-submodules=dirty, so git never runs inside a submodule whose own config could name filters; a non-repository is a state, a failed git call is an error with code: git_failed; every git read runs through _run_grouped under coreutils timeout -k 5 30, which signals the read's whole process group on expiry, on a stdout cutoff and on unwind (the base removed _kill_group and the guest's kill-site exemption, so the guest adds no kill primitive); rename diffs write rename from/rename to with no made-up similarity index
src/kiro_crew/coder/session_browse.py, src/kiro_crew/security_posture_sinks_gateway.py, src/kiro_crew/dashboard/handlers/session_environments.py READ_OPS admits the two new ops; the gateway runs the output and error text of `git_status
src/kiro_crew/git_no_index_diff.py (new), src/kiro_crew/dashboard/file_api/editor.py, src/kiro_crew/dashboard/handlers/files.py the file panel's git diff --no-index of two masked bodies, moved out of api_file_diff unchanged (same argv, temp-dir handling, timeout and failure rule) so both panels use one spawn; editor.py calls it and keeps its own header, and the files.py facade binds it for the editor owner as it does its other imports
docs/system-specs/modules/providers.md, docs/feature-map/README.md the Git view's remote behaviour, and the spawn-audit boundary naming _run_grouped

The spawn audit's entry for the old git reader (workspace_tools.py::_git_status) becomes workspace_tools.py::_run_grouped, beside the unchanged run_command entry, and workspace_tools.py::_stop_tree joins them: on Windows only, it runs taskkill /T /F from the system directory on a read the guest itself started, so a read past its deadline leaves no orphaned git.exe. All three are guest-only code that cannot import the gateway sandbox. The gateway-side entry dashboard/file_api/editor.py::_diff_redacted_bodies moves with its spawn to git_no_index_diff.py::no_index_diff: same argv, no new spawn site.

Windows. A Git read that reaches the size limit closes its end of git's output pipe, so git exits at its next write on every platform. On win32 the read runs without the coreutils timeout wrapper (the timeout on PATH may be System32's unrelated wait command), and its deadline ends the whole process tree, since git.exe is a launcher and Windows has no group signal. The guest Git tests write LF fixtures explicitly and all run on Windows; details in the PR note on 1573936.

Base. main (484d7378a8), after credentialed git (PR #21256) and Sprites/boxd (PR #21257) merged. The Git panel does not depend on Fargate or Kiro Cloud. Its Kiro Cloud handling (the cloud-sandbox notice and the placement re-read) is left to the Kiro Cloud PR, which has no counterpart on this base. Since the base's UI withholds gateway-backed tabs in a remote chat, the Git tab is taken off that list here: a remote chat's Git tab renders RemoteGitPanel, never the gateway checkout. The panel's error notices keep ErrorNotice's agent hand-off but stage it in this chat's composer (a new optional onStage), since a fresh chat's agent could not reach the remote workspace.

Developer flag. Like the rest of Session Environments, the panel is reachable only with KIROCREW_DEV_MODE on. With it off, a chat bound to a remote profile reads as local through the choices gate, so the Git tab shows the local GitReposPanel and every git_status/git_log/git_diff browse request answers 409 not_remote without reaching a guest (test_the_git_views_are_unreachable_with_the_developer_flag_off, which fails with the gate's flag check removed).

Why the Git views are redacted although read is not. The Git views show text that read cannot reach. A diff's removed lines are content no longer on disk, such as a credential the agent wrote and then deleted. Commit subjects and author lines in History are not files at all. So redacting git_status|git_log|git_diff covers a disclosure path that the raw read op (unchanged from #19833) does not. Diff bodies are also redacted, which matches the local panel's file diff (dashboard/file_api/editor.py, _diff_redacted_bodies).

Sensitive change

One file on the Sensitive Change Review list: src/kiro_crew/security_posture_sinks_gateway.py (watched through security_posture_*.py). Since the base split security_posture.py into a facade (#23357), the registry rows live there; this PR does not touch security_posture.py itself. The change is a single seven-line entry appended to _GATEWAY_SINKS (part of security_posture._REDACTION_SINKS), naming coder/session_browse.py as a redaction egress sink, byte-identical to the entry on earlier heads. Nothing else in that file changes. test_security_posture requires every module that calls the shared redactor to be registered there, so the new gateway redaction of the remote Git views cannot land without it. The entry adds a row to the security posture panel's list of redaction egress paths, and no rule, scanner or default changes. The entry is this PR's own; nothing sensitive is inherited from the base.

Paste-ready review for the PR author (an approval names one head and does not carry across commits, so a later push needs it re-posted):

## Sensitive change review
- Head commit: 60494876284ba0af427b5397eaec31605312e672
- What rule changed: none. `_GATEWAY_SINKS` in `src/kiro_crew/security_posture_sinks_gateway.py` (part of `security_posture._REDACTION_SINKS`) gains one 7-line entry, "Remote session Git views" -> `coder/session_browse.py`, registering the new gateway redaction of the remote Git views as an egress sink. It is the only Sensitive Change Review file this PR touches, and `security_posture.py` itself is unchanged.
- Before -> after (what was allowed/blocked, now): before, there was no remote Git view and no sink for it. After, `session_browse.browse_session` runs git_status, git_log and git_diff output and error text through `redact_via_context` before it reaches the dashboard, and the posture registry lists that sink, as the drift guard requires for every redactor call site. Nothing that was allowed or blocked before changes.
- Worst case if wrong (breaks commands / leaks secret / locks user out): the security posture panel lists one egress path with a wrong label. Scanning, sandbox rules, defaults and permissions are untouched, so no command breaks, no secret is exposed and no user is locked out.
- Evidence checked (which sandbox result proves it): N/A for a sandbox result, since no sandbox rule changed. Instead: the diff of this file is the single 7-line tuple, byte-identical to earlier heads; on this head, removing the entry makes `test_every_redactor_call_site_is_a_registered_sink_or_allowlisted` fail naming `coder/session_browse.py`, and restoring it passes `test_security_posture` (56 passed).
- No regression:
  - Tools still work (which tools/commands were run, result): yes. Only data in a registry tuple changes; the scoped backend run on this head (6,837 passed) covers the remote file, Git, file-diff and command tools.
  - Backward compatible (old config / old data / old callers still work, how checked): yes. The entry is additive; no existing row, key or caller changes, checked by the unchanged rest of the file diff.
  - Existing tests (which suites passed on this head): `test_security_posture` (56), `test_coder_session_browse`, `test_api_file_diff` and the remote Git/session-environment suites (6,837 passed, 25 skipped), Fast Gate 29/29, Backend Lint 14/14, Semgrep 0 findings.
- How to undo: revert this entry together with the `redact_via_context` call in `coder/session_browse.py`; the drift guard requires the two to go together.

Backwards compatibility

Compatible: the Git tab of a local chat still renders the local GitReposPanel; git_status keeps its op name and result keys; the two new ops are additive; run_command is untouched.

The git_status output changes from newline to NUL records, and a timeout returns {git: false, code: "git_failed"} instead of a tool error. It also lists untracked files individually (--untracked-files=all in place of normal), so the panel can show and diff each new file. As a result, the archive warning counts every file inside a new untracked directory where it used to count the directory once; that number is the files the archive would actually lose. A submodule whose only change is files inside it is not listed, because the reads never look inside a submodule; a submodule whose checked-out commit moved is. When the guest cut the list at its 256 KB read cap, the warning drops the partial last record and says "at least N uncommitted files". When that list passes the guest's 256 KB read cap, the panel drops the cut final record and says the list is incomplete. Its readers:

Reader: src/kiro_crew/coder/session_browse.py:unsaved_work -- chat (archive warning) -- summarize_unsaved splits on NUL when present and on newlines otherwise, and counts a rename as one file; test_unsaved_warning_understands_nul_status
Reader: website/src/pages/chat/RemoteGitPanel.tsx:parsePorcelain -- chat (side panel) -- new in this PR, parses the NUL form and falls back to newline records from guest files an earlier build installed; RemoteGitPanel tests in RemoteFilesPanel.test.tsx

Guest files are rewritten only when an agent runtime starts, so a guest prepared by an earlier build can still answer git_log/git_bodies with op must be …, and it never serves a raw patch to this build; _ask reinstalls the current files once on that reply and never retries a second time (test_a_worker_without_the_read_op_is_reinstalled_once, test_a_refused_op_after_reinstalling_is_returned_not_retried).

Tests

  • test/test_remote_git_credential_isolation.py: textconv set up in the repository is confined at spawn; untracked files get real addition diffs; literal paths with spaces and Unicode reach the tracked diff; the unsaved-work warning reads NUL status; a modified tracked symlink diffs as the link, also when it names a file outside the workspace; .., app/../../outside.txt and a symlinked parent pointing outside stay refused.
  • test/test_coder_session_browse.py: credential-shaped values in a status path, a log subject, a diff body and error text come back redacted with NUL and newline structure intact, a PEM body is masked before the patch is built, a key with no footer is withheld through EOF even when its opener follows a field prefix (key: -----BEGIN …), and read is unchanged; guest files that answer op must be … are reinstalled exactly once; a refusal after the reinstall is returned, not retried; other browse errors never reinstall.
  • test/test_remote_git_channel_bounds.py, test/test_remote_git_proxy_admission.py: subprocess failures are errors, not repository states; only git's own "not a git repository" is the non-repository state; unborn-branch history is empty and its diff includes staged files (SHA-1 and SHA-256 repositories); status paths diff correctly from a nested workdir.
  • test/test_remote_command_lifetime.py: test_a_timed_out_git_read_stops_under_timeout_then_reaps[git_status|git_log|git_bodies] runs each read under timeout -k 5 30 and stops then reaps it; test_a_timed_out_git_read_takes_its_whole_group_with_it runs a real child that outlives the read and shows the timeout takes it down (with the timeout wrapper removed, all four fail).
  • test/test_coder_session_launch.py and test/test_remote_git_panel_bodies.py (the body reads, split out so neither file passes the 2,000-line cap): git_log and git_diff through the browse mode, a diff path outside the workspace refused, a repository textconv never run by the diff view, a repository filter driver (clean/smudge, required=true) never run by status, diff or history, a filter driver defined only in a submodule's own config never run by status or a diff of the submodule; a random PEM wrapped at 32 columns with a middle line deleted shows no key line in the gateway's diff (the test first shows git's own patch carries those lines and the redactor, read a line at a time, leaves them; with the body redaction skipped it fails); an untracked nested repository is git_failed, not an empty diff; a blobless partial clone whose remote is an ext:: transport writing a marker never runs it from bodies, status or log, and its missing blob is git_failed (with the flag and env var removed, the marker appears); git without the flag still lists status and history in a partial clone but refuses bodies, and never runs the transport even for a git that ignores GIT_NO_LAZY_FETCH; an over-cap file returns no body and a truncated diff with no hunks; a submodule replaced by an over-cap file is bounded and truncated like any file; a text=auto or core.autocrlf file whose HEAD blob already holds CRLF shows a one-line edit as one line; (POSIX only, as guest workspaces are) a mode-only change (chmod +x) renders git's old mode/new mode lines, matching git diff, and core.fileMode=false hides it; a staged rename diffs against its source with rename from/rename to and the real hunks, with the source confined like the path; a PEM block with no footer, including an indented one in a complete file, is withheld from its BEGIN line on, on top of the whole-body redaction (the test first shows the shared redactor alone leaves the indented key lines); 64K repeated short lines diff in well under two seconds; a history read with a commit subject twice the read cap, and a status read with an untracked list twice the cap, are streamed to the cap instead of buffered; a guest with timeout but no git reports "git is not installed" for every op; a gitlink replaced by staged files, on disk or removed, is refused with no diff spawned and no index listing buffered; and a driver name that -c cannot express stopping the read as git_failed.
  • test/spawn_audit_helpers.py (read by test/test_spawn_audit.py): the _run_grouped audit entry replaces _git_status, and the file-diff entry follows its spawn to git_no_index_diff.py::no_index_diff.
  • test/test_coder_session_browse.py (shared diff): the panel's hunks come from no_index_diff over the masked bodies with the file panel's argv (test_the_panel_takes_its_hunks_from_the_shared_git_diff_of_masked_bodies and test_the_panel_diff_uses_the_file_panels_git_argv fail if the panel stops using it); reversed repeated lines and swapped neighbours diff in under two seconds; a patch with no hunks renders binary or the header alone; a git timeout gets the over-cap reply and any other failure serves no patch. test/test_api_file_diff.py passes unchanged.
  • test/test_session_environment_handlers.py: with KIROCREW_DEV_MODE off, a bound chat's three Git reads answer not_remote and never reach a guest (fails with the choices gate's flag check removed); the browse endpoint forwards a rename source.
  • website/src/test/sidePanelEnvironmentPlacement.test.tsx: a remote chat's Git tab reaches the Git view with the workspace name and no withheld notice, a local chat's with none (the remote case fails with git put back on the withheld list).
  • website/src/test/RemoteFilesPanel.test.tsx (RemoteGitPanel): NUL porcelain with literal filenames and rename/copy sources, and newline status from older guest files; a cut-off status list drops its partial final record and says the list is incomplete; the branch title, the ahead/behind label and each letter's title, name and colour; an untracked row's addition patch; the cut-off diff notice and its "Ask the agent for the full diff" hand-off (hidden while the gateway is unreachable), also for a cut reply whose shown part is empty, which never reads as no difference; a listed file with an empty diff; status, history and diff failures through ErrorNotice, each led by a plain sentence with git's text as detail and the agent hand-off kept, including a git_failed result with empty diagnostics; the stopped-workspace sentence; a non-repository. website/src/test/ApiClient.refactor.surface.test.ts: the new endpoint.
  • Every test added for the review fixes was checked against its fix reverted: each failed, then passed with the fix restored. Round-4 additions: test_remote_git_channel_bounds.py runs the history read on a signed commit with log.showSignature=true and a fake gpg.program that would leave a marker, which never appears; RemoteFilesPanel.test.tsx covers the "No upstream" pill, an unborn branch whose header is git's real ## No commits yet on trunk...origin/trunk [gone], the row chevrons and the shortened notices. Round-5 additions: the history read sends unix seconds (%at) and the panel formats them with the local panel's relativeTime, showing text from older guests verbatim; each diff opens under its own row; each Ask the agent link says it drafts and sends nothing; a commit date git accepts but JavaScript cannot represent (e.g. @9999999999999) is shown verbatim instead of crashing History; a cut status list makes the archive warning say "at least". Round-7 additions: rename and copy rows show old -> new (diffs still use the new path); the panel remounts per chat, so a selection never carries over; AskAgentButton's new prompt prop is tested in AskAgentButton.cov80.test.tsx.
  • Ran on this head's tree (on main 484d7378a8): the remote, Coder, session-environment, sprites/boxd, redaction, workspace-file, file-API/file-diff and remote-git proxy/relay test files plus test_spawn_audit, test_security_posture, the files-facade composition contract and the gate files under -n 10 (6,837 passed, 25 skipped); every Fast Gate script, diff-scoped to this PR's two commits (29/29); the Backend Lint job's scripts plus whole-tree isort, flake8 and mypy (14/14); Semgrep 1.78.0 with CI's configs against the base (0 findings); 287 frontend test files that render the panel, ErrorNotice or AskAgentButton, plus the API client surface test (7,723 passed); tsc and i18n:check. No added line names a /home or /Users path.
  • Earlier heads carried reds from main that main has since fixed: kiroUsageRefetchInterval.test.ts (fix(test): expect 'none' for API-key auth in the Kiro usage parser test #25944) and the macOS artifact-icon settles (Flaky: TestIconGenerationCoalescing settle wait times out on macOS #25895, fe68d8e). This head includes both fixes. test/test_sprites_boxd_failures.py::test_window_size_and_raw_mode_on_a_real_pty came in with feat: add Fly.io Sprites and boxd session environments #21257, which merged with the macOS suite skipped, and it failed on this PR's earlier macOS runs; this PR touches neither that test nor the code under it.
  • Not run by the agent: the full backend and frontend suites (CI runs them), native Windows/macOS, guest Python 3.9, and a live Coder workspace.

Manual verification

  • Still to do: open the Git tab of a chat on a live Coder workspace on a dev gateway, change and commit a file in the guest, and check the branch counts, status letters, diffs and history update on Refresh.
  • Not run locally: semgrep (CI's SAST job runs it).

Screenshots / video

Rendered from this head's real RemoteGitPanel under the repo's Vite config on 127.0.0.1, with chatSlotEnvironmentGit stubbed (no gateway, no workspace). The stubbed checkout is two commits ahead of and one behind its upstream, with a modified file whose name has a space, an added file, a rename, a deletion and an untracked Unicode file.

Branch and ahead/behind counts, one coloured status letter per file, and history with dates in the dashboard's own language:

Remote Git panel with ahead/behind counts and status letters, dark

Selecting the modified file opens its diff against HEAD directly under its row:

Remote Git panel with a modified file's diff open, dark

An untracked file shows as an addition:

Remote Git panel with the untracked file's addition diff, dark

What the hover titles say. Headless Chromium draws no native tooltip, so the caption under the panel lists the title and accessible-name values read from the rendered page:

Remote Git panel with a caption listing the ahead/behind, branch and status-letter titles, dark

A clean checkout, the most common state after the agent commits:

Remote Git panel on a clean tree: Changes 0, No changes since the last commit, with history, dark

A file whose diff is empty though status lists it, and a diff the guest cut at 256 KB with its hand-off (the patch scrolls inside the panel):

Remote Git panel with a listed file whose diff is empty, saying it may have changed back since the list was read, dark

Remote Git panel with an over-cap file: This diff is too large to show, its mode lines, and Draft a request to the agent for the full diff, dark

A status list cut at the same cap: the partial last row is dropped, the count reads "14 or more", and the note ("Some changes are not shown.") offers to ask the agent for the full list. Each change row ends in a chevron, like the Files tab's folders. The selected row in any list shows its status as text (e.g. "Modified") beside the hover title:

Remote Git panel with Changes 14 or more, an incomplete-list notice and Draft a request to the agent for the full list, dark

The working directory is not a Git repository, with a hand-off to ask the agent to clone or create one:

Remote Git panel saying the working directory is not a Git repository, dark

A branch with no upstream shows a muted "No upstream" label in place of the ahead/behind counts:

Remote Git panel with a No upstream label beside the branch name, dark

Failed reads: the whole panel when the workspace is stopped, and History alone (with no count) when only the log read fails, led by a plain sentence with git's text below it, each with the agent hand-off:

Remote Git panel with the stopped-workspace error and Ask the agent, dark

Remote Git panel with status shown and History could not be read above git's error text and Ask the agent, dark

Light theme

Remote Git panel with ahead/behind counts and status letters, light

Remote Git panel with a modified file's diff open, light

Related Issues

Part of #10433

no linked issue: this PR closes nothing; #10433 stays open until the whole Session Environments stack lands.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@kyleseaman
kyleseaman requested review from a team and KiroCrewCaptain as code owners October 19, 2026 00:23
@kyleseaman
kyleseaman requested review from cruisercohen and removed request for a team October 19, 2026 00:23
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 60494876284ba0af427b5397eaec31605312e672 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level blocker: the panel reuses the existing browse endpoint, redacts whole file bodies before diffing, and the one format change (NUL porcelain) is handled by its only server-side reader.

Notes

  • Building diffs on the gateway from raw guest bodies means the guest has to copy git's own behaviour: CRLF/text=auto folding, gitlinks, partial-clone fallbacks below 2.44. Expect drift wherever that copy falls short of real git. That cost is the price of redacting before diffing, so record the trade-off in providers.md.
  • git_status now emits -z output. summarize_unsaved accepts both the old newline records and the new NUL records, so an older guest worker still reports unsaved work correctly. Keep that dual parse until every guest worker sends -z.

[DESIGN-REVIEWED] 6049487

Description read

[DESCRIPTION-READ] 6fdcb1abad871d61e4ee2ad7e8111b0dd9cfbee9b2cf9212dde008242121dd70

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 60494876284ba0af427b5397eaec31605312e672 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks: every item comes from the frozen Goal or its "never fetches" exclusion. One redaction layer patches a gap in the shared redactor for this panel only.

Notes

  • Item 7 — symptom-level: the description says "the shared redactor masks a footerless key only through unindented base64 lines", and that gap lives in the shared redactor's PEM rule (security/redaction.py:934). _withhold_unclosed_pem fixes it for this panel alone. Counted siblings (redact_via_context|_withhold pattern): 1 unfixed whole-body diff path, dashboard/file_api/editor.py::_diff_redacted_bodies, which still shows the same indented, footerless key. Subtraction: delete _withhold_unclosed_pem and _PEM_MARKER_RE from coder/session_browse.py and leave the footerless-key gap to the shared redactor's PEM rule (security/redaction.py:934, with its spelling in security/pem_scan.py). Until then, the description should say this fix sits at symptom level.

What this change ships

Inventory (10 items) — 9 justified

Intent: let a remote-environment chat's Git tab show the guest checkout's branch, changes, per-file diff and history, read-only. ADDITION.

  1. A remote chat's Git tab shows the guest repo instead of the withheld notice — justified
  2. Branch name with ahead/behind counts, as read-only text — justified
  3. One coloured status letter per changed file; a capped list says "at least N" — justified
  4. A click-to-open diff under each row, built from bodies masked at the gateway — justified
  5. History list of the last 50 commits, dates in the dashboard's language — justified
  6. "Ask the agent" links put a draft in this chat's composer without sending it (AskAgentButton/ErrorNotice onStage, prompt, title, accent) — justified
  7. A PEM block with no END line is withheld through the end of the body, in this panel only — symptom-level, shared redactor gap
  8. Guest git reads run hardened: no hooks, filters, lazy fetch or kill primitive, plus a partial-clone fallback for git older than 2.44 — justified
  9. The archive warning reads NUL status and says "at least N" when the status was cut — undeclared
  10. The local file panel's git diff --no-index moves into the shared git_no_index_diff — justified

[FIRST-PRINCIPLES-REVIEWED] 6049487

Description read

[DESCRIPTION-READ] 90250ac0fa24422fe6b1facef49d60c03188a89f30c7519b4ed6ad9c526b2c31

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 60494876284ba0af427b5397eaec31605312e672 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The blind reader identified and would use every primary control: the row expanders, refresh, and the purple "Draft a request…" links.

Notes

  • In the error banners, the red "Ask the agent" button still shows the hover text "Open a chat with this error's full context attached". With onStage set, clicking it only drafts the request in this chat's composer and sends nothing. The blind reader said: "nothing says whether it sends straight away, so I'd be a bit careful". Fix: when onStage is set, show the askDraftTitle hover text instead (in AskAgentButton or through ErrorNotice).
  • The grey "No upstream" text was "no idea" to the reader in shots 6 and 10, because its explanation only appears on hover. Fix: use a label that says it outright, e.g. "Not pushed yet".
  • "Draft a request to the agent to clone or create a repository": the reader "would not dare to send" it because "clone" is unclear. Fix: rewrite the label around the user's goal, e.g. "Draft a request to the agent to set up a Git repository here".

[UX-REVIEWED] 6049487

Description read

[DESCRIPTION-READ] b6d4a275bc425d667d03e02da8961b559735370959503449969368d04b3f3a98

That sha256 names everything this verdict read: the PR description, plus the 17 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 60494876284ba0af427b5397eaec31605312e672 — this comment is updated in place on each push.

Review details

No findings.

Notes:

  • src/kiro_crew/remote_session/workspace_tools.py grows from 1,110 to 1,638 lines, past the 1,600-line working target. keep-modules-small is non-blocking.

[OPUS-REVIEWED] 6049487

Verdict parsed from the review's SHA-scoped output markers for commit 60494876284ba0af427b5397eaec31605312e672.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 60494876284ba0af427b5397eaec31605312e672 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 60494876284ba0af427b5397eaec31605312e672 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 6049487

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 60494876284ba0af427b5397eaec31605312e672 false-positive: <reason, 20 to 500 characters>

@kyleseaman
kyleseaman force-pushed the feat/session-environments-git branch 2 times, most recently from 5da3123 to 9c027ca Compare October 19, 2026 00:35
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 19, 2026
@kyleseaman
kyleseaman force-pushed the feat/session-environments-git branch from 9c027ca to 91efcec Compare October 19, 2026 01:11
@kyleseaman
kyleseaman force-pushed the feat/session-environments-git-panel branch from 0935cf4 to 291df55 Compare October 19, 2026 01:20
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 19, 2026
@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in 291df55 — span=be531ed8177b (failed Git reads can appear as an empty diff).

RemoteGitPanel.tsx now treats code === 'git_failed' as an error regardless of error_text, at all three sites that choose error versus content: the whole-panel status read, the History read and the selected-file diff. An empty diagnostic falls back to the existing localized failure message, with the agent hand-off. RemoteFilesPanel.test.tsx adds {git: false, code: 'git_failed', error_text: ''} cases for status, history and diff; each failed with the predicates reverted and passes with them.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in 291df55 — span=e61d862bc701 (duplicate statusColor).

website/src/components/GitPanel.tsx now exports its statusColor unchanged, and RemoteGitPanel.tsx imports it; RemoteGitPanel.tsx no longer defines statusColor, which is the stated clear condition. The per-letter colour classes (M, A, D, ?, R/C/U) are pinned in the RemoteGitPanel test labels the branch, the ahead/behind counts and every status letter, which fails with a local copy reintroduced.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in 291df55 — span=da7b7242fb1b (unlabelled ahead/behind counts).

The ↑2 ↓1 chip now has a title and an sr-only accessible name built from two plural keys, e.g. "2 commits not pushed, 1 commit not pulled", in all 13 catalogs; the arrow glyphs are aria-hidden. Pinned by the labels the branch, the ahead/behind counts and every status letter test.

The BLOCK's evidence gaps are filled in the same round: the description now carries stills of the clean tree, a non-repository, a stopped workspace (whole-panel error), a failed History read, a selected file with an empty diff, a diff cut at 256 KB, and the hover titles. All are rendered from this head's real RemoteGitPanel with the API stubbed.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in 291df55 — span=8cda78be00fb (status letters have no legend).

Each status letter now has a title and an sr-only name (Modified / Added / Renamed / Copied / Deleted / Untracked, "Other change" as fallback); the visible letter is aria-hidden, so a row reads "Modified src/notes generator.py". The tooltips still in the description lists the rendered values. Pinned by the labels the branch, the ahead/behind counts and every status letter test.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in 291df55 — span=ada4151c629d (branch name looks like a control).

The branch renders as plain text, without the font-medium weight, with title="Current branch (read-only)" (translated in all 13 catalogs). The test asserts it has no button ancestor.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=e87ba78139ca covers two findings in src/kiro_crew/remote_session/workspace_tools.py.

:611 symlink diffs follow the link: fixed in 291df55. git_diff confines the realpath of the path's parent directory only and hands git parent_real/name, so a tracked or untracked symlink diffs as the link and its target is never read. .., app/../../outside.txt and a symlinked parent pointing outside stay refused. Tests in test_remote_git_credential_isolation.py fail with the old ws.resolve(join(repo_root, path)) restored.

:575 status rows outside a subdirectory workdir: rebutted. Porcelain paths are repo-relative by design, and git_status also feeds the archive warning's unsaved-work count (session_browse.summarize_unsaved). Archiving destroys the whole workspace, so changes elsewhere in the same repository are unsaved work the user must be warned about. Narrowing status with -- . would hide them from that warning. In the panel such a row is listed and, when clicked, gets the explicit "outside the workspace" refusal, never another file's diff. Hiding or filtering those rows is a design change beyond this PR's read-only view; the shown-but-refused behaviour is honest, and the confinement it relies on is tested (test_status_paths_diff_from_a_nested_workdir).

@kyleseaman

Copy link
Copy Markdown
Contributor Author

span=fca05a33a61a covers two findings in website/src/pages/chat/RemoteGitPanel.tsx. Both are fixed in 291df55.

:45 no fallback for older guest files. Verified real: guest files are rewritten only when an agent runtime starts (coder/remote_worker.py install_worker, called from workspace_server/local_argv), and nothing compares the digest. Two changes:

  • parsePorcelain reads newline records when the output has no NUL, mirroring summarize_unsaved.
  • session_browse._ask reinstalls the current files once when a browse reply starts with op must be, then asks again. The retry is bounded to one; a refusal after it is returned. Tests: reads newline status from a guest worker without NUL status support, test_a_worker_without_the_read_op_is_reinstalled_once, test_a_refused_op_after_reinstalling_is_returned_not_retried, test_other_browse_errors_do_not_reinstall. Each was mutation-checked.

:150 truncated diff shown as complete. A role="note" line ("This diff is too large to show in full, so only its first part is shown.") renders above the patch when diff.data.truncated is set, with a test for presence and absence. Capturing it exposed a layout defect in the new panel: the diff wrapper was min-h-0 and a long patch painted over History. It is now shrink-0, so the column scrolls (git-panel-truncated-diff-dark.png).

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Design Review (PASS) punchline, answered: who carries the Kiro Cloud follow-up.

It has an owner and the code exists. The RemoteGitPanel.tsx and test edits that show the cloud-sandbox notice for a Kiro Cloud chat are kept as a ready patch. Whichever of this PR and #21260 merges second applies it, as the description's Stack paragraph says. It is not applied here because this branch's base has no Kiro Cloud provider for the notice to key on.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

First Principles (PASS) punchline answered: what --untracked-files=all does to the archive warning's count.

This is intentional, and the description now says so (Backwards compatibility). The panel needs each untracked file as its own row so it can show and diff it, so git_status lists them individually instead of collapsing a new directory into one entry. The archive warning reads the same status and therefore counts every file inside a new untracked directory. Those files are exactly what the archive would destroy, so the per-file count is the more accurate one. The warning's wording ("N uncommitted files") does not change.

@github-actions github-actions Bot removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 19, 2026
@kyleseaman

Copy link
Copy Markdown
Contributor Author

rebutted span=078b9c7f01fb: shorten emptyDiffListed.

This notice has been reworded in eight earlier rounds, each to a different suggestion. The current copy names the cause and the refresh action, so it stays.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

rebutted span=2759b2bf112e: give history rows plain styling with no hover highlight.

They already have it. History rows render as plain text with no button, no chevron and no hover background; only file rows carry hover:bg-bg-hover in RemoteGitPanel.tsx.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in a899077. span=743cad2faff2: the Git panel drafted its requests in a fresh chat not bound to the remote workspace.

Confirmed and closed as suggested. AskAgentButton gains an onStage prop: with a prompt, the click stages it through the caller instead of the error hand-off, and nothing navigates. RemoteGitPanel passes stageToMainComposer({ slot, text }), the slot-keyed composer channel SideChat already uses, so the set-up-repo, full-diff and full-status drafts land in THIS chat, the one bound to the guest. Error notices keep the shared hand-off. Tests in RemoteFilesPanel.test.tsx now assert the draft lands in chat.mainComposerAppend for the panel slot, with no hand-off and no navigation; both fail on fee8541.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in a899077. span=c3ffd8c5b753: inline PEM openers bypassed private-key masking.

Confirmed and closed as suggested. _withhold_unclosed_pem in coder/session_browse.py now finds PEM BEGIN/END markers anywhere in a line (_PEM_MARKER_RE), not only on a line that starts with one, so a field-prefixed opener such as key: -----BEGIN RSA PRIVATE KEY----- with no matching footer is withheld through EOF before the patch is built. Markers in one line are read right to left in the same backwards pass, so a matching footer, prefixed or not, still closes its block. New tests: test_a_field_prefixed_unclosed_pem_is_withheld (YAML, JSON and key= openers over a random 32-column body; all three fail on fee8541) and test_a_field_prefixed_footer_closes_its_pem.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in 1573936. span=be531ed8177b: cached diffs survived a refreshed repository status.

Confirmed and closed as suggested. The diff query in RemoteGitPanel.tsx now sets staleTime: 0, so reopening a file and returning to the tab re-read its diff, the way status already refetches; the app default (staleTime: Infinity) no longer keeps a patch the agent has since committed. New test re-reads a file diff when it is reopened, under the app query defaults mounts the panel on the app's own newQueryClient(), changes the guest's diff between two opens, and asserts the second open shows the new patch with two diff reads; it fails without the fix.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Windows fix for the guest Git reads (in 1573936, src/kiro_crew/remote_session/workspace_tools.py).

Windows backend shards 1, 2, 3, 6 and 8 failed on fee8541 in 15 tests this PR added. All 15 now run on Windows with no new skip. There were two causes:

  • Test fixtures (test-only). The tests wrote files with write_text("...\n"), which Windows text mode writes as CRLF, so the guest correctly read back \r\n. The fixtures now pass newline="\n".
  • Product: Git reads that reach the size limit. On Windows a capped log, status or file-contents read waited out its 30-second deadline and failed. Stopping the process the guest started does not stop git there: git.exe is a launcher, and Windows has no process-group signal. Three changes in _run_grouped / _unwind:
    1. At the cap, the guest closes its end of git's output pipe, so git's next write fails and it exits, on every platform.
    2. On win32 the read runs without the coreutils timeout wrapper. The timeout on PATH may be System32's unrelated wait command, and none can signal a Windows process tree; the deadline is _run_grouped's own.
    3. A read past its deadline on Windows ends its whole tree with taskkill /T /F from the system directory (new _stop_tree, added to the guest spawn-audit list), so no orphaned git.exe is left. Linux and macOS keep the existing group stop through timeout.

Tests, all running on every platform: test_a_windows_capped_read_ends_the_writer_by_closing_its_pipe (fails without the pipe close: 34 s and a timeout, versus 0.2 s), and test_a_read_past_its_deadline_leaves_no_process_behind (a leader starts a child holding the pipe; after the deadline the child must be gone; fails when _unwind stops only the leader).

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in f64c0f2. span=e6991c559ca6: a staged executable-bit change disappeared from the remote diff under core.fileMode=false.

Confirmed and fixed as suggested. Where git cannot trust the filesystem mode bit (core.fileMode=false) or symlinks (core.symlinks=false), _git_bodies in workspace_tools.py now takes the worktree mode from the stage-0 index entry, the way git's ce_mode_from_stat does, and keeps HEAD's mode as the old side. A path the index does not hold keeps HEAD's mode, as before. New test test_a_staged_chmod_shows_where_git_does_not_trust_the_mode_bit sets core.fileMode=false, runs git update-index --chmod=+x with the bytes and permissions unchanged, checks git's own HEAD diff shows 100644 -> 100755, and asserts the gateway patch shows the same; it fails without the fix.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in b1fe0ce. span=464a82c52865: group-only execute permission produced a false Git mode change (workspace_tools.py:1143).

Confirmed and fixed as suggested. _worktree_mode now tests stat.S_IXUSR, the owner execute bit git's ce_permissions uses, instead of any of 0o111. Checked against real git: a tracked 100644 file edited and set to 0654 shows no mode lines in git diff HEAD. New test test_only_the_owner_execute_bit_makes_a_file_executable_to_git covers 0654 and 0645 (both 100644) and 0744/0755 (100755); the first two cases fail without the fix. docs/system-specs/modules/providers.md now says the owner execute bit.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

acknowledged span=464a82c52865: HEAD-based CRLF detection hides a staged renormalization (workspace_tools.py:1323).

Not changed in this round; the adjudicator downgraded it (DOWNGRADE F1 ... reason=disproportionate-remedy). The trigger is an uncommitted git add --renormalize of a CRLF file after turning on text=auto or core.autocrlf, with the worktree left CRLF. The panel then shows no diff for that file; nothing is written and no repository data changes. The state ends at the next commit: once HEAD holds LF, crlf_in_head is false and the bodies fold as git does. Reading the stage-0 index blob instead would add a second bounded blob read on every CRLF diff for this one transient state.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in 97da38e. span=f0ee454cd4e3: the error-state "Ask the agent" link went to the wrong chat.

Confirmed and fixed. ErrorNotice gets an optional onStage, forwarded to AskAgentButton; when set, the hand-off stages the same error prompt it would carry (askAgentPrompt, resolved at click time) into a composer the caller owns, and nothing navigates. Only the Git panel passes it: failure() in RemoteGitPanel.tsx gives both its notices (the stopped-workspace sentence and the failed changes, history or diff read) onStage={stage}, the same stageToMainComposer step its other links use, so the draft lands in THIS chat, the one whose agent can reach the workspace. askAgent stays on, so errors-use-error-notice is unchanged, and every other caller still hands off to a fresh chat. Tests: RemoteFilesPanel.test.tsx checks both Git panel failures stage into chat-1 with the error context and navigate nowhere (both fail on revert); new ErrorNotice.onStage.test.tsx checks a notice without onStage still opens a fresh chat, in both variants. The two notes (sync counts, emptyDiffListed wording) are not changed in this round.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in 5d42e44. span=e6991c559ca6: the CRLF safeguard read HEAD, not the index, so a staged renormalization showed no diff.

Confirmed and fixed as suggested. _git_bodies now bases automatic conversion's CRLF safeguard on the stage-0 index entry, as git's has_crlf_in_index does: the safeguard holds only when the index blob is text containing CRLF. HEAD stays the old side. The index blob is read (through the same bounded cat-file path as the HEAD blob) only when its object id differs from HEAD's, and both text=auto and core.autocrlf use the one predicate. New test test_a_staged_renormalization_of_a_crlf_commit_shows_as_git_does commits CRLF, turns on text=auto or core.autocrlf=true, runs git add --renormalize, checks git's own HEAD numstat is 2 2, and asserts the new body folds to LF; both cases fail without the fix, and test_auto_crlf_keeps_a_file_committed_with_crlf_as_git_does still passes. providers.md now describes the index check.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in f9748e3. span=e6991c559ca6: lossy decoding hid non-UTF-8 file edits (workspace_tools.py:1359).

Confirmed and fixed as suggested. _git_bodies now decodes both bodies strictly. When either is not valid UTF-8 and the bytes differ, it returns the existing binary reply, so the gateway writes Binary files a/... and b/... differ instead of an empty patch. Identical bytes stay identical text, so a mode-only change keeps its header-only patch. New test test_a_non_utf8_edit_is_not_hidden_behind_replacement_characters changes a Latin-1 \xe9 to \xf1, checks git's own numstat is 1 1, and asserts the binary reply and patch line; it fails without the fix. test_unchanged_non_utf8_bytes_stay_equal_text pins the equal-bytes branch. providers.md now names the non-UTF-8 case. The dashboard/file_api/editor.py sites listed are the base's local editor comparison, which this PR does not touch, so they are left unchanged here.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in 3d3157a. span=8c86f99f82f4: a pure rename or mode change of a binary file showed "Binary files ... differ" (workspace_tools.py:1317).

Confirmed and fixed as suggested. _git_bodies now marks a NUL-bearing pair binary only when the bytes differ; identical bytes return equal empty bodies, so the gateway writes only the rename or mode header, as git does. New test test_a_pure_rename_of_a_binary_file_shows_no_content_change stages git mv of a PNG-like blob, checks git's own diff has the rename and no "Binary files" line, and asserts the gateway patch matches; it fails without the fix. The same test then edits the bytes and checks the binary line still appears for a real change. The 1,638-line note on workspace_tools.py is non-blocking and unchanged here.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in f162695. span=93a30e36bb6d: reordered repeated lines made the gateway's diff quadratic (session_browse.py:316).

Confirmed and fixed as suggested. _git_diff_from_bodies now counts the equal-line pairs SequenceMatcher would consider (lines it would autojunk excluded, mirroring difflib's 1% rule) and, past 200,000 pairs, returns the same cut-off reply as an over-cap file: header only, truncated, so the panel shows its notice and the full-diff hand-off. Measured: the reviewer's input (100 distinct lines x 200, reversed) is 4,000,000 pairs and took 70 s unbounded; worst cases at the budget finish in under a second, and a 20,000-line file with scattered edits stays at about 20,000 pairs and still gets its hunks. New tests: test_reordered_repeated_lines_get_the_cut_off_reply_not_a_minute_long_diff (fails without the fix: 69 s against its 2 s budget) and test_a_large_file_with_scattered_edits_still_gets_its_hunks; the 64K repeated-line test still passes. providers.md no longer claims the junk heuristic keeps such input fast. The workspace_tools.py size note is non-blocking and unchanged.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

acknowledged span=e6991c559ca6: a staged removal (git rm --cached on an unchanged file kept on disk) shows an empty patch (workspace_tools.py:1289).

Not changed in this round; the adjudicator downgraded it (DOWNGRADE F1 ... reason=disproportionate-remedy). The panel still lists the file with its D status, nothing in the repository changes, and the state ends when the removal is committed. The real fix passes the row kind (Deleted or Untracked) through the request API and the panel's query key and adds an index-aware branch to the body reader; the base's local reader (dashboard/file_api/editor.py:722) has the same behaviour and is outside this PR.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in ace301d. span=c3ffd8c5b753: the pair-count pre-check is gone. _git_diff_from_bodies now builds the hunks from a SequenceMatcher subclass that charges every find_longest_match call its range length plus the b positions it can scan for those lines, across every recursive subrange, and returns the existing cut-off reply once 5,000,000 units are spent (about a second). The swapped-neighbours repro now stops at the budget; test_unique_lines_with_swapped_neighbours_get_the_cut_off_reply_fast fails on revert (9.9 s). The hunk output is pinned to difflib.unified_diff by test_budgeted_hunks_match_difflib_unified_diff.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

acknowledged, not changed. span=be531ed8177b: downgraded by adjudication. It needs a guest worker from before this PR's NUL status support, and only a C-quoted name on one row fails. It clears once a later message reinstalls the worker. No change in this PR.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in 47da56f. span=c3ffd8c5b753 (multiline filename masking): NUL status redaction now keeps a status record's XY code and masks only its name, and the record after an R or C row is treated as its source path with no code. A masked record therefore stays its own row and no longer reads as a rename that swallows the next one. test_a_masked_status_name_keeps_its_code_and_the_rows_after_it fails on revert, and so does the updated test_nul_status_record_with_multiline_credential_is_withheld.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

acknowledged, not changed. span=e6991c559ca6 (capped index blob): downgraded by adjudication as disproportionate. It needs a staged blob over 256 KiB whose first CRLF lies past the cap, while HEAD and the worktree copy are both under it. The panel is read-only and the git CLI still shows the change.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

fixed in 333ed3c. Second unified-diff engine: the matcher is gone. _BudgetedMatcher, _unified_hunks, _unified_range, _DiffBudgetSpent and _DIFF_WORK_BUDGET are deleted. The file panel's git diff --no-index of two masked bodies moved out of api_file_diff unchanged into src/kiro_crew/git_no_index_diff.py (no_index_diff, same argv, temp dir, timeout and failure rule). editor.py calls it, and its existing tests pass unchanged. The remote Git panel takes only git's hunk lines from it and keeps its own mode, rename, deleted-file, binary and over-cap header. The spawn-audit entry moved with the spawn. test_the_panel_takes_its_hunks_from_the_shared_git_diff_of_masked_bodies and test_the_panel_diff_uses_the_file_panels_git_argv fail if the panel stops using it. The reordered-repeated-lines case is now git's diff, under 2 s (test pinned).

@iamwhatever

Copy link
Copy Markdown
Contributor

Hold at c0adc9e.

  1. Merge conflict. The branch no longer merges with main; website/src/i18n/pluralKeys.json conflicts. Rebase onto current main. The new head will need a fresh review.
  2. Sensitive change, reserved for a human reviewer. The diff adds a security-posture sink declaring that remote Git output is redacted (security_posture_sinks_gateway.py#L866), new guest-side git reads behind the owner-only browse route, git transport and credential isolation, and a shared timeout wrap that terminates child processes (workspace_tools.py#L374-L393). A maintainer needs to review these.
  3. Sensitive Change Review is red on this head because the reasoning template has not been posted. Post it for the rebased head.

All five AI lanes PASS on this head. Their notes (CRLF equivalence test, the unused prompt hand-off path, three UX copy points) have no reply yet; please answer them on the rebased head.

I did not run anything locally, and I did not complete a line-by-line review because the head has to change.

— crew-pr-reviewer (r137)

- Withhold a footerless PEM key whose opener follows a field prefix
  (`key: -----BEGIN ...`): openers and footers are now found anywhere in a
  line, so the key fails closed instead of reaching the patch (GPT 6.1).
- Stage the panel's "Draft a request" prompts in this chat's own composer
  (`stageToMainComposer`, via a new `AskAgentButton` `onStage`), not a fresh
  chat that is not bound to the remote workspace (Opus 5.5).
- Re-read a file's diff on reopen and on return to the tab (`staleTime: 0`),
  so a patch the agent has committed no longer stays on screen (GPT 6.1).
- Windows: a capped Git read ends its writer by closing its end of the pipe;
  the read runs without a `timeout` wrapper there (one on PATH may be
  System32's unrelated wait command); and a read past its deadline ends its
  whole process tree with `taskkill /T`, since git.exe is a launcher and
  Windows has no group signal.
- Tests: the guest Git tests write LF fixtures explicitly, which Windows
  text mode wrote as CRLF.
@kyleseaman

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 6049487
  • What rule changed: none. _GATEWAY_SINKS in src/kiro_crew/security_posture_sinks_gateway.py (part of security_posture._REDACTION_SINKS) gains one 7-line entry, "Remote session Git views" -> coder/session_browse.py, registering the new gateway redaction of the remote Git views as an egress sink. It is the only Sensitive Change Review file this PR touches, and security_posture.py itself is unchanged.
  • Before -> after (what was allowed/blocked, now): before, there was no remote Git view and no sink for it. After, session_browse.browse_session runs git_status, git_log and git_diff output and error text through redact_via_context before it reaches the dashboard, and the posture registry lists that sink, as the drift guard requires for every redactor call site. Nothing that was allowed or blocked before changes.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the security posture panel lists one egress path with a wrong label. Scanning, sandbox rules, defaults and permissions are untouched, so no command breaks, no secret is exposed and no user is locked out.
  • Evidence checked (which sandbox result proves it): N/A for a sandbox result, since no sandbox rule changed. Instead: the diff of this file is the single 7-line tuple, byte-identical to earlier heads; on this head, removing the entry makes test_every_redactor_call_site_is_a_registered_sink_or_allowlisted fail naming coder/session_browse.py, and restoring it passes test_security_posture (56 passed).
  • No regression:
    • Tools still work (which tools/commands were run, result): yes. Only data in a registry tuple changes; the scoped backend run on this head (6,837 passed) covers the remote file, Git, file-diff and command tools.
    • Backward compatible (old config / old data / old callers still work, how checked): yes. The entry is additive; no existing row, key or caller changes, checked by the unchanged rest of the file diff.
    • Existing tests (which suites passed on this head): test_security_posture (56), test_coder_session_browse, test_api_file_diff and the remote Git/session-environment suites (6,837 passed, 25 skipped), Fast Gate 29/29, Backend Lint 14/14, Semgrep 0 findings.
  • How to undo: revert this entry together with the redact_via_context call in coder/session_browse.py; the drift guard requires the two to go together.

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