Skip to content

refactor(acp): move AcpClient session start, turn loop and class home - #20744

Merged
bolichen97 merged 1 commit into
mainfrom
refactor/linecap-g03-client-p3
Oct 16, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
refactor/linecap-g03-client-p3

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Move the last third of AcpClient (the session start, the turn loop and the class statement itself) out of src/kiro_crew/acp/client.py, so the file drops below the 2,000-line cap with no change in behaviour.

acp/client.py is still 4,797 lines after PR 2 of this series (#20598), and the campaign rule (no hand-written file over 2,000 lines, #20192) needs it at or below its 1,200-line target. This is PR 3 of the 3-PR series and uses the same binding split as PR 1 (#20470) and PR 2.

Why it matters

A change to how a session starts or how a turn runs today edits a 4,797-line file that also carries the class definition and the compatibility facade, so unrelated work conflicts there. After this PR client.py is the facade only (1,184 lines), every AcpClient responsibility has one owner module named in the owning spec, and the file comes off the line-cap baseline.

Not a goal

  • No behaviour change: no fix, no hardening, no rename of any public or private name.
  • No change to AcpClient's surface or identity: every member stays an attribute of the one class, kiro_crew.acp.client.AcpClient is the same class object, and its __module__ stays kiro_crew.acp.client.
  • No change to kiro_crew._facade_mirror or to CI logic.

What changed (motivation → approach → change)

The class could not stay in client.py at the target size, and tests reach into its fields, members and sources everywhere, so the state cannot leave the instance. PR 1 and PR 2 moved two thirds of the members into owner modules bound by name; this PR moves the rest and then moves the class statement itself.

Owner Owns
client_start.py the session start: the spawn, the initialize handshake and its params, new, loaded, forked and substituted sessions, ensure_ready
client_turn.py the turn loop: sending the prompt, _prompt_loop, dispatching and processing frames, send_message, send_message_stream, stream_events
client_class.py the class statement: constructor, properties, class defaults, the member table and the members that stay class-resident

The class statement moves verbatim and sets __module__ = "kiro_crew.acp.client", so reprs, pickles and typing.get_type_hints still name the facade; client.py re-exports it. _resolve_spawn_env stays defined in client.py, where the spawn audit, the subprocess-encoding baseline and the cross-platform gate key it. An owner never imports the facade, so client_start declares the name and client.py fills it in right after the definition; a patch through kiro_crew.acp.client reaches the spawn through the mirror. _retire_liveness_state joins client_lifecycle.py. Docs (the acp-client.md owner table and class-home paragraph, RFC and spec citations), source-reading tests and registry rows that named acp/client.py as the home of moved code now name the owner, and client.py's line-cap baseline row is gone.

Move audit

Raw (move_audit.py): src/kiro_crew/acp/client.py: 4843 -> 1190 lines; moved 42.01% (python-ast) — the remaining "changed" units differ only by black's docstring re-indent after the dedent, the self: AcpClient annotation and a dropped @staticmethod.
Normalized (those three transforms undone, nothing else): 285 units, 282 moved unchanged (4,100 lines), 3 changed (31 lines) — _CLIENT_OWNERS, _is_kiro and _model_registry_namespace, listed below.

Justified edits (not verbatim):

  • class AcpClient in client_class.py: __module__ = "kiro_crew.acp.client" (with its one-line comment) after the docstring; the stage-3 binding blocks (two owner headers, 17 bindings, _retire_liveness_state in the lifecycle block); one annotation for type checkers only (_native_skill_projection, under TYPE_CHECKING, so the runtime class is unchanged).
  • client_start.py: the annotation-only _resolve_spawn_env declaration in place of a facade import (the facade fills it).
  • client.py: _client_start._resolve_spawn_env = _resolve_spawn_env after the def; _CLIENT_OWNERS + the three owners.
  • Comment wording (comment-history and brand gates on moved lines): three class-body comments and docstrings in the present tense (__init__, _model_registry_namespace, _is_kiro), one "Kiro Crew" spelling in _initialize_session.

Prose citations (L29), path only: comments and docstrings in src/kiro_crew/context.py, src/kiro_crew/providers/acp_runtime_start.py, src/kiro_crew/acp/runtime.py, src/kiro_crew/dashboard/handlers/usage.py (a stale client.py:1270 line citation becomes client_class.py, __init__), test/test_context.py, test/test_acp_runtime_load_session.py and test/test_session_pool.py, the comment in src/kiro_crew/agent_sdk/backends.py on the public Claude backend, and the location claims in rfc-agent-started-turns.md, rfc-leaked-runtime-reclaim.md, rfc-mcp-resource-subscriptions.md, harness-parity.md, metrics.md, agent-spec-fields.md, agent-host-contract.md (the _is_claude recognition, the _is_kiro activation gate, the protocol-version and session/load rows, the bare spawn and the adapter-held resume), sel.md, resource-protection.md (death detection and the init, prompt and read timeouts), kas-nondestructive-session-teardown.md, docs/reference/kiro-cli/steering.md and steering-viewer.md, now name the owner that defines the cited code.

Diff shape (L36): git diff --numstat equals git diff --minimal --numstat for every changed file.

Backwards compatibility

Compatible: every module path, public and private name, AcpClient member, signature, patch target, class identity, __module__ and pickle path that worked before still works, and typing.get_type_hints still resolves on every class-resident member (__init__ equal to BASE). Two introspection results change, as they did for the members PR 1 and PR 2 bound: typing.get_type_hints on a member bound from an owner raises NameError, because its self: AcpClient annotation names a type-checking-only import, and inspect.getsource(AcpClient) raises OSError, because the class statement now lives in a module other than its __module__. No caller in src/ or test/ uses either; member-level inspect.getsource follows each function's code object and keeps working.

Reader: src/kiro_crew/acp/client_start.py:_spawn -- chat -- the extra_hidden_dirs=plan.extra_hidden_dirs forward moved verbatim from client.py; no mask is added (test_acp_launch_goldens::test_the_launch_of_every_known_harness_matches_the_golden)

Logger names (L25): owners call logging.getLogger("kiro_crew.acp.client"), the same Logger object.

Tests

  • test/test_client_bindings.py: the inventory names client_class for class-resident members; new contract tests: the class keeps the facade as its module, qualname and pickle path, every class-resident member's type hints resolve (__init__ equal to BASE), a facade patch of AcpClient reaches the class-resident statics; the facade fills client_start._resolve_spawn_env (identity, a nested read in _spawn, a facade patch reaches _spawn.__globals__), and only client.py and client_class.py import client_start, with the package importing the facade first.
  • Source-reading tests whose construct moved now read its new home (path or row only; assertions unchanged; one mutation each fails the test): test_agent_admission_paths_ratchet (("acp/client_start.py", "_spawn"), 4 keys), test_worker_agent_load_bracket (+ client_start.py; client.py stays listed because the facade still re-exports the gate names the text scan looks for), test_worker_agent_spawn_gate, test_pid_reader_ratchet _KNOWN_SITE_FILES, test_agent_sdk_backend_identity (positive half → client_class.py), test_post_compaction_continuation (reads the joined acp/client*.py family), test_secc_poc_scratch_owner_symlink SPAWNERS, test_deny_bounded_write SITES (the "ACP event" needle → client_turn.py; empty rows for client_class/client_start), test_security_posture census (acp/client.py row removed, acp/client_start.py 2), test_core_path_redact_before_bound _SCANNED_MODULES (+ the three owners).
  • Rows: src/kiro_crew/security_posture.py NON_EGRESS_REDACTION_MODULES (− acp/client.py, + client_start, client_turn); .github/file-line-cap-baseline.txt: the client.py row deleted.
  • Mutation proofs: 20, each run only after the unmutated test passed. 19 make their test fail: the re-points above, the census and _SCANNED_MODULES rows (a planted log site, a planted slice in each new owner), and the new contract tests (drop __module__, an unresolvable annotation, a static reading a private alias, dropping the facade's fill-in of _resolve_spawn_env, which also fails test_acp_agent_env). The 20th, filling in a different callable, is refused by the facade mirror at import.
  • Floor run locally: 651 test files (every file that imports or patches the client or names kiro_crew.acp, the facade and mirror guards, the ratchets that scan acp/), pytest -n 3: 37,060 passed, 79 skipped, 5 xfailed, 0 failed; mypy src/kiro_crew clean; the flake-pattern ratchet green; a wheel built from a git archive export imports all 18 client modules, with AcpClient naming the facade and the filled-in resolver; semgrep (CI configs, --baseline-commit) clean. scripts/local-gate.py --dry-run selects 2,613 backend and 1,745 frontend files, over the campaign's ~600-file cap, so the floor above ran instead; CI runs the full matrix.
  • Re-gated after the move was rebuilt on main 40139dc: 53 touched test files (the ACP binding, facade and inventory tests, the re-pointed pins, and the opencode concurrent-steer tests), pytest -n 3: 4,870 passed, 0 failed; mypy and semgrep clean; the 20 mutation proofs re-run with the same results. At this head (main 7f7c38b, which changed only a doc row this PR also cites): the binding, facade-inventory, host-contract and concurrent-steer tests, 569 passed.

Manual verification

N/A — a pure move; behaviour is covered by the existing ACP suites, which pass unmodified apart from the listed path re-points.

Related Issues

Part of #20192

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

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners October 15, 2026 08:15
@bolichen97
bolichen97 requested a review from CrysisDeu October 15, 2026 08:15
@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head: 20a56c3

  • What rule changed: no rule changed. src/kiro_crew/security_posture.py NON_EGRESS_REDACTION_MODULES gains acp/client_start.py and acp/client_turn.py, the owner modules this PR creates that hold redactor calls moved verbatim out of acp/client.py, and drops the acp/client.py row, which no longer calls a redactor (the stale-row test requires it). src/kiro_crew/agent_sdk/backends.py changes one comment's path only (acp/client.py → acp/client_start.py).
  • Before -> after: before, those redactor calls were classified under acp/client.py; after, the same calls sit in their new files under the same non-egress classification.
  • Worst case if wrong: a moved redactor call site would be misfiled as non-egress, so the security posture panel would undercount an egress sink; the calls themselves and what they redact are unchanged.
  • No regression:
    • Evidence checked: test_security_posture.py (redactor registration both directions, the stale-row check, and the baseline log-site census counted with the test's own scanner: acp/client.py row removed, acp/client_start.py 2) passes; a planted extra baseline log site in client_start fails the census, and a planted slice inside a redact call in each new owner fails test_core_path_redact_before_bound.
    • Tools still work: no tool path changes behaviour; the 651-file ACP floor passes (37,060 passed, 0 failed).
    • Backward compatible: yes, registry rows only; no sink is added, removed or reclassified.
  • Existing tests: test_security_posture.py and test_core_path_redact_before_bound.py pass with only their path rows updated.
  • How to undo: revert this PR's single commit; the rows go back to the acp/client.py entry.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security_posture.py

  • @bolichen97 posted a complete reasoning template for de1bddf.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision de1bddfee8c259a038bf6b6aea5fe3dcb51ffe65 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 15, 2026
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of de1bddfee8c259a038bf6b6aea5fe3dcb51ffe65 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check that dropping acp/client.py from NON_EGRESS_REDACTION_MODULES matches where redaction calls now live. Most prose citations in src/ still point at acp/client.py.

[DESIGN-REVIEWED] de1bddf

Description read

[DESCRIPTION-READ] 9c41d960470e94d816ce547400ed38fb11f5c04e1a1dee3e48ca4682bc02f243

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of de1bddfee8c259a038bf6b6aea5fe3dcb51ffe65 — 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/CONCERNS are advisory.

First-Principles-Verdict: PASS

Check that nothing imports acp.client_start before the facade runs; until it does, _resolve_spawn_env is only declared, and the spawn path has nothing to call.

What this change ships

Inventory (8 items) — 8 justified

Intent: a maintainer wants acp/client.py back under the repo's 2,000-line cap with no behaviour change. This is an ADDITION (a refactor).

  1. Session start (spawn, initialize, new, load, fork, ensure_ready) now lives in client_start.py — justified
  2. The turn loop (send_message, _prompt_loop, frame dispatch, streaming) now lives in client_turn.py — justified
  3. The AcpClient class statement moves to client_class.py, with __module__ pinned to the facade — justified
  4. _retire_liveness_state now lives in client_lifecycle.py — justified
  5. The facade fills client_start._resolve_spawn_env after its definition — justified
  6. client.py is removed from the line-cap baseline — justified
  7. The redaction-module registry and the log-site and source-reading tests are re-pointed to the owners — justified
  8. Docs, RFC and spec location citations now name the owner modules — justified

[FIRST-PRINCIPLES-REVIEWED] de1bddf

Description read

[DESCRIPTION-READ] cf7353528ccb54e82cac4a3e9b01e05ea3c6a29dba7611096623e56694a40978

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] de1bddf

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable de1bddfee8c259a038bf6b6aea5fe3dcb51ffe65: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] de1bddf

False positive or not applicable? A repository writer can comment:
/ai-review override gpt de1bddfee8c259a038bf6b6aea5fe3dcb51ffe65: <one-sentence reason>

@bolichen97
bolichen97 enabled auto-merge (squash) October 15, 2026 08:35
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Nothing can import client_start before the facade fills it

confirmed: kiro_crew/acp/__init__.py begins with from kiro_crew.acp.client import (...), so importing any kiro_crew.acp.* submodule, client_start included, first runs the facade to completion, and the fill-in executes at that import, before any caller can hold the module or start a spawn.
A cold import kiro_crew.acp.client_start in a fresh process shows the facade loaded and client_start._resolve_spawn_env is client._resolve_spawn_env.
test_client_bindings::test_only_the_facade_and_the_class_import_the_session_start pins that only acp/client.py and acp/client_class.py import client_start and that the package imports the facade first; dropping the fill-in fails the binding tests and test_acp_agent_env, and filling in a different callable is refused by the mirror at import.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • client.py makes no redaction call; its redact names are re-exports

confirmed: an AST walk of acp/client.py at this head finds 0 calls to any redact* function; redact_credentials, redact_exfiltration_urls, redact_log_via_context and redact_text appear only in its # noqa: F401 imports, which keep BASE names bound for importers and patch targets.
test_security_posture::test_allowlist_has_no_stale_entries failed with acp/client.py still listed (no redactor call left), which is why the row goes; test_every_redactor_call_site_is_a_registered_sink_or_allowlisted would fail if client.py made a call while unlisted, and it passes.
The moved call sites are classified under client_start and client_turn, and the census counts them there (acp/client_start.py: 2).

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 15, 2026
chenmingwei23
chenmingwei23 previously approved these changes Oct 15, 2026

@chenmingwei23 chenmingwei23 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving: readiness gate passed, no conflicts, checks green.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by a maintainer after reading the review lanes: every lane is clean on this head, and the automated triage held it only on a size, path, category or doc rule.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 15, 2026
@bolichen97
bolichen97 force-pushed the refactor/linecap-g03-client-p3 branch from 20a56c3 to 66c9390 Compare October 15, 2026 18:38
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main 0694e63, conflicts in src/kiro_crew/providers/acp.py (main's #20838 moved that code to providers/acp_runtime_start.py; this PR's two client.py -> client_start.py comment edits now land there), test/test_client_bindings.py (this PR's client_class homes, main's new approve_tool digest from #20743), docs/system-specs/modules/harness-parity.md and metrics.md (word-level merge of both sides) resolved mechanically, tests the 277 test files this PR, #20743 and #20838 touch or that name the moved ACP client modules (17,845 passed; the 17 test_acp_spawn_offload.py::TestRuntimeProjectedLaunchDocuments failures fail the same on clean main 0694e63) pass.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 15, 2026
@bolichen97
bolichen97 force-pushed the refactor/linecap-g03-client-p3 branch from 66c9390 to 1718e81 Compare October 15, 2026 21:31
@bolichen97

Copy link
Copy Markdown
Contributor Author

Refreshed onto main c6d6106; this head supersedes 66c9390 (same tree, rebuilt by the split recipe and re-gated).

Upstream changes carried:

The campaign facade inventory (test/campaign_facade_inventories/kiro_crew.acp.client.json) needs no change: this PR adds owner modules, not a facade, and every BASE public name still resolves.

Local gate at this head: 51 touched test files, 4,810 passed, 0 failed; line cap, docs lint and the diff-scoped gates green.

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

bolichen97 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author
  • client_start._resolve_spawn_env is filled by the facade before any spawn

rebutted: kiro_crew/acp/__init__.py line 3 is from kiro_crew.acp.client import (...), so importing any kiro_crew.acp.* submodule, client_start included, runs the facade first and its fill-in (client.py:598) executes before any caller can hold the module or start a spawn.
Checked at this head: a cold import kiro_crew.acp.client_start gives client_start._resolve_spawn_env is client._resolve_spawn_env True; outside acp/client.py and acp/client_class.py no module imports client_start (other hits are comments).
test_client_bindings::test_only_the_facade_and_the_class_import_the_session_start pins this and passes at this head.

@bolichen97

bolichen97 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Nothing imports client_start before the facade does

rebutted: kiro_crew/acp/__init__.py line 3 is from kiro_crew.acp.client import (...), so importing any kiro_crew.acp.* submodule, client_start included, runs the facade first and its fill-in (client.py:598) executes before any caller can hold the module or start a spawn.
Checked at this head: a cold import kiro_crew.acp.client_start gives client_start._resolve_spawn_env is client._resolve_spawn_env True; outside acp/client.py and acp/client_class.py no module imports client_start (other hits are comments).
test_client_bindings::test_only_the_facade_and_the_class_import_the_session_start pins this and passes at this head.

@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
@bolichen97
bolichen97 force-pushed the refactor/linecap-g03-client-p3 branch from 5c5d43b to d3b3e3c Compare October 16, 2026 07:35
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main was red on test/test_chat_fork_error_codes.py::test_the_ratchet_can_actually_fail (27 vs 26 coded sites; red on clean 0a008292c too, fixed on main by #21075). Rebased onto 74a249d (5c5d43b -> d3b3e3c), no conflicts, no diff change; CI re-running.

@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 16, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • A patch of client._resolve_spawn_env still reaches client_start._spawn

rebutted: kiro_crew.acp.client is a _facade_mirror.MirroredModule (client.py sets its __class__), and _facade_mirror sends a write or delete of a served name to the owner module, so monkeypatch.setattr(client_mod, "_resolve_spawn_env", f) rebinds client_start._resolve_spawn_env too.
Checked at this head: test_acp_agent_env (patches it at line 549 and asserts the env the spawn built), test_acp_opencode_backend (line 867) and test_acp_launch_goldens pass; test_acp_refactor_facade pins _resolve_spawn_env as a facade read-back.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • client_start._resolve_spawn_env is filled before anything spawns

rebutted: kiro_crew/acp/__init__.py line 3 imports kiro_crew.acp.client first, so importing any kiro_crew.acp.* submodule runs the facade and its fill-in (client.py, _client_start._resolve_spawn_env = _resolve_spawn_env) before a caller can hold client_start.
Checked at this head: a cold import kiro_crew.acp.client_start gives client_start._resolve_spawn_env is client._resolve_spawn_env True; only acp/client.py and acp/client_class.py import client_start, pinned by test_client_bindings::test_only_the_facade_and_the_class_import_the_session_start.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head: d3b3e3c

  • What rule changed: no rule changed. src/kiro_crew/security_posture.py NON_EGRESS_REDACTION_MODULES gains acp/client_start.py and acp/client_turn.py, the owner modules this PR creates that hold redactor calls moved verbatim out of acp/client.py, and drops the acp/client.py row, which no longer calls a redactor (the stale-row test requires it). src/kiro_crew/agent_sdk/backends.py changes one comment's path only (acp/client.py → acp/client_start.py).
  • Before -> after: before, those redactor calls were classified under acp/client.py; after, the same calls sit in their new files under the same non-egress classification.
  • Worst case if wrong: a moved redactor call site would be misfiled as non-egress, so the security posture panel would undercount an egress sink; the calls themselves and what they redact are unchanged.
  • No regression:
    • Evidence checked: test_security_posture.py (redactor registration both directions, the stale-row check, and the baseline log-site census counted with the test's own scanner: acp/client.py row removed, acp/client_start.py 2) passes; a planted extra baseline log site in client_start fails the census, and a planted slice inside a redact call in each new owner fails test_core_path_redact_before_bound.
    • Tools still work: no tool path changes behaviour; the touched ACP tests pass (53 files, 4,870 passed, 0 failed, on the same content).
    • Backward compatible: yes, registry rows only; no sink is added, removed or reclassified.
  • Existing tests: test_security_posture.py and test_core_path_redact_before_bound.py pass with only their path rows updated.
  • How to undo: revert this PR's single commit; the rows go back to the acp/client.py entry.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Head d3b3e3c is kept as this PR's head. Two hand rebases outside the campaign moved the branch overnight (1718e81 -> 5c5d43b -> d3b3e3c). Its content matches the reviewed re-cut of this PR on main 7f7c38b: a range-diff shows the same 39 paths and identical hunks, apart from upstream context (main's newer resource-protection.md cron row). Keeping it avoids another CI round.

Upstream changes carried at this head:

client.py is 1,190 lines at this head (the commit message's "1,184" predates the #19747 port; the PR body's move audit has the current count).

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 16, 2026
Move the last third of AcpClient's members (the session start and the
turn loop) into client_start and client_turn by binding, as in the two
earlier parts of this series, and move the class statement itself
verbatim to client_class. The class keeps kiro_crew.acp.client as its
__module__, and client.py re-exports it, so the import path, pickles,
reprs and type hints are unchanged. _resolve_spawn_env stays defined in
client.py, which fills the session start's global right after defining
it. client.py is the facade only, at 1,184 lines, and leaves the
line-cap baseline.

Part of #20192
@bolichen97
bolichen97 force-pushed the refactor/linecap-g03-client-p3 branch from d3b3e3c to de1bddf Compare October 16, 2026 08:23
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: conflicts with main again (d3b3e3c -> de1bddf, base 02928b1). Doc rows only: resource-protection.md keeps main's taskrunner_parts/run_steps.py rows with this PR's ACP owner paths; harness-parity.md H6/H7 keep main's text with acp/client_class.py for supports_steer. No code change. Local: docs-lint, line cap, isort, flake8, mypy, 1958 related tests green.

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 16, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head: de1bddf

  • What rule changed: no rule changed. src/kiro_crew/security_posture.py NON_EGRESS_REDACTION_MODULES gains acp/client_start.py and acp/client_turn.py, the owner modules this PR creates that hold redactor calls moved verbatim out of acp/client.py, and drops the acp/client.py row, which no longer calls a redactor (the stale-row test requires it). src/kiro_crew/agent_sdk/backends.py changes one comment's path only (acp/client.py → acp/client_start.py).
  • Before -> after: before, those redactor calls were classified under acp/client.py; after, the same calls sit in their new files under the same non-egress classification.
  • Worst case if wrong: a moved redactor call site would be misfiled as non-egress, so the security posture panel would undercount an egress sink; the calls themselves and what they redact are unchanged.
  • No regression:
    • Evidence checked: test_security_posture.py (redactor registration both directions, the stale-row check, and the baseline log-site census counted with the test's own scanner: acp/client.py row removed, acp/client_start.py 2) passes; a planted extra baseline log site in client_start fails the census, and a planted slice inside a redact call in each new owner fails test_core_path_redact_before_bound.
    • Tools still work: no tool path changes behaviour; the touched ACP tests pass (53 files, 4,870 passed, 0 failed, on the same content).
    • Backward compatible: yes, registry rows only; no sink is added, removed or reclassified.
  • Existing tests: test_security_posture.py and test_core_path_redact_before_bound.py pass with only their path rows updated.
  • How to undo: revert this PR's single commit; the rows go back to the acp/client.py entry.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • NON_EGRESS_REDACTION_MODULES matches where the redaction calls live

rebutted: an AST walk at this head finds 0 redact* calls in acp/client.py (its redact names are re-exports), 6 in acp/client_start.py and 4 in acp/client_turn.py; both are in NON_EGRESS_REDACTION_MODULES (security_posture.py lines 2124 and 2127), and test_security_posture passes at this head.
The remaining acp/client.py prose citations name the facade, which still binds and re-exports every moved name, so they stay true; re-pointing each one is out of this move's goal.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Nothing imports client_start before the facade runs

rebutted: kiro_crew/acp/__init__.py line 3 imports kiro_crew.acp.client first, so importing any kiro_crew.acp.* submodule runs the facade and its fill-in (_client_start._resolve_spawn_env = _resolve_spawn_env) before a caller can hold client_start.
Checked at this head: a cold import kiro_crew.acp.client_start gives client_start._resolve_spawn_env is client._resolve_spawn_env True; only acp/client.py and acp/client_class.py import client_start, pinned by test_client_bindings::test_only_the_facade_and_the_class_import_the_session_start.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 16, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at de1bddf. This needs a human reviewer, because the change touches security-registry and sandbox spawn code.

  • security_posture.py#L2124 re-points the NON_EGRESS_REDACTION_MODULES rows, and Sensitive Change Review flags it.
  • The ACP spawn path (_spawn, _resolve_spawn_env, the sandbox hidden-dirs forward) and _retire_liveness_state move into new owner modules.

I found no defect. An AST comparison of every function in the old acp/client.py against the new owners shows nothing missing or changed. The Design and First Principles items on this head have dispositions that match the code, the GPT and Opus lanes are clean, and every check is green. A maintainer's review of the two areas above would clear this hold.

— crew-pr-reviewer (r107)

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved by a maintainer. The triage automation held this on a size, path or move-check rule only; every review lane is clean. Any lane note is accepted as follow-up work.

@bolichen97
bolichen97 merged commit 0c553ac into main Oct 16, 2026
102 of 103 checks passed
@bolichen97
bolichen97 deleted the refactor/linecap-g03-client-p3 branch October 16, 2026 18:09
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 16, 2026
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.

4 participants