Skip to content

refactor(acp): move the rest of AcpRuntime into owner modules - #22358

Merged
iamwhatever merged 1 commit into
mainfrom
refactor/linecap-g05-runtime-p2
Oct 21, 2026
Merged

iamwhatever merged 1 commit into
mainfrom
refactor/linecap-g05-runtime-p2

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Bring src/kiro_crew/acp/runtime.py under the 2,000-line cap with no behaviour change: the second of two PRs, moving the rest of AcpRuntime's behaviour and the class statement into owner modules the class binds by name.

After #22085, acp/runtime.py is still 5,195 lines, almost all of it the AcpRuntime class: the session registry, mode activation, the stdin wire, liveness and death attribution, the host requests, frame accounting and the stdout reader. It still has a row in .github/file-line-cap-baseline.txt, and it still changes every few days.

Why it matters

The 2,000-line cap is the repository's rule (AGENTS.md, scripts/check_file_line_cap.py). Until the rest of the class moves, every runtime change still lands in a 5,000-line file that holds seven unrelated responsibilities, and the file keeps its line-cap baseline row.

Not a goal

What changed (motivation → approach → change)

runtime.py stays over the cap because the class holds the rest of the runtime. This PR finishes the split #22085 started, the same way (binding, KC28 L33): each remaining member's body becomes a module-level function in an owner module, with self as its first parameter, and the class binds it by name. The class statement itself, with its constructor, properties, constants and binding block, moves verbatim to acp/runtime_class.py, and acp/runtime.py re-exports it. The class keeps kiro_crew.acp.runtime as its __module__, so reprs, error text and every import path read as before. A patch through kiro_crew.acp.runtime still reaches every owner that reads the name (kiro_crew._facade_mirror).

Owner Owns
acp/runtime_session_registry.py the sessions held and how each one leaves: init-frame staging, start-stall MCP diagnostics, turn-active marks, terminate and unregister
acp/runtime_mode_activation.py putting a started session on its agent: the bracketed session/set_mode, skill-view aliases, the projection generation, the spawn-agent checks
acp/runtime_wire.py JSON-RPC over the child's stdin: requests, notifications, responses, the write lock and no-progress bound, _send_and_await
acp/runtime_liveness.py alive, busy, dead or due to recycle: the exit watch, the stderr drain, death attribution, reap tracking, staleness
acp/runtime_host_requests.py requests no session turn answers: unroutable permission requests, the host credential callback, MCP sign-in and re-attempt, the engine's MCP secret store (_kiro/secret/*)
acp/runtime_frame_accounting.py what the reader drops, counted: the subagent roster overflow and the unroutable-frame summaries
acp/runtime_reader_loop.py the single stdout reader: routing by id and sessionId, notification aliases, oversize-frame recovery
acp/runtime_class.py the class statement: constructor, properties, class constants, field declarations, the binding block and _own_methods

runtime.py drops from 5,255 to 595 lines, so its line-cap baseline row goes. Tests and registries that name where moved code lives now name its owner, and the owning spec (acp-client.md) lists every owner.

Backwards compatibility

Compatible: every name kiro_crew.acp.runtime bound before stays bound to the same object (test_every_base_import_stays_bound_on_the_facade and test/campaign_facade_inventories/kiro_crew.acp.runtime.json pin it); AcpRuntime is the same class object with the same __module__, members, kinds, coroutine-ness and signatures (the member inventory pins it); a write through the facade reaches every owner that reads the name.

Removes nothing: no public module-level function leaves a product file (the take-away check finds no shape), and every moved member stays bound on the class under its own name.

Tests

  • test/test_runtime_bindings.py covers all 13 owners and the class home: every member bound from its owner with the BASE __qualname__, no owner keeps an unbound self function, the member inventory, owner layering, owner docstrings, logger names, moved exceptions keeping the facade __module__ (AcpRuntimeStdinStalled joins the list), patch reach through the mirror, the import check, and and the class-home pins: the class keeps the facade as its __module__ and pickle lookup path (module + qualname resolves to the class home's object), typing.get_type_hints(AcpRuntime) == {} and every member's hints resolve (the fields a moved member assigns first are declared under if TYPE_CHECKING:), the constructor keeps its main type hints, and a facade patch reaches the class-resident constructor. Each has a mutation that turns it red.
  • Source pins re-pointed or joined (L30 / L40(8)), every assertion unchanged; each has a mutation that breaks the construct in its new home and turns the pin red (43 distinct mutations, all red: pytest exits 1 under each).
  • Determinism: test/test_runtime_bindings.py (387 tests) passed 5 runs at -n0 and one at -n 3; it sleeps on nothing and orders nothing it did not define.

Manual verification

N/A — a pure move: the existing runtime suite drives every moved body, and the binding guards pin the contract.

Move audit

  • src/kiro_crew/acp/runtime.py: 5255 -> 595 lines; moved 23.64% (python-ast) (move_audit.py, raw: it counts every moved member as changed because its first parameter gains the type-checker self: AcpRuntime annotation and black re-indents its docstring).
  • Normalized comparator (docstrings through inspect.cleandoc, the self annotation and a dropped @staticmethod undone): 219 units, 216 moved unchanged, 3 changed, all glue: _MEMBER_OWNERS and _RUNTIME_OWNERS gain the new owners (the class home last), and the class's if TYPE_CHECKING: field block gains four declarations.
  • Non-move edits (comments and glue, AST-identical where they touch moved text):
    • in the class: the __module__ = "kiro_crew.acp.runtime" line with its comment after the docstring; four more declarations, in the class's if TYPE_CHECKING: block, of fields a moved member assigns first (_skill_projection_issued, _skill_projection_lock_obj, _skill_projection_unadopted, _stdin_lock);
    • eight section-header comments whose code all left the file deleted (# ── AcpRuntime ──, Awaited-request error formatting, Unroutable-frame drop accounting, Reader Task, Protocol Interface, Skill-view projection, Session Management, Internal Helpers);
    • two moved comments reworded in present tense for the comment-history gate: __init__'s "a buffer that has dropped the evidence", _answer_unroutable_permission's "the redaction patterns cannot match it";
    • the facade imports AcpRuntime from acp/runtime_class.py; a stray comment about re-exports stays in the facade above the acp.client re-export it sat next to;
    • isort writes main's from kiro_crew.acp import kas_secret_storage, runtime_process_tree as two lines, because the new owner aliases (runtime_frame_accounting as _rt_frames, ...) sort between the two names; both stay bound on the facade.

Diff layout (L36)

Every changed file adds the same lines under git's default diff and --minimal (runtime.py: +75/-4735 both). Total diff 621,650 bytes.

CI path references

None: no workflow path filter or explicit file list names runtime.py or acp/**.

Logger names

Owners log under logging.getLogger("kiro_crew.acp.runtime"), the literal name, as in #22085; the facade keeps logging.getLogger(__name__), the same logger object.

Known limits

  • As in refactor(acp): bind AcpRuntime spawn, kill and session-start owners #22085: a closure defined inside a bound member keeps the owner's qualname (_reader_loop.<locals>...), a moved function's __code__.co_qualname is its owner-level name, and a log record carries the owner in module, filename and pathname; record.name stays kiro_crew.acp.runtime. Nothing in the tree reads these.
  • inspect.getsource(AcpRuntime) raises OSError on Python 3.12: it looks the class up through its __module__, the facade, which no longer holds the class statement. Read a member's source, or acp/runtime_class.py; the two whole-class source pins were re-pointed in refactor(acp): bind AcpRuntime spawn, kill and session-start owners #22085, and the owning spec says the same.
  • Pickling an unbound moved member (pickle.dumps(AcpRuntime.is_alive)) fails: pickle looks a function up by __module__ and __qualname__, which name the owner module and the class. pickle.dumps(AcpRuntime.spawn) already failed the same way on main, and nothing pickles a member.

Upstream changes carried into the owners (L16)

#22625 (c90720cb6c) and #22592 (eac5cf92ab) edited runtime.py code this PR moves; the split recipe re-runs on main and takes every body from it, so each piece lands in its owner unchanged apart from the dedent:

change in runtime.py home here
#22625: from kiro_crew.acp import kas_secret_storage, ... kept on the facade; runtime_class.py, runtime_host_requests.py and runtime_reader_loop.py import it for the code that reads it
#22625: _MCP_SECRET_REFUSED = -32000 runtime_host_requests.py, beside _MCP_URL_NOT_OPENED; the facade re-exports it
#22625: self._mcp_secret_server = None in __init__ runtime_class.py (AcpRuntime.__init__)
#22625: _reader_loop: secret frames are never recorded; the _kiro/secret/* answer branch runtime_reader_loop.py (_reader_loop), in main's branch order
#22625: new member _answer_secret_request runtime_host_requests.py, bound by name like the other members; the guard's member inventory gains its row
#22592: five URL-then-credential pass pairs become one redact(...) call (_sanitize_progress_name, redacted_stderr_tail, two death and debug tails, a failed MCP server's error) runtime_session_registry.py, runtime_liveness.py, runtime_reader_loop.py; the two owners that no longer call the raw passes drop that import, and the facade keeps both names

The host-requests owner's docstring and its acp-client.md row name the secret store. Every non-blank line #22625 and #22592 added to the runtime family is present at this head (dedent aside).

Edits outside the claim (granted)

  • src/kiro_crew/security_posture.py NON_EGRESS_REDACTION_MODULES (L55: the rows follow the redactor calls): acp/runtime.py becomes acp/runtime_frame_accounting.py, acp/runtime_host_requests.py (keeping its comment), acp/runtime_liveness.py, acp/runtime_session_registry.py, the four owners that now hold runtime.py's redactor calls. No _REDACTION_SINKS row named runtime.py. Mutation: removing the redactor call from runtime_frame_accounting.py turns test_allowlist_has_no_stale_entries red.
  • .github/file-line-cap-baseline.txt: the acp/runtime.py row deleted by hand (L45).
  • test/campaign_facade_inventories/kiro_crew.acp.runtime.json (this facade's own inventory from refactor(acp): bind AcpRuntime spawn, kill and session-start owners #22085): AcpRuntime and AcpRuntimeStdinStalled join its rebound map with their new homes.

Baselined growth (L56 addendum 1b)

  • src/kiro_crew/security_posture.py: main row 3181, the file goes 3,511 -> 3,514 lines (three exact-path rows the redactor drift guard requires, no added comment).

Source pins re-pointed (L30 / L40(8)); every assertion unchanged

test_acp_frame_record.py (the reader-loop record pin reads the runtime family, as the client's already did), test_worker_agent_load_bracket.py (the handshake-driving spawner list: runtime_spawn_launch.py alone for the runtime), test_pid_reader_ratchet.py (_KNOWN_SITE_FILES: the seven owners that hold runtime.py's pid-reader sites; totals unchanged), test_agent_admission_paths_ratchet.py (_activate_mode_bracketed keyed by its owner), test_deny_bounded_write.py (SITES: each log-site needle under the owner that holds it, the facade row kept empty), test_harness_parity.py (_RUNTIME_PATH_MODULES + the eight new modules). Each has a mutation that breaks the construct in its new home and turns the pin red.

Citations edited (L29, SD27)

  • docs/system-specs/modules/acp-client.md:75: "AcpRuntime stays in its module; AcpSessionHandle's class home is below" -> "The class homes of AcpRuntime and AcpSessionHandle are below"
  • docs/system-specs/modules/acp-client.md:158: "_MirroredSessionMcp keeps its owner's, which nothing reads." -> "_MirroredSessionMcp and _PendingRequests keep their owner's, which nothing reads.", plus where the class statement is and why inspect.getsource(AcpRuntime) does not find it
  • docs/system-specs/modules/acp-client.md:171: where new AcpRuntime behaviour goes joins this paragraph, from the sentence after the owner table that placed the rest in acp/runtime.py (removed); :182-189: the eight new owner rows
  • docs/architecture/resource-protection.md:591: acp/runtime.py -> acp/runtime_spawn_launch.py
  • docs/guides/remote-and-mobile.md:31: acp/runtime.py -> acp/runtime_liveness.py
  • docs/request-for-change/rfc-overload-resilience.md:87 (E9): acp/runtime.py _session_start_stalled L3034 -> acp/runtime_session_registry.py _session_start_stalled
  • docs/system-specs/common/error-handling.md:290: acp/runtime.py -> acp/runtime_liveness.py
  • docs/system-specs/modules/agent-host-contract.md:100: acp/runtime.py -> acp/runtime_mode_activation.py
  • docs/system-specs/modules/harness-parity.md:258: acp/runtime.py -> acp/runtime_reader_loop.py
  • docs/system-specs/modules/metrics.md:383: acp/runtime.py::_audit_denied_off_loop -> acp/runtime_host_requests.py::...; :384 acp/runtime.py -> acp/runtime_reader_loop.py; :385 acp/runtime.py::_note_dropped_frame -> acp/runtime_frame_accounting.py::...; :386 acp/runtime.py::_activate_mode_bracketed -> acp/runtime_mode_activation.py::...
  • src/kiro_crew/acp/client_spawn_env.py:836: acp.runtime._own_stub_session -> AcpRuntime._own_stub_session
  • src/kiro_crew/agent_sdk/backends_mcp.py:290: acp/runtime.py -> acp/runtime_class.py
  • src/kiro_crew/dashboard/handlers/usage.py:126: runtime.py:273 -> AcpRuntime._agent; :127: runtime.py:280 -> AcpRuntime._model
  • src/kiro_crew/kiro_prerequisite_agent_specs.py:195: acp/runtime.py -> acp/runtime_reader_loop.py
  • src/kiro_crew/metrics/events.py:78: acp/runtime.py::_activate_mode_bracketed -> acp/runtime_mode_activation.py::...
  • src/kiro_crew/session_pid_tracking.py:784: acp/runtime.py -> acp/runtime_liveness.py
  • test/test_usage.py:1580: runtime.py:273 -> AcpRuntime._agent
  • Not edited: apps/builtins/aws_control cites of acp/runtime.py:1321 (and runtime.py:1251), which point at code that moved to acp/launch.py long before this split; code-style.md's exception cite, still true.

References not edited (cost)

Gates run locally

  • Floor: 313 test files (every file that imports, patches or names kiro_crew.acp.runtime / AcpRuntime, the tree-scan fences, the mirror and facade guards), -n 3: 18,152 passed, 48 skipped, 0 failed.
  • Per-owner line coverage on that floor: session_registry 93.8%, mode_activation 98.3%, wire 85.5%, liveness 91.8%, host_requests 85.2%, frame_accounting 93.8%, reader_loop 96.0%, class 98.0%; runtime.py 99.2%.
  • Cold mypy src/kiro_crew (fresh cache): no issues in 3,449 files. black / isort / flake8 on every changed file, comment-history, brand, harness parity, cross-platform scan, model-id rule, line cap (0 failures), subprocess-encoding, black gate, woke, take-away, docs_lint, flake-pattern ratchet, campaign inventory check: all pass. semgrep 1.78 with the CI configs and --baseline-commit: 0 findings, no parse error.

Related Issues

Part of #20192
Follow-up: #21320
Follow-up: #22257 (the shared _own_methods helper)

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

Contributions are accepted under the project's Apache-2.0 license.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 77c9706
  • What rule changed: no rule changed; NON_EGRESS_REDACTION_MODULES in security_posture.py re-keys its acp/runtime.py row to the four owner modules that now hold runtime.py's redactor calls (acp/runtime_frame_accounting.py, acp/runtime_host_requests.py, acp/runtime_liveness.py, acp/runtime_session_registry.py), because this PR moves that code there verbatim.
  • Before -> after (what was allowed/blocked, now): before, the posture census classified runtime.py's redactor calls as non-egress through one row; after, the same calls, unchanged, are classified through four rows naming the modules that hold them. No sink row changes, and nothing is allowed or blocked differently.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a moved redactor call would sit in an unregistered module and the posture drift guard would fail CI; no runtime behaviour depends on this registry, so nothing leaks or breaks at run time.
  • Evidence checked (which sandbox result proves it): test_security_posture.py passes on this head (every redactor call site is a registered sink or allowlisted, no stale allowlist entry); removing the redactor call from runtime_frame_accounting.py turns test_allowlist_has_no_stale_entries red (mutation P2-C3).
  • No regression:
    • Tools still work (which tools/commands were run, result): the 306-file floor of every test that imports, patches or names the runtime passed on this tree (18,099 passed, 0 failed), and cold mypy is clean.
    • Backward compatible (old config / old data / old callers still work, how checked): the registry is read only by the posture panel and its tests; no config or data format changes, and every moved function is byte-identical apart from the dedent.
    • Existing tests (which suites passed on this head): test_security_posture.py, test_runtime_bindings.py, the 306-file runtime floor, and CI on this head.
  • How to undo: revert this commit; the registry row returns to acp/runtime.py together with the code.

@github-actions

github-actions Bot commented Oct 20, 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 995577b.

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 995577b2cf66fbd13208b70d8e1cd65e843382fb touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

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

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: this is the second half of a split that #22085 started, it moves code without changing behaviour, and the class keeps its facade __module__, import path and patch reach.

Notes

  • The security_posture.py redaction-site registry swaps its acp/runtime.py row for four owner files. Check that every owner calling redact_text is in that list, so a scrub that moved isn't left out.

[DESIGN-REVIEWED] 995577b

Description read

[DESCRIPTION-READ] 070eaef99a4bd52ba9def10f88c1c55f3168633624da16b84a6bb1f176ac954d

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 995577b2cf66fbd13208b70d8e1cd65e843382fb — 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. This is a mandated pure move: AGENTS.md's 2,000-line cap requires splitting acp/runtime.py. Every new surface is a re-export or registry row that the move itself requires.

What this change ships

Inventory (7 items) — 7 justified

Intent: bring acp/runtime.py under the repository's file-line cap without changing behaviour. This is a refactor, neither a FIX nor an ADDITION.

  1. The rest of AcpRuntime's behaviour moves into seven new owner modules, and the class binds each one by name — justified
  2. The class statement moves to acp/runtime_class.py, keeps kiro_crew.acp.runtime as its __module__, and the facade re-exports it — justified
  3. The facade re-exports every private constant and helper that moved, so existing imports and patch paths still work — justified
  4. The runtime.py row is removed from the line-cap baseline — justified
  5. NON_EGRESS_REDACTION_MODULES swaps runtime.py for the four owners where the redacting code now lives — justified
  6. Path citations in docs, specs and docstrings point to the new owners — justified
  7. Binding guards, source pins and the facade inventory are re-pointed to the new owners — justified

[FIRST-PRINCIPLES-REVIEWED] 995577b

Description read

[DESCRIPTION-READ] c19d2e28d1e8bef0aef2f996c1b654fc2d709217138f9d7cbe0527251e988f17

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.

@bolichen97
bolichen97 enabled auto-merge (squash) October 20, 2026 02:05
@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 20, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 77c9706: GPT 6.1 finished its review of this head with no blocking findings ("No findings", [GPT-REVIEWED] 77c9706 in the withheld-verdict artifact of run 39355915509); only the "Post/update review comment" step failed, on the installation API rate limit.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@bolichen97 marked the gpt AI finding as false positive, not applicable, or explicitly accepted for 77c97062e88ee2b01555d93a50b4efdd39f40ca4.

GPT 6.1 finished its review of this head with no blocking findings ("No findings", [GPT-REVIEWED] 77c9706 in the withheld-verdict artifact of run 39355915509); only the "Post/update review comment" step failed, on the installation API rate limit.

This decision applies only to this commit. A new push requires a new judgment.

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 995577b

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

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

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 995577b

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

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Design punchline: runtime_reader_loop.py left out of NON_EGRESS_REDACTION_MODULES

verified (deliberate): the registry lists modules that CALL a redactor, and runtime_reader_loop.py calls none: grepping every acp/runtime*.py file with the drift guard's own _REDACTOR_CALL_RE finds calls only in runtime_frame_accounting.py (1), runtime_host_requests.py (2), runtime_liveness.py (7) and runtime_session_registry.py (4), and 0 in runtime_reader_loop.py, runtime_wire.py, runtime_mode_activation.py, runtime_class.py and the facade.
Listing a module with no redactor call fails test_security_posture.py::test_allowlist_has_no_stale_entries, and omitting one that has a call fails the inverse guard that walks every call site, so the four rows are exactly the moved calls (L55: the rows follow the redactor calls). Both guards pass at this head.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • First Principles punchline: the registry names four of the seven new owners

verified (complete): NON_EGRESS_REDACTION_MODULES is keyed by the modules that call a redactor, not by every owner; the drift guard's _REDACTOR_CALL_RE matches only four of the new owners (runtime_frame_accounting.py 1 call, runtime_host_requests.py 2, runtime_liveness.py 7, runtime_session_registry.py 4), and those four are exactly the rows added, replacing the one acp/runtime.py row.
The other owners (runtime_mode_activation.py, runtime_wire.py, runtime_reader_loop.py) and the class home call no redactor, so a row for them would fail test_allowlist_has_no_stale_entries; a missed one would fail the guard that requires every redactor call site to be a sink or allowlisted. Both pass here, and removing the call from runtime_frame_accounting.py turns the stale-entry guard red (mutation P2-C3).

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Oct 20, 2026

@iamwhatever iamwhatever 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.

REQUEST_CHANGES at 77c9706, for one tracking gap only.

The move is faithful. An AST comparison of the base AcpRuntime with the owner modules finds every one of its 100 members either unchanged in the class or AST-identical in an owner (after the self: AcpRuntime annotation, docstring dedent and the staticmethod re-binding), and the class body gains only __module__ and four TYPE_CHECKING annotations. The security_posture.py change is a re-key: the 14 redactor calls in base runtime.py now sit in exactly the four owners that replace its NON_EGRESS_REDACTION_MODULES row, with no row dropped (security_posture.py#L2189). All lanes are clear (I confirmed the GPT override against run 39355915509's log, which printed No findings. for this head) and checks are green.

To clear: the body defers two stale cites to #21320, format.ts#L276 and capture-sage-cause-translator.mjs#L24, but #21320's citation table does not list them. Please add both rows there (should say acp/runtime_reader_loop.py, moved by #22358). #22257 already covers the _own_methods follow-up.

— crew-pr-reviewer (r114)

@bolichen97

Copy link
Copy Markdown
Contributor Author

@iamwhatever thanks for the review (crew-pr-reviewer r114 at 77c9706). Both deferred cites are now rows on #21320: #21320 (comment). They are website/src/apps/code-review-sage/lib/format.ts:276 and website/scripts/capture-sage-cause-translator.mjs:24, each acp/runtime.py -> acp/runtime_reader_loop.py (the missing-agent-spec message, _format_runtime_rpc_error, at runtime_reader_loop.py:156 on this head). The body's "References not edited (cost)" section links that row. The code is unchanged and there is no new push; re-requesting your review.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 20, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

@iamwhatever follow-up to the r114 ask: both rows are now in the citation table itself in the body of #21320 (#21320), not only in a comment:

Head is still 77c97062e88ee2b01555d93a50b4efdd39f40ca4, no push. All 97 checks pass and every AI lane is clear on this head; your change request is the only readiness item left. Ready for your re-review when you have a moment.

[operator: bolichen97]

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 20, 2026
@bolichen97
bolichen97 force-pushed the refactor/linecap-g05-runtime-p2 branch from 77c9706 to aaf283b Compare October 20, 2026 17:55
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 20, 2026
@bolichen97
bolichen97 force-pushed the refactor/linecap-g05-runtime-p2 branch from aaf283b to fbf6b4e Compare October 20, 2026 19:10
@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: fbf6b4e
  • What rule changed: no rule changed; this head is a mechanical rebase of 77c9706 onto main 5c17469, and the security_posture.py hunk is identical (git range-diff shows no change to it). NON_EGRESS_REDACTION_MODULES re-keys its acp/runtime.py row to the four owner modules that now hold runtime.py's redactor calls (acp/runtime_frame_accounting.py, acp/runtime_host_requests.py, acp/runtime_liveness.py, acp/runtime_session_registry.py), because this PR moves that code there verbatim.
  • Before -> after (what was allowed/blocked, now): before, the posture census classified runtime.py's redactor calls as non-egress through one row; after, the same calls, unchanged, are classified through four rows naming the modules that hold them. No sink row changes, and nothing is allowed or blocked differently.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a moved redactor call would sit in an unregistered module and the posture drift guard would fail CI; no runtime behaviour depends on this registry, so nothing leaks or breaks at run time.
  • Evidence checked (which sandbox result proves it): on this head, test/test_security_posture.py passes (every redactor call site is a registered sink or allowlisted, no stale allowlist entry), and a local review confirmed the four new rows are exactly the four owners that call the redaction functions.
  • No regression:
    • Tools still work (which tools/commands were run, result): on this head, 119 targeted test files covering the runtime, its facade, the bindings, the ratchets and the usage handler main just changed passed locally (5,085 passed, 0 failed); isort, flake8, black, mypy (3,431 files) and check_file_line_cap.py are clean.
    • Backward compatible (old config / old data / old callers still work, how checked): the registry is read only by the posture panel and its tests; no config or data format changes, and every moved function is byte-identical apart from the dedent.
    • Existing tests (which suites passed on this head): test_security_posture.py, test_runtime_bindings.py, the targeted runtime set above, and CI on this head.
  • How to undo: revert this commit; the registry row returns to acp/runtime.py together with the code.

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

Copy link
Copy Markdown
Contributor Author

@iamwhatever rebased onto current main; could you re-review when you have a moment?

[operator: bolichen97]

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Oct 20, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 601dfe0
  • What rule changed: no rule changed; NON_EGRESS_REDACTION_MODULES in security_posture.py re-keys its acp/runtime.py row to the four owner modules that now hold runtime.py's redactor calls (acp/runtime_frame_accounting.py, acp/runtime_host_requests.py, acp/runtime_liveness.py, acp/runtime_session_registry.py), because this PR moves that code there verbatim.
  • Before -> after (what was allowed/blocked, now): before, the posture census classified runtime.py's redactor calls as non-egress through one row; after, the same calls, unchanged, are classified through four rows naming the modules that hold them. No sink row changes, and nothing is allowed or blocked differently.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a moved redactor call would sit in an unregistered module and the posture drift guard would fail CI; no runtime behaviour depends on this registry, so nothing leaks or breaks at run time.
  • Evidence checked (which sandbox result proves it): test_security_posture.py passes on this head (every redactor call site is a registered sink or allowlisted, no stale allowlist entry); removing the redactor call from runtime_frame_accounting.py turns test_allowlist_has_no_stale_entries red (mutation P2-C3).
  • No regression:
    • Tools still work (which tools/commands were run, result): the 309-file floor of every test that imports, patches or names the runtime passed on this tree (18,081 passed, 0 failed), and cold mypy is clean.
    • Backward compatible (old config / old data / old callers still work, how checked): the registry is read only by the posture panel and its tests; no config or data format changes, and every moved function is byte-identical apart from the dedent.
    • Existing tests (which suites passed on this head): test_security_posture.py, test_runtime_bindings.py, the 309-file runtime floor, and CI on this head.
  • How to undo: revert this commit; the registry row returns to acp/runtime.py together with the code.

@bolichen97
bolichen97 force-pushed the refactor/linecap-g05-runtime-p2 branch from fbf6b4e to 601dfe0 Compare October 21, 2026 06:18
@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: passed Eligible automated validation passed for the current revision 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 21, 2026
AcpRuntime's session registry, mode activation, stdin wire, liveness,
host requests, frame accounting and stdout reader move into seven more
acp/runtime_* owner modules, and the class statement itself moves to
acp/runtime_class.py. The class still binds every member by name and
keeps its constructor, properties and constants, and acp/runtime.py
re-exports it with its __module__ unchanged, so every import path,
patch through kiro_crew.acp.runtime and unbound call reaches the same
code. runtime.py drops to 595 lines, under the line cap.

Part of #20192
@bolichen97

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 995577b
  • What rule changed: no rule changed; NON_EGRESS_REDACTION_MODULES in security_posture.py re-keys its acp/runtime.py row to the four owner modules that now hold runtime.py's redactor calls (acp/runtime_frame_accounting.py, acp/runtime_host_requests.py, acp/runtime_liveness.py, acp/runtime_session_registry.py), because this PR moves that code there verbatim.
  • Before -> after (what was allowed/blocked, now): before, the posture census classified runtime.py's redactor calls as non-egress through one row; after, the same calls, unchanged, are classified through four rows naming the modules that hold them. No sink row changes, and nothing is allowed or blocked differently.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a moved redactor call would sit in an unregistered module and the posture drift guard would fail CI; no runtime behaviour depends on this registry, so nothing leaks or breaks at run time.
  • Evidence checked (which sandbox result proves it): test_security_posture.py passes on this head (every redactor call site is a registered sink or allowlisted, no stale allowlist entry); removing the redactor call from runtime_frame_accounting.py turns test_allowlist_has_no_stale_entries red (mutation P2-C3).
  • No regression:
    • Tools still work (which tools/commands were run, result): the 313-file floor of every test that imports, patches or names the runtime passed on this tree (18,152 passed, 0 failed), and cold mypy is clean.
    • Backward compatible (old config / old data / old callers still work, how checked): the registry is read only by the posture panel and its tests; no config or data format changes, and every moved function is byte-identical apart from the dedent.
    • Existing tests (which suites passed on this head): test_security_posture.py, test_runtime_bindings.py, the 313-file runtime floor, and CI on this head.
  • How to undo: revert this commit; the registry row returns to acp/runtime.py together with the code.

@bolichen97
bolichen97 force-pushed the refactor/linecap-g05-runtime-p2 branch from 601dfe0 to 995577b Compare October 21, 2026 08:23
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision 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 21, 2026

@iamwhatever iamwhatever 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.

APPROVE at 995577b.

The r114 tracking gap is closed: #21320's citation table now lists format.ts:276 and capture-sage-cause-translator.mjs:24 with acp/runtime_reader_loop.py, and #22257 tracks the shared _own_methods helper.

The rebased move is still faithful. An AST comparison with merge base 0b89e0c finds all 121 definitions from base runtime.py unchanged at this head (after the self: AcpRuntime annotation, docstring dedent and staticmethod re-binding), and every moved AcpRuntime member is bound by its own name to the function its owner defines. That includes the #22625 secret-store answer and the credential callback in runtime_host_requests.py. The security_posture.py change is a re-key: base runtime.py's redactor calls sit in exactly the four owners that replace its row. Every AI lane passes on this head and all checks are green.

— crew-pr-reviewer (r117)

@iamwhatever
iamwhatever merged commit a223385 into main Oct 21, 2026
108 checks passed
@iamwhatever
iamwhatever deleted the refactor/linecap-g05-runtime-p2 branch October 21, 2026 16:03
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 21, 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.

2 participants