Skip to content

feat: add credentialed git for remote sessions - #21256

Merged
iamwhatever merged 2 commits into
mainfrom
feat/session-environments-git
Oct 29, 2026
Merged

iamwhatever merged 2 commits into
mainfrom
feat/session-environments-git

Conversation

@kyleseaman

@kyleseaman kyleseaman commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Kiro Cloud moved out. Kiro Cloud Sessions, which #21260 built and which rode here as this PR's second commit, now moves to its own follow-up PR, stacked on this one (branch feat/session-environments-kiro-cloud). That PR retargets to main when this one merges. This PR is credentialed git only. The split moved hunks between the two halves and changed no behaviour: the Kiro Cloud branch's tree is identical to this PR's previous two commits rebased onto main, plus one feature-map docs line main's gate now requires.

Behind the developer flag. Credentialed git is reachable only with KIROCREW_DEV_MODE set, off by default. With it unset a chat is never placed on a profile (SessionEnvironmentChoices.resolve answers local and the runtime start skips prepare_for_session), so no workspace relay and no git proxy is ever started, and the Settings card offers no profile. Pinned by test_flag_off_reaches_no_workspace_so_no_credentialed_git, which fails with the flag check removed.

Sensitive change: none. No file in this PR's diff against main matches the Sensitive Change Review watched paths (.github/scripts/sensitive_change_review.py).

Problem / Motivation

Goal: Let git in a remote session's workspace reach private repositories on GitHub, GitLab, Bitbucket and Azure DevOps without any credential ever being stored in that workspace.

A session on a Coder workspace (#19833) runs its shell in the guest, but the guest holds no git login. git clone of a private repository fails, git push fails, and the only workaround is to copy a token into a disposable machine the user does not fully control. The dashboard's Git view also shows the gateway's local checkout, which is the wrong machine for a remote session.

Why it matters

Most real work in a remote session ends in a clone, a fetch or a push. Without git access the remote workspace is only good for public code, and pasting tokens into guests spreads long-lived secrets onto machines that are created and thrown away all day. Keeping the credential on the gateway gives remote sessions working git while the secret stays where the user already keeps it.

Not a goal

  • Putting any credential, SSH key or agent forwarding inside the workspace.
  • Hosts other than github.com, gitlab.com, bitbucket.org and dev.azure.com (self-hosted GitLab, GitHub Enterprise, Azure's legacy ORG.visualstudio.com URLs).
  • Carrying Git LFS object transfers through the gateway; private LFS keeps needing workspace-side authentication.
  • Isolating guest processes that run as the same OS user from each other (that needs separate guest users).
  • Writing from the dashboard's Git view (stage, commit, push); it is read-only.
  • Providers other than Coder. Kiro Cloud Sessions moved to its own follow-up PR, stacked on this one; each later provider PR inherits this proxy.

Known limitation: an organisation-scoped git credential helper (credential.https://dev.azure.com/<org>.helper) isn't matched yet, because the gateway asks its helper per host with no repository path. Host-scoped helpers (credential.https://dev.azure.com.helper, credential.helper) and az login work. With only an org-scoped helper, Azure is not lent (its git uses the workspace's own login), and the refusal and the gateway log name the setting to use; pinned by test_an_organisation_scoped_helper_fails_closed_and_says_what_to_set.

Windows gateways: credential lending works on Windows. Git runs every credential helper through sh -c, and Git for Windows' sh is not on the trusted PATH, so there _fill_directly runs each validated helper executable itself. It follows git's config order, list resets and host-scoped keys, and speaks the helper protocol on stdin and stdout. The secret is in no argv, environment or file. Git Credential Manager beside git.exe (mingw64\bin) is accepted under the same protected-install walk. A timed-out or cancelled lookup kills the whole process tree. The relay token file gets an owner-only DACL that is read back before the token is written; otherwise the file is removed and the launch fails. A Windows gateway that cannot read its own SID or the security-descriptor API lends nothing (lending_unverifiable, audited as windows-unverified). POSIX behaviour is unchanged. With #23498 (remote workspace paths matched as POSIX on any gateway, now on main), a remote workspace starts on a Windows gateway too, so lending works there end to end. Tests: test_remote_git_windows_lending.py, plus the two real-git helper-isolation tests, which now assert on Windows that lending works and that no repository, environment or crafted helper ran.

What changed (motivation → approach → change)

Git in a remote workspace works for private repositories on the four hosts, and the credential never leaves the gateway. The remote Git panel is not in this PR: at the maintainer's request it is its own PR, stacked on this one (see Stack).

The guest runs a small HTTP proxy on loopback. Each command the agent runs gets git's environment config (GIT_CONFIG_COUNT, no config file written) that points the HTTPS and SSH spellings of each host the gateway can lend a login for at that proxy. Other hosts keep the workspace's own git login. Where both have a login for a host, the gateway's is used: lending by default outside strict is the maintainer's decision (strict is the opt-out; chosen over per-tier lending, so standard and cc also lend logins they hide locally, such as Azure's), and routing only lendable hosts is the stack conductor's ruling. The proxy sends each request over the session's existing authenticated worker link. The gateway checks it, adds the login, and streams the answer back.

What the user meets How it behaves
Clone or fetch, standard or cc sandbox, host the gateway is signed in to goes through the gateway, which adds its own login for that host
Any git, host the gateway has no login for not routed: git uses the workspace's own login (SSH key, GIT_ASKPASS), as it would without Kiro Crew
Any git, strict sandbox the gateway lends no login and runs no credential program, so no host is routed: the workspace's own login applies everywhere
Push of a feature branch (a force-push or delete included), standard or cc sandbox goes through with no prompt, as it would from a local session
Push that updates or deletes a protected branch (main and the other names the local git-publish check protects, in any spelling: refs/heads/main, refs/remotes/origin/main, any case) the whole push is refused before any of it goes upstream, even its feature-branch commands; git prints ! [remote rejected] … (protected branch) per ref and a remote: Kiro Crew: … line saying why
Push whose ref updates cannot be read (bad pkt-line, compressed body, cut off before its flush, signed push) refused with a 403
Push, strict sandbox not routed (above); a request that still reaches the proxy is refused with the strict message before its body is read
Settings › Verify readiness one row per host: signed in, not signed in plus the command to run on the gateway (gh auth login, glab auth login, az login), or can't be checked, so git will use the gateway's saved login if any (Bitbucket, which has only git's credential helper; the row says to clone a private repository over HTTPS on the gateway so the helper saves the login). Under strict, one row instead: no login is shared and each workspace uses its own, with a link to the agent sandbox setting on Developer › Config. Each state has its own muted glyph; red stays for Coder and template failures
Part What it does
src/kiro_crew/remote_session/git_proxy.py guest proxy (stdlib, Python 3.9): needs the launch secret as a Bearer header, 16 live requests at most, cancel frames for abandoned requests
src/kiro_crew/remote_session/git_gateway.py GitProxyChannel: smart-HTTP endpoints only, per-host repository-path shapes, upstream URL rebuilt from validated parts; network.egress check per request for the calling agent and the session's owning app (vet_and_audit(agent=..., app=...), so an app profile that denies a host also governs git; fail-closed, audited); the sandbox tier read on every request (an unreadable tier lends nothing); the protected-branch rule on each git-receive-pack body (PushCommands, is_protected_ref, reusing the local check's _PROTECTED_BRANCHES and _normalize_ref rather than a copy); one SEL row per push decision; LFS batch calls sent to their direct endpoint without a login
credential lookup (same file) gh, glab, az or git's credential helper, each executable checked with validate_provider_executable(require_protected=True); a minimal child environment; only fixed built-in helper names (store, cache, osxkeychain, manager, manager-core, libsecret, wincred, exact gh auth git-credential); logins cached in memory for five minutes and never logged
src/kiro_crew/remote_session/workspace_tools.py the per-command rewrite, applied only while the proxy port answers
src/kiro_crew/coder, src/kiro_crew/providers, src/kiro_crew/acp start the proxy in the background at session start with the calling agent, stop it when the relay that owns it closes, ship git_proxy.py to the guest; the agent's notice says git works, the workspace holds no keys, strict refuses private reads and pushes, and a protected-branch push is refused as locally
src/kiro_crew/platform, src/kiro_crew/change_card_catalog_kinds.py vet_and_audit takes the agent; the code-exec note names git credentials
src/kiro_crew/dashboard the readiness check's git map, from git_readiness() (status commands only; withheld for every host under strict)
website/src/pages, website/src/api, website/src/i18n, website/src/hooks git rows in Settings › Verify readiness (check, sign-in, lock and dash glyphs; sign-in commands as code), GitLoginStatus, a link to the agent sandbox row on Developer › Config (an agent.sandbox highlight anchor), strings in all 13 catalogs; Bitbucket added to the brand allowlist and glossary
docs/system-specs/modules/providers.md, docs/system-specs/modules/governance.md proxy design, strict-tier lending, push outcomes, egress seam

What the launch secret does and does not protect: each proxy has its own random secret, given to that session's tool server over stdin. A command in another session's tools cannot use this session's proxy by accident. A deliberately malicious process running as the same OS user in the same guest can still read that secret, because nothing separates processes of one user there.

Pushes follow the native-session rule at the maintainer's request: there is no approval card. The rule covers pushes routed through the proxy only; a push made with the workspace's own login goes straight to the forge, as from any machine holding that key, and no other mechanism stands in front of it. The proxy refuses a push whose destination refs include a protected branch, judged by the local git-publish check's own branch list and ref normalisation (on the refs git sends, after it resolves a bare or --all command), and lets every other push through. The same-user limit applies to pushes too: any process in the workspace can push a feature branch (a force-push included), as any local process can on the gateway. The login lent is the gateway's whole login for that host, not one scoped to the session's repository, so such a push can reach any repository that login can write to, exactly as the same gh/glab/az login can from a local session.

The spawn audit lists the two new gateway calls (git_gateway.py::_run_quiet for credential reads, git_gateway.py::login_status for readiness), each with fixed verbs and a host from HOSTS. Scanner and ratchet baselines are unchanged.

Stack. #19833 (A, Coder backend), #22238 (B, UI and dashboard API) and #21259 (health card) are on main. This PR (credentialed git) targets main. Next comes the Kiro Cloud Sessions PR, stacked on this one, then #21257 (Sprites, boxd), #21258 (Fargate) and #21995 (remote Git panel). Until the Git panel PR lands, a remote session's Git tab shows #19833's notice.

On this move (onto main, Kiro Cloud split out)

  • Rebased from the health card onto main (health feat: add a health card to remote session environments #21259 merged as 4beecef5f2). Two additive conflicts: website/src/hooks/useSettingHighlight.test.ts keeps main's desktop-app close row next to this PR's agent-sandbox row, and SessionEnvironmentsCard.tsx keeps main's RawDetails next to this PR's status-glyph CheckLine.
  • docs/feature-map/README.md: the session-environments settings row now names ../overview/agentSandboxLink.ts (the strict-sandbox link this PR adds), as main's feature-map gate requires for a new file under pages/.
  • Two test lines that exercised Kiro Cloud code moved to the Kiro Cloud PR with that code: prepare_for_session's agent argument assertion in test_remote_git_governance.py, and the chosen_provider patch in test_session_environments_developer_flag.py. Nothing in this PR imports, names or configures Kiro Cloud.
  • Carried from earlier rounds: a credential helper installed outside Git's exec-path (Git Credential Manager in /usr/local/bin) is found in the trusted system directories and still must pass the protected-binary check; each host's login is looked up concurrently under its own lock, published per host until the first full list is out; a git command run before the gateway answers the proxy's first lend waits up to 20 s, so a first private clone right after start is routed with the gateway's login.

Backwards compatibility

Compatible: the proxy runs only for sessions on a remote environment; vet_and_audit gains an optional agent keyword; the check response gains a git field; local sessions are untouched. A provider CLI or credential helper that the gateway user can overwrite (for example a user-owned Homebrew install, or a custom helper script) is not used for remote git; remote git is new in this PR, so no working setup loses it.

Removes nothing: every change adds to the remote-session path; no existing setting, endpoint or browse op is renamed or dropped.

Tests

  • test/test_remote_git_proxy.py: a real git clone and feature-branch push through the real guest proxy and gateway channel against git http-backend on all four hosts' path shapes; the token never reaches the guest; only hosts the gateway can lend for are routed: a host with no gateway login keeps the workspace's own URL and GIT_ASKPASS (fails with routing forced on for every host), strict and no-login publish an empty list and route nothing, a list naming another proxy's port routes nothing, a lendable host still gets the protected-branch refusal, and an upstream 401 republishes the list at once, a refused login staying unlent until its source returns a new one; a crafted [credential "…=…"] subsection in ~/.gitconfig runs nothing (real git); real git push to every protected name, refs/heads/main, +HEAD:main, :main, HEAD:MAIN, refs/remotes/origin/main, and a feature-plus-protected push are each refused whole with refs unchanged and nothing sent upstream; a force-push and a delete of a feature branch go through; the parser reads commands however the body is framed and refuses 13 malformed shapes; the proxy's predicate agrees with the local check's on 8 ref spellings; a refusal stays inside the side-band packet limit for refs up to 65 KB; a rejected credential never makes git prompt; egress is judged before any credential is read; the sandbox tier decides lending (governance floor included, unreadable tier lends nothing); strict reads anonymously, names itself on a private read and refuses pushes, feature branches included; an unparseable config or one whose top level is not an object lends no login (the loader stands defaults in rather than raising); every push decision (allowed, protected, unreadable, strict) and every request refused before the egress check writes one SEL row, and a failed SEL write changes no answer; readiness reports withheld under strict. With is_protected_ref forced to False, 15 of these tests fail.
  • test/test_remote_git_credential_isolation.py: repository, environment and shell helpers are never run; an agent-planted gh/glab/az is never executed; overrides need protected provenance; credential fill reads a validated snapshot, not live config; per-launch secret.
  • test/test_remote_git_proxy_admission.py, test/test_remote_git_channel_bounds.py, test/test_remote_git_cancellation.py: the 16-request limit, wire backpressure through the link's own consumer gate (a paused git reader never trips the stall check), cancelling one request without stalling others, real LFS clone/smudge and pre-push through the redirect.
  • test/test_remote_git_proxy_port_file.py, test/test_remote_git_governance.py: each proxy's own port file (no shared default on either side), the calling agent carried from provider start to the audited egress check, refusal with no agent.
  • test/test_remote_session_launch.py, test/test_spawn_audit.py: the proxy stops when its runtime ends normally, an older relay closing does not stop the live proxy, the agent notice is true on every tier, audit entries.
  • website/src/test/SessionEnvironmentsCard.test.tsx: one row per git host with its sign-in command, and the strict row instead of a sign-in report.
  • Ran on this head (one commit, on main 3dc2964c94; the patch is identical, by range-diff, to the one gated on main ed694b8f03): every changed test file plus test_session_environment_handlers, test_coder_session_launch, test_change_cards, test_session_environments_config_api and every facade test, 4473 passed (test_cli_doctor_refactor_facade's Path case fails only under this machine's Python 3.13, pathlib._local); the Fast Gate checks (30), black, isort, flake8, mypy and the file-line cap (15); tsc --noEmit, eslint on the 10 changed TS/TSX files, i18n:check; push_guard. No home-directory path in added lines; no Sensitive Change Review path touched.
  • Not run by the agent: the full backend and frontend suites (CI runs them), semgrep (CI's SAST job), native Windows and macOS, guest Python 3.9, and live provider infrastructure.

Manual verification

  • Still to do: clone and push a private repository on each host from a live Coder workspace on a dev gateway, including a refused push to main, under both a standard and a strict sandbox.

Screenshots / video

Rendered from this head's built dashboard on a loopback server with every API call answered from fixtures (no gateway, no workspace).

Settings › Verify readiness: GitHub signed in, GitLab and Azure DevOps not signed in with the command to run, Bitbucket not checked:

Readiness check with git login rows, dark

The same check under the strict sandbox: no host's login is lent:

Readiness check under the strict sandbox, dark

Where that row's link lands: Developer › Config, with the Sandbox row highlighted:

Developer Config page after following the sandbox link, Sandbox row highlighted, dark

A push has no screen of its own: a refused protected-branch push shows in git's own output (see the table above).

Light theme

Readiness check with git login rows, light

Readiness check under the strict sandbox, light

Developer Config page after following the sandbox link, Sandbox row highlighted, 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

Contribution License Agreement

Contributed under the project's Apache-2.0 license (see the Licensing section of CONTRIBUTING.md).

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

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: the credential stays on the gateway, every forwarded request passes the network.egress ceiling with the calling agent and app, the feature sits behind the dev flag, and the change can be walked back.

Notes

  • The take-away check found nothing removed. The vet_and_audit(agent=…) and owning_app changes only add parameters, and the SEL row's agent or "kirocrew" matches sel.log_governance_decision's existing default.
  • Under standard and cc, a remote session is lent logins those tiers hide from local agents (~/.azure, ~/.git-credentials). The description records this as the maintainer's choice, and strict is the opt-out. If a per-tier policy follows, gateway_logins_lent is the one place to change.
  • In a guest older than git 2.31, the GIT_CONFIG_COUNT rewrites are silently ignored and git goes direct with the workspace's own login. That is safe, but users get no sign that lending is off; a version note in readiness would make it visible.

[DESIGN-REVIEWED] 1cb9be4

Description read

[DESCRIPTION-READ] 20507a58533c592712f61d2e9e91f783e0a7fb246b5ff5a37e783444e469170a

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 16, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 1cb9be4a6c6a4842c84f5c206eca74d09d75ecb6 — 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 is behind KIROCREW_DEV_MODE, which is off by default, so none changes what users get. Protected-branch matching reuses security._PROTECTED_BRANCHES/_normalize_ref instead of copying them.

What this change ships

Inventory (10 items) — 10 justified

Intent: let git in a remote Coder workspace clone, fetch and push private repositories on the four big hosts, using the gateway's login, without putting a credential in the workspace. ADDITION.

  1. Git in a remote session reaches private repos on GitHub/GitLab/Bitbucket/Azure through a gateway proxy (developer flag only) — justified
  2. A push that touches a protected branch is refused as a whole at the proxy — justified
  3. Under the strict sandbox no gateway login is lent and no host is routed — justified
  4. Each proxied request is governed and audited as network.egress per host, with the calling agent named — justified
  5. An app-owned chat's subagent keeps the app's governance profile for its git egress — justified
  6. Settings › Verify readiness shows one sign-in row per host, or one strict row — justified
  7. A strict-sandbox link from Session Environments to the Sandbox select on Developer › Config — justified
  8. Windows gateways run validated credential helpers directly and write an owner-only token file — justified
  9. "Bitbucket" added to the glossary and the i18n brand exemption — justified
  10. vet_and_audit gains an agent passthrough, which governance_permits already accepted — justified

[FIRST-PRINCIPLES-REVIEWED] 1cb9be4

Description read

[DESCRIPTION-READ] 89e749b992aa7dbbb65cd0a5873e8ac8336a31daedb2f29a2a8030ab993a38e5

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 16, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

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

UX-Verdict: PASS

cannot evaluate: missing the Windows-gateway readiness line (checkGitUnsupported). No screenshot shows this state, so nobody has seen how the line or its lock glyph renders.

Evidence gaps

  • The unsupported state in Settings › Verify readiness. On a Windows gateway that can't verify its own account, every host comes back unsupported and the card shows one line: "This machine can't verify its own Windows account, so its git logins aren't shared with remote sessions. Each workspace uses its own git login." None of shot-01 to shot-06 shows it. A screenshot of that state, in light and dark, would close the gap.

Notes

  • The Bitbucket row (checkGitUnchecked) is a three-clause paragraph. The blind reader said "beyond me… I would do nothing". Keep the row to "Bitbucket: can't be checked from here" and move the HTTPS-clone instructions into a disclosure or a docs link.
  • The link "Change the agent sandbox (Developer → Config)" leads to a card titled "Config Summary" with a row labelled "Sandbox". The reader "can't be sure the link lands there". Label the link to match the destination, e.g. "Change Sandbox in Developer → Config".
  • The Lock glyph already means "read-only" on the Config Summary rows (Provider, Embedding Provider). The reader saw the two meanings as different ideas. Use a different glyph for the withheld/unsupported rows in CHECK_LINE_ICONS, e.g. ShieldOff.

[UX-REVIEWED] 1cb9be4

Description read

[DESCRIPTION-READ] f6107099c87029444c26fa5e6017344f0cb9809f8eb007799952673e2ca49c81

That sha256 names everything this verdict read: the PR description, plus the 9 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 16, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 1cb9be4a6c6a4842c84f5c206eca74d09d75ecb6 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 1cb9be4

Verdict parsed from the review's SHA-scoped output markers for commit 1cb9be4a6c6a4842c84f5c206eca74d09d75ecb6.

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

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 1cb9be4a6c6a4842c84f5c206eca74d09d75ecb6 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 1cb9be4

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

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 16, 2026
@kyleseaman
kyleseaman force-pushed the feat/session-environments-coder branch from aff2e76 to 442ebb2 Compare October 18, 2026 23:33
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 18, 2026
@kyleseaman
kyleseaman force-pushed the feat/session-environments-git branch from 6b91cb7 to 47b1810 Compare October 19, 2026 00:03
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 19, 2026
@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 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
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 19, 2026
@kyleseaman

Copy link
Copy Markdown
Contributor Author

GPT F3 on 6c07852a86 (git_gateway.py:944, slow lookups withholding the first list): fixed in 209db96ca8. Each host now has its own credential lock and lendable_hosts looks the hosts up concurrently; until the first full list is out, _publish_lendable sends each host as soon as its login is found, so a CLI running to its 15 s limit for one host no longer keeps another host out of the answer the guest waits for. Refreshes publish only full lists, so a routed host is never briefly dropped. test_a_slow_lookup_does_not_withhold_another_hosts_login hangs every other host and checks GitHub is published first; it fails with the fix removed.

Comment thread test/test_remote_git_proxy.py Fixed
Comment thread test/test_remote_git_proxy.py Fixed
@kyleseaman

Copy link
Copy Markdown
Contributor Author

GPT finding F1 (6d7c953de6): "Partial host discovery releases the first-command wait prematurely" — fixed in 208adfe71c.

  • Gateway (git_gateway.GitProxyChannel._publish_lendable): each login found before the first full list is out goes in a lend frame marked "partial": true. The full list and every refresh are unmarked.
  • Guest proxy (git_proxy.Gateway.read_forever → _write_lend): a partial list is written as <port> * <host>.... * can never be a host name.
  • Wait (workspace_tools.git_proxy_env): _lendable_hosts returns (hosts, complete), and the command now waits until the list is complete. Only at GIT_PROXY_FIRST_LEND_WAIT_SECS does it route what has been found. A complete list, even an empty one, is still used at once, and a proxy that has exited still ends the wait.

Tests:

  • test_a_partial_first_list_keeps_the_command_waiting covers your scenario: GitHub is published partial and Azure completes the list later, so the command routes both. It fails with the old while lendable is None condition restored.
  • Two partial-frame tests now expect the marker, and test_lend_frames_are_kept_beside_the_port_file_and_cleared_on_exit covers the file format.
  • The spec in docs/system-specs/modules/providers.md is updated.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

GPT finding F1 (6bc9c52632): "Preserve valid cloud profiles when an omitted list contains a malformed entry" — fixed. The fix is committed into the Kiro Cloud commit and lands with the next push.

The stack moves bottom-up once B is green, so this push is held until then.

  • Fix (src/kiro_crew/dashboard/handlers/core_config_patch.py): _session_environment_key_validators now maps kiro_cloud_profiles to _keep_kiro_cloud_profiles. That function carries the omitted list through load_kiro_cloud_profiles, entry by entry. A malformed, non-object or duplicate entry is dropped, and the valid profiles are kept, along with an omitted default_profile that names one.
  • Unchanged: a saved value that isn't a list, or a list with no entry the loader keeps, still carries nothing.
  • Test: TestStaleCardSave::test_one_hand_edited_cloud_entry_does_not_drop_the_valid_ones is parametrized over a bad entry, a non-object entry and a duplicate id. It fails on all three with the strict validator restored.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

GPT finding F1 (21a34b42a8): "First private clone skips proxy-startup readiness" — fixed in cb1db28cd1.

  • Cause: workspace_tools.git_proxy_env returned at once when the proxy's port file was missing, so a clone during begin_git_proxy's background start missed the 20 s wait.
  • Fix: Workspace records when the tool server started and passes it as startup_since. During the tool server's first GIT_PROXY_FIRST_LEND_WAIT_SECS, a command with no listening port file now waits for one, inside the same bound, and then for the gateway's lend list as before. Past that window, a missing or dead proxy routes nothing at once, so a failed start delays no command.
  • Tests: test_remote_git_proxy_first_wait.py::test_a_command_while_the_proxy_starts_waits_for_its_port_file covers a port file published mid-wait, a proxy that never comes, and no wait after the window. It fails with the startup wait removed. test_the_tool_server_passes_its_own_start_to_the_proxy_wait pins the wiring.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

GPT finding F1 (cb1db28cd1): "Cloud authorization checks the template instead of the selected crew member" — fixed in fbfaf190dc.

  • Fix (src/kiro_crew/providers/acp_runtime_start.py): the start path now judges governed_agent = self._crew_agent or agent or "kirocrew". The crew member's own name, which is what a task profile binds to, comes before the template; a template-only session is still its template. That identity is passed both to prepare_for_session (the Kiro Cloud and remote-workspace gate through resolve_active_scope) and to begin_git_proxy (the proxy's egress checks and audit).
  • Test: test_remote_git_governance.py::test_provider_carries_agent_through_background_start_to_audited_channel[kirocrew--researcher] runs a crew member researcher on the kirocrew template with a task-bound researcher profile. It asserts that the git proxy is refused and audited as researcher, and that prepare_for_session received agent="researcher". It fails (401 instead of 403) with the template passed, as before.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

GPT 6.1 — subagent sessions drop the owning app (get_or_create.py:899): fixed in 49cbb64.

The finding was correct. Neither subagent session claim in subagent_manager/run_turn.py (dedicated or fallback) passed app_name. As a result, get_or_create set the child provider's owning_app to "", and a child on its root's remote workspace started the git proxy, so _egress_permitted judged egress without the owning app's profile.

Fix: run_turn.py now adds app_name=info.app to the shared extra_kwargs. That is the same app _vet_spawn_governance already vetted the spawn against. Both claim paths use those kwargs, so the child's owning_app, and with it the git proxy's egress check, now carries the app's binding. An app-less spawn still passes no app_name.

Test: test/test_subagent_owning_app.py checks that an app-owned spawn reaches get_or_create with app_name="mailer" and that an app-less spawn sends none. It fails with the fix reverted. The subagent, session-allocation and git-governance suites pass (2889 tests).

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Opus 5.5: blocking Windows ACL/SID calls on the event loop (git_gateway.py:883 and siblings). Fixed in 251f745.

The finding was correct. lending_unverifiable() reads the process SID and runs windows_acl.describe(sys.executable), which calls GetNamedSecurityInfoW and LookupAccountSidW. It ran inline inside coroutines, so an unreachable domain controller would stall the gateway's loop.

Fix: the new lending_unverifiable_off_loop() does the same check through asyncio.to_thread on Windows. Off Windows the check makes no system call, so it stays inline without a thread hop. These coroutines now await it:

  • host_credential
  • _from_git_credential
  • git_readiness
  • the channel's push refusal and its strict private-read refusal

_strict_refusal now takes unverifiable= from its caller, so building the message never touches the loop. Refusal behaviour, messages and the windows-unverified audit rule are unchanged.

Test: test_every_coroutine_reads_the_windows_walk_off_the_event_loop (test/test_remote_git_windows_lending.py) simulates Windows. It runs all three coroutines and asserts that the walk ran off the loop's thread every time. It fails if any site goes back to the inline call. The scoped and security suites pass (3791 tests).

@kyleseaman

Copy link
Copy Markdown
Contributor Author

GPT 6.1 — upload backpressure hides cancel and stalls the link (git_gateway.py:1141): fixed in 493bf95.

The finding was correct: serve() awaited queue.put on a full 64-frame body queue, so while an upstream stopped reading a push, the loop could not read that request's cancel or any other request's frames.

Fix: per-request credit flow control, so buffering stays bounded without the reader ever waiting.

  • Gateway: each request's queue holds UPLOAD_WINDOW (64) frames plus its end marker, and serve() only ever put_nowaits. Every body piece the request takes (_take, used by push admission and _drain) sends a credit frame back. A guest that sends past its window fails only that request (err 502, later frames dropped); the rest of the link keeps flowing.
  • Guest (git_proxy.py): sends a body frame only with credit in hand (Gateway.wait_credit), stops sending once the gateway answers the request with err, and sends cancel if git resets the connection while it waits.
  • Version skew fails closed: the gateway starts the guest with --build (the SHA-256 of its own git_proxy.py); a guest of another build, or started without one, exits before framing anything, and a guest link that ends before its first frame marks the proxy start failed, so git's wait ends at once.

Tests (each fails with its part reverted):

  • test_a_guest_past_its_upload_window_fails_only_that_request: request 2 is served while request 1's upstream is still stalled (old reader hangs).
  • test_an_upload_flows_on_credit_and_never_buffers_past_its_window: 200 pieces through a slow upstream, one credit each, queue never past the window.
  • test_a_large_push_sends_only_its_window_until_the_gateway_grants_more (guest).
  • test_a_stalled_upload_leaves_its_cancel_and_other_requests_readable, plus guest tests for refusal-while-waiting and git resetting while waiting.
  • test_a_guest_of_another_build_refuses_to_start_instead_of_hanging and test_a_guest_that_ends_before_its_first_frame_marks_its_start_failed.

The real-git clone/push end-to-end tests pass through both new sides; 3920 scoped tests, Backend Lint and Fast Gate pass.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

GPT 6.1 — a protected-branch refusal hangs large push uploads (git_proxy.py:171): fixed in 4d30bb3.

The finding was correct: a push refused for a protected branch is answered in git's own report-status as resp/body/end, but the guest only woke an uploader waiting for credit on err. A refused pack past the ~1.5 MiB window therefore parked in wait_credit and git never saw the refusal (the branch stayed protected; nothing went upstream).

Fix: Gateway.read_forever now treats any answer, resp or err, as the end of the upload: it sets the request's answered flag and wakes a waiting sender, which stops sending body frames, delivers the queued answer to git through _answer, and closes the HTTP connection with the rest of the body unread.

Test: test_an_answer_while_waiting_for_credit_reaches_git_and_ends_the_body[response] parks a push past its window, answers it with resp/body/end, and checks git receives the refusal and that no further body, end or cancel is sent. It fails with the err-only wake restored (git never finishes); the [error] case covers err.

The same push also replaces two fixed sleeps in those tests (Semgrep test-sleep-as-barrier) with waits on the parked credit wait and the request's retirement; CI's pinned Semgrep 1.78.0 reports 0 findings.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

GPT 6.1 — close stdin before communicate() crashes on Python 3.12 (test/test_remote_git_upload_credit.py:190): fixed in e241c21.

The finding was correct: on Python 3.12 Popen._communicate flushes stdin, so closing it first raises ValueError: flush of closed file. macOS shard 1 failed on exactly the three cases of test_a_guest_of_another_build_refuses_to_start_instead_of_hanging; a minimal reproduction raises on 3.12.13 and passes on 3.13, which is why it passed locally.

Fix (test-only, one line): the explicit proc.stdin.close() is removed, so communicate() closes stdin itself, which ends the proxy in the same-build case or finds it already gone in the refused cases. No other test in the PR closes stdin before communicate().

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Opus 5.5 — the readiness check drops the git rows when the Coder client can't be built (session_environments.py:137): fixed in dcf6f4b.

The finding was correct: the SessionEnvironmentUnavailable arm of api_session_environments_check (a Coder URL saved, but no coder CLI on the gateway) answered without the git key, so SessionEnvironmentsCard drew no git login rows at all, including the withheld/unsupported explanations.

Fix: that arm now returns "git": git like the other three; the git rows do not depend on Coder.

Test: test_check_endpoint_reports_a_missing_coder_cli_instead_of_failing now also asserts the git rows come back in that arm. It fails without the fix (KeyError: 'git').

@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at dcf6f4b.

The base is feat/session-environments-health, not main, so this PR cannot be approved for merge here. It also lends the gateway's git credentials to remote workspaces through a new proxy channel and adds a Kiro Cloud sandbox launch. Credential and network-route changes are reserved for a human maintainer.

On this head all AI lanes pass and CI is green. Every earlier GPT and Opus finding has an author reply. One open item needs a human: the First Principles lane notes that Kiro Cloud Sessions is outside the PR's stated Goal, and the description's note that a maintainer ruled to keep it here is not recorded by a maintainer on the PR.

Clears when: the lower stacked PRs merge and this one is retargeted to main and re-reviewed, a maintainer records the Kiro Cloud scope ruling (or amends the Goal), and a maintainer reviews the credential-lending path.

— crew-pr-reviewer (r124)

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Re: GPT 6.1 blocking finding on 045963ffe0 (session_handle_lifecycle.py:286, routine shutdown deletes private cloud workspaces): fixed in code in 9e1ca3dadf.

The finding was right, and the reach was wider than gateway restarts: provider.shutdown() is also what idle eviction, compaction and resets run, and closing or archiving a tab reaches the same close_slot → sessions.remove → provider.shutdown() path as the idle sweep. So no teardown can tell a chat ending from Kiro Crew letting go.

  • destroy() is back to the base's plain terminate_session, which the cloud harness's local-only teardown policy turns into a local unregister. No chat teardown sends _kiro/session/delete, in any memory mode. Only a start's cleanup of a sandbox it minted and recorded nowhere still deletes.
  • Test: test_cloud_teardown_never_deletes_the_sandbox (persistent, incognito, temporary) asserts no delete and no cancel. With the old destroy() its incognito and temporary cases fail.
  • The spec (docs/system-specs/modules/providers.md) and the PR body's lifecycle table say so, and the PR body lists the tradeoff under Known limitations: an incognito or temporary cloud session stays listed in Kiro Web until it is deleted there.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Re: GPT 6.1 blocking finding on 9e1ca3dadf (coder/session_launch.py:292, private cloud chats silently change sandboxes after idle eviction): fixed in code in 8dbe1b55bf, by the second route the finding offers: Kiro Cloud is refused for any chat whose memory mode is not persistent, before any sandbox exists.

Resume stays persistent-only, so incognito and temporary keep their promise of not reopening a native session. Instead they never reach the cloud, at all three places a cloud placement can come from:

  • The start: _start_kiro_runtime_impl raises SessionEnvironmentUnavailable once prepare_for_session returns a PreparedCloudSession for a non-persistent chat, before the runtime spawns or session/new is sent. test_a_private_chat_never_starts_a_cloud_sandbox (incognito, temporary) asserts the refusal, no session/new and no recorded cloud session.
  • The chat's environment choice: PUT /api/chat/slots/{slot}/environment answers 400 choice_refused with reason: private_chat; the chip shows a translated sentence. Coder and other remotes stay choosable. test_a_private_chat_cannot_choose_a_cloud_profile.
  • A Kiro Cloud default: apply_default_environment leaves the chat on this machine. test_a_private_chat_skips_a_kiro_cloud_default.

Each of the three tests fails when its site is reverted. Memory mode only tightens, so the strictest known mode (a committed tightening included) decides. The spec (docs/system-specs/modules/providers.md) and the PR body say so, and the earlier Known limitation about private cloud sessions is gone, since none can exist.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Re: GPT 6.1 blocking finding on b83fe34069 (test/test_remote_git_windows_lending.py:172, real-helper tests read the operator's credential store): fixed in 6e2d374cc3, test-only.

The finding is right: these fixtures point HOME at their own .gitconfig and drop GIT_*, but the system config still applies, and on macOS and Git for Windows it adds osxkeychain / manager. A developer with a saved Bitbucket login would have had that login answer first and printed in the failed assertion.

  • Every real-Git fixture named in the finding now starts its [credential] section with git's empty helper = entry, which resets the helper list, so no system helper is consulted: test_real_git_lends_through_a_directly_run_store_helper, test_a_windows_gateway_lends_with_real_git, and the two real-Git fixtures in test/test_remote_git_credential_isolation.py (the global-helper test and the crafted-subsection test). The organisation-scoped test there already sets GIT_CONFIG_NOSYSTEM.
  • The direct-store test now asserts that the store is the only helper run, instead of allowing a system helper ahead of it.
  • New test_a_helper_listed_before_the_reset_is_never_consulted: an osxkeychain helper in a trusted directory holds another login and is listed before the reset; the lookup returns the fixture login and the helper never runs. It fails with the reset line removed.

No product code changed.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Re: Opus 5.5 blocking finding on 9c1ca77d33 (website/src/pages/settings/SessionEnvironmentsCard.tsx:723, the repositories field rebuilds its text on every keystroke): fixed in 6aff74f5d13578f7c5ffdf4e575ec5c1f10b2e28.

The finding is right: the field showed profile.repositories.join(', '), so a trailing , became ['acme/web', ''] and was redrawn as acme/web, , which Backspace could not remove. The field now shows the text exactly as typed (per row, in local state). The array is still split from that text on each change, and withCleanRepositories still drops blanks on save. The typed text is cleared on save and Discard, and is re-indexed when a row is removed.

Squashed to stay within the 2-commit cap (.github/workflows/code-review.yml, MAX_COMMITS: "2"): the fix is folded into the Kiro Cloud commit. The same change as its own commit, on top of the reviewed 9c1ca77d33, is e6ec35806c (branch fix/se-git-opus-on-top); git diff 6aff74f5d1 e6ec35806c is empty. The source delta:

@@ export function SessionEnvironmentsCard() {
   const [openCloudRows, setOpenCloudRows] = useState<boolean[]>([])
+  // What the person typed in each Kiro Cloud row's repositories field. The field
+  // shows this, not the array rebuilt from it, so a separator they delete stays
+  // deleted; the array is still what saves (cleaned by withCleanRepositories).
+  const [repoText, setRepoText] = useState<(string | undefined)[]>([])
@@ onSuccess
       setDraft(null)
+      setRepoText([])
       setSaved(true)
@@ the repositories input
-                        value={field.key === 'repositories' ? profile.repositories.join(', ') : profile[field.key]}
-                        onChange={value => updateCloud(index, field.key === 'repositories'
-                          ? { repositories: value.split(',').map(r => r.trim()) }
-                          : { [field.key]: value })} />
+                        value={field.key === 'repositories'
+                          ? repoText[index] ?? profile.repositories.join(', ')
+                          : profile[field.key]}
+                        onChange={value => {
+                          if (field.key !== 'repositories') return updateCloud(index, { [field.key]: value })
+                          setRepoText(texts => { const next = [...texts]; next[index] = value; return next })
+                          updateCloud(index, { repositories: value.split(',').map(r => r.trim()) })
+                        }} />
@@ remove row
                       setOpenCloudRows(rows => rows.filter((_, i) => i !== index))
+                      setRepoText(texts => texts.filter((_, i) => i !== index))
@@ Discard
           setOpenCloudRows([])
+          setRepoText([])

Test: lets a separator typed in the repositories field be deleted again in website/src/test/SessionEnvironmentsCard.test.tsx types acme/web → acme/web, → acme/web and an emptied middle entry, asserting the field keeps each value and the save writes ['acme/web', 'acme/api']. It fails with the old field. All 56 card tests, tsc, eslint and i18n:check pass; no new UI strings.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Re: Opus 5.5 blocking finding on e4fb50a4b4 (core_config_schema.py:481 / core_config_patch.py:572, a session_environments.kiro_cloud_profiles leaf PATCH can leave default_profile dangling): fixed in bb9763be51 (squashed into the Kiro Cloud commit; the PR stays at two commits).

The finding was correct. After every session_environments write, _drop_dangling_default_profile() now re-checks the merged section under the config lock, after check_profile_ids_unique. It drops default_profile only when no profile list of any provider still holds that id (_profile_ids), so a Kiro Cloud leaf write never clears a default that names a Coder profile. "" (this machine) is kept. The explicit default_profile leaf write still refuses an unknown id through _check_default_profile_is_saved, unchanged.

Test: test_session_environments_config_api.py::test_a_cloud_list_leaf_drops_a_default_whose_profile_it_removes, [kc1] (the default's cloud profile is removed, so the default is dropped; fails with the fix reverted) and [dev] (the default names a Coder profile, so a cloud leaf write keeps it).

Notes: config.md now says four of the five keys are leaf paths and describes the drop. git_gateway.py's size is unchanged by this fix and stays as it is in this PR.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Re: GPT 6.1 blocking finding on bb9763be51 (core_config_patch.py:212, a hand-edited non-string profile id or default makes _profile_ids raise TypeError, so an unrelated session_environments write returns HTTP 500): fixed in 245c390190 (squashed into the Kiro Cloud commit; the PR stays at two commits, rebased onto feat/session-environments-health fee5f138c7).

The finding was correct, at both sites it names. The exact delta:

-    if default and default not in _profile_ids(section):
+    if default and (not isinstance(default, str) or default not in _profile_ids(section)):
         del section["default_profile"]

-def _profile_ids(section: dict) -> set[object]:
+def _profile_ids(section: dict) -> set[str]:
     return {
-        item.get("id")
+        item["id"]
         for entries in section.values()
         if isinstance(entries, list)
         for item in entries
-        if isinstance(item, dict)
+        if isinstance(item, dict) and isinstance(item.get("id"), str)
     }
  • _profile_ids counts only string ids, the only ones the loader keeps, so a list- or object-valued id from a hand edit is skipped instead of hashed. That also covers _check_default_profile_is_saved (line 116), which reads the same helper.
  • A saved default that is not a string (which the loader reads as "this machine") is dropped by _drop_dangling_default_profile instead of crashing the write.

Test: test_session_environments_config_api.py::TestApi::test_a_malformed_hand_edit_does_not_fail_an_unrelated_leaf_write, four cases (an ["dev"] id, an object id, a list default, an object default). Each PATCHes stop_on_shutdown, then the explicit default_profile leaf, and asserts 200 plus the saved result. All four return 500 with the fix reverted.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Re: Opus 5.5 blocking finding on 849bd60374 (acp_runtime_start.py:645, the git proxy's egress check never receives the owning app, because nothing in production sets provider.owning_app): fixed in df8c46c86e, as this PR's second commit.

The finding was correct. Splitting Kiro Cloud out of this PR had left the code that sets owning_app in the Kiro Cloud half, so on credentialed git alone an app-owned session's git traffic was judged on the agent profile only. Those hunks now live here:

  • session_allocation_parts/get_or_create.py: both provider-creation sites set owning_app = app_name, the caller's slot app (never transcript metadata), next to member_context / app_launch_agent.
  • providers/acp.py: AcpProvider initialises owning_app = ""; acp_runtime_start.py's field list names it.

Test: test/test_subagent_owning_app.py::test_session_allocation_hands_the_slot_app_to_the_provider ([boardroom] and []), which fails in both cases with the get_or_create.py hunks reverted. With test_provider_carries_agent_through_background_start_to_audited_channel (the provider's owning_app reaches the audited egress check) and test_the_subagent_session_carries_its_owning_app (a subagent passes its app to allocation), the chain from slot to egress check is covered.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Re: GPT 6.1 blocking finding on df8c46c86e (workspace_tools.py:201, a workspace HTTP proxy with no loopback exclusion carries the relay's git traffic): fixed in 77f1592791 (this PR's second commit, rewritten; still two commits).

The finding was correct, and so was the adjudication's point that the relay's bearer header would reach the proxy operator in the same request. git_proxy_env now adds an empty URL-scoped http.http://127.0.0.1:<port>/.proxy, next to the insteadOf rewrites and the extraHeader. Git treats an empty proxy value as "no proxy" for that URL, ahead of http_proxy / HTTPS_PROXY / all_proxy, so only the relay's URL is affected; every other host keeps the workspace's own proxy settings.

Test: test/test_remote_git_proxy.py::test_a_workspace_http_proxy_never_carries_the_relay_traffic runs a real git clone through the real guest proxy and gateway channel with every proxy variable pointed at a listening fake proxy and no NO_PROXY. The clone must succeed and the fake proxy must receive nothing. With the new pair removed, git hangs on the fake proxy and the test fails. test_commands_are_routed_through_the_proxy_only_when_it_runs pins the new pair's key.

@kyleseaman

Copy link
Copy Markdown
Contributor Author

Re: Opus 5.5 blocking finding on df8c46c86e (subagent_manager/run_turn.py:324, passing app_name gave an app-owned chat's subagent the app's model while the spawn path reports the non-app one): fixed in 77f1592791 (this PR's second commit, rewritten; still two commits).

The finding was correct. The subagent was only meant to carry the app's governance, and on main a subagent never took the app's model. The spawn now passes the app as owning_app, not app_name. get_or_create takes owning_app out of the factory kwargs (and hands it back on every retry, as it does app_name), sets it on the provider, and defaults it to app_name, so an app slot's own session is unchanged. resolve_model still reads only app_name, so the child's model is exactly what _spawn_effective_model resolves and the spawn receipt reports.

Tests in test/test_subagent_owning_app.py: test_the_subagent_session_carries_its_owning_app asserts the spawn passes owning_app and no app_name; the new test_an_owning_app_alone_governs_the_session_without_its_model asserts that owning_app reaches the provider, that no factory sees either kwarg, and that the model is resolved with no app. Both fail with the run_turn.py / get_or_create.py hunks reverted.

Git from a remote session workspace goes through a gateway-side proxy that
holds the credential, with an audited egress check under the session key, for
each host the gateway can lend a login for; every other host keeps the
workspace's own git login, and the strict sandbox lends none. Pushes follow
the local rule: one that updates or deletes a protected branch is refused
whole, using the git-publish check's own branch list, and every other push
goes through unprompted.
The git proxy's egress check reads provider.owning_app, which nothing set on the git half: session allocation now sets it from the caller's slot app (never transcript metadata) at both provider creation sites, and AcpProvider initialises it.
@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at 1cb9be4: this lends the gateway's git logins to remote workspaces over a new network route, so a human maintainer reviews it.

Both blockers from our r124 HOLD are gone: the base is now main, and Kiro Cloud moved to its own PR. The credential path looks careful where I checked it. The guest proxy binds loopback only. Only allowlisted headers pass, and redirects are not followed. Each request goes through the network.egress ceiling. I found no definite defect, but the last rounds fixed three real defects in this path, so a human should read it end to end. The description's "Sensitive change: none" covers only the watched-path script.

AI findings judged non-blocking:

  • Design: standard/cc lend logins they hide locally (recorded as the maintainer's choice; strict opts out), and guest git older than 2.31 silently goes direct (fail-safe; visibility only).
  • UX: a missing Windows unsupported screenshot and three copy notes, all behind KIROCREW_DEV_MODE.
  • CodeQL 1067/1150: URL substring checks in test/test_remote_git_proxy.py only.

I read the AI lanes, the replies and the security-critical code. I did not run tests.

— crew-pr-reviewer (r134)

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.

3 participants