Skip to content

refactor(dashboard): move the runner's turn helpers into chat_turn - #21086

Merged
bolichen97 merged 1 commit into
mainfrom
refactor/linecap-g01-chat-runner-p4
Oct 17, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
refactor/linecap-g01-chat-runner-p4

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Move the next set of the dashboard chat runner's top-level helpers into chat_turn owners by responsibility, so chat_runner.py sheds another 2,300 lines with no change to what a turn does.

src/kiro_crew/dashboard/chat_runner.py is about 18,500 lines after the previous PR of this series; the campaign rule is that no hand-written file goes over 2,000 lines. The helpers this PR moves (the account-identity gate, the decisions hooks and the Jev model routing, the segment flush, the deferred session reset, the cross-surface legs, the prompt and skill mentions, the local slash-command answers, the eager-spawn backoff) each belong to one chat_turn owner, new or existing.

Why it matters

Every dashboard, Slack and channel turn runs through these helpers. Each one that stays in the runner keeps the file far over the cap and keeps unrelated work in one review surface. Moving them as whole definitions, with every guard that reads them by path pointed at their new homes, shrinks the runner while every patch of chat_runner.<name> keeps reaching the moved code.

Not a goal

  • No change to what a turn does: helpers move verbatim, and their callers stay where they are.
  • Nothing is cut out of _run_chat itself; its phases move in later PRs of the series.
  • The helpers from _armed_prefetches on (the rest of the eager spawn and prefetch, the /workflow, /agent and /goal handlers) stay for the next PR: moving them in the same diff makes git's default diff show kept code as rewritten.
  • _expand_prompt_mention_off_loop stays in the runner: test_prompts.py reads its asyncio.to_thread call in the runner's own text.

What changed (motivation → approach → change)

Sixty-three top-level units (2,249 lines) move, whole, into eight owners, six of them new; each owner owns one responsibility, recorded in the composition section of learn-cron-dashboard.md. compose binds every moved name on the runner, so chat_runner.<name> still resolves and a test's patch of it still reaches the moved code.

Owner New What moved in
account_identity yes retiring the sessions an account change invalidates, and the signed-out latch
decisions_hooks yes the stale-decision drop, the strip hand-off, the tool-card risk annotation, the Jev model routing family
segment_flush yes finalizing an assistant text segment: redaction with its records, row meta, the [OPTIONS:] footer audit, the widget registration; a local command's reply persisted through the same redaction
session_reset yes the deferred reset's consume and its retry
slash_commands yes the backend a slash command runs on, the answer to one no channel can take
eager_spawn yes the eager spawn's and the resume prefetch's backoff, admission caps and TTL
recipient, prompt_assembly no the linked-Slack and cross-surface legs; prompt and skill mentions and the prompt chip

slash_commands (94 lines) is under 150 lines and eager_spawn (180) just over: the next PR moves the rest of their responsibility into them (the /workflow, /agent and /goal handlers; the spawn and prefetch entries), which this diff leaves out for the reason above. Until then each one's docstring and spec row name only what it holds.

Repository guards that read a moved construct by path read its new home: the composition contract's owner set, homes map and task-entry homes (the pending-reset retry now lives in session_reset), security_posture's non-egress registry for the four owners that now hold redactor calls, the transcript seam's plumbing list, the config-dir guard's file list, and the frontend pin that reads the Jev routing constant's source (website/src/test/jevRoute.test.tsx reads chat_turn/decisions_hooks.py); the whole-package redact scan's chat_turn floor (test_core_path_redact_before_bound.py) rises to the 11 owners that call a redactor now. Docs that name the runner as a moved helper's home name its owner, in each citation form (chat_runner.<name>, chat_runner.py::<name>, `chat_runner.py` (`<name>`)). The "Dashboard final message" sink still names chat_runner.py: the runner runs that pass on an interrupted reply and _flush_segment runs on the runner's globals, so the posture panel text is unchanged. The table of moved names (_BASE_SURFACE) and the three tests that read it move, unchanged, from test_chat_runner_composition_contract.py to the new test_chat_runner_base_surface.py, so the contract stays under the line cap as the table grows.

Backwards compatibility

Compatible: every name chat_runner bound at the base is still bound, as the same object (the base-names contract test); every patch target still reaches the code it reached.

Removes nothing: no public def, route, key or file leaves; the moved helpers are private, and each still resolves on chat_runner.

Tests

  • Node ids move file, names unchanged: test_the_owner_set_is_the_package, test_a_moved_name_keeps_its_base_shape_and_owner[...] and test_the_owners_define_functions_for_the_sweeps_to_check go from test/test_chat_runner_composition_contract.py to test/test_chat_runner_base_surface.py. Collected over both files: 302 at the base, 365 at the head. The 63 new nodes are test_a_moved_name_keeps_its_base_shape_and_owner[...] for this PR's 63 _BASE_SURFACE rows, and test_a_task_entry_is_defined_in_its_home_file[_arm_pending_reset_retry-...] names the task entry's new home (dashboard/chat_turn/session_reset.py); every other node keeps its name and parameters.
  • Every guard that reads a construct by path has a mutation of that construct, in the file that holds it after the move, that turns it red: 94 mutants, every one killed. That is the previous PR's 84, re-aimed (the identity-gate pin now targets account_identity), plus 10 for this PR: the plumbing read, two non-egress rows, the config-dir guard in a new owner, a slice inside a redactor call in segment_flush, a backend-identity read in decisions_hooks, a moved name's changed signature, a row naming the wrong owner, an owner missing from the contract's owner set, and an owner that stops calling its redactor (the scan's raised floor goes red).
  • 325 test files that import, patch or read chat_runner, chat_turn or a moved name, plus the flake, wait, line-cap, base-names, security-posture and path-inventory guards: 19,835 passed, 0 failed (-n 3 --dist loadgroup). scripts/local-gate.py --dry-run selects 547 backend and 369 frontend files, over the 600-file local budget, so this floor ran instead; CI runs the full suite.
  • Line coverage of every owner over that run: 86% to 100% (account_identity 99%, decisions_hooks 93%, segment_flush 96%, session_reset 86%, slash_commands 97%, eager_spawn 96%).
  • website/src/test/jevRoute.test.tsx (19 tests) passes with vitest, eslint and npm run typecheck; changing _JEV_ROUTE_AUTO_MODELS in decisions_hooks.py turns it red.
  • L41: planting time.sleep(1) in each coroutine owner's first coroutine is reported by the sync-io gate's own scanner (18 of 18).
  • mypy over src/kiro_crew: clean. semgrep 1.78 (CI configs, baseline at the base): 0 findings after one own-line nosemgrep on a moved warning that logs the redactor's pattern class, never the value; 0 parse errors. black, isort, flake8, comment-history, brand, docs-lint, agent-sdk, subprocess-encoding and sync-io gates: clean. Installed-mode import of the built wheel (under an isolated HOME): all 25 owners import.

Move audit: chat_runner.py 18,687 → 16,372 lines, 143 units; every moved unit is unchanged, and the one changed unit is _arm_queued_delivery_settlement, which stays in the runner: its docstring now names slack/gateway_runtime/subagent_injection.py, where _defer_queued_delivery is defined (#21176), and a comment above the recovery-message re-exports names chat_utils_injected_rows and chat_utils_turn_recovery (#21094). L36: every file's default and --minimal diffs add the same lines. Line cap: 0 failures. The chat_runner.py row of .github/file-line-cap-baseline.txt stays as main has it: CI checks the merge with main, which adds runner lines while this PR is open, so a row lowered to this head's count would fail there; the guard notes the shrink, and the series deletes the row in the PR that brings the runner under the cap.

Manual verification

N/A — a structural move; the turn-level characterization suite and the mutation-proven guards are the verification.

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

Move audit

src/kiro_crew/dashboard/chat_runner.py: 18687 -> 16372 lines; moved 99.4% (python-ast)
   changed: _arm_queued_delivery_settlement [FunctionDef] 105 lines (docstring cite only; stays in the runner)
test/test_chat_runner_composition_contract.py: 1952 -> 1395 lines; moved 62.51% (python-ast)

The contract's changed units are its row tables (the owner set, the homes map, the task-entry homes) and its docstring line naming the new file; _BASE_SURFACE moved to test_chat_runner_base_surface.py with this PR's 63 rows added. Edits to moved lines: one # nosemgrep line with its reason (the moved warning is new to semgrep because its file is).

Follow-ups

  • _expand_prompt_mention_off_loop moves to prompt_assembly once test_prompts.py's offload check reads the chat_turn owners with the runner.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners October 16, 2026 05:22
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

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

UX-Verdict: PASS

Nothing to check.

[UX-REVIEWED] 7d4b155

Description read

[DESCRIPTION-READ] 0f8d307b7ad32340eb166ca4a15e864a13e81ff65969d74cf0ef18dace561307

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

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security_posture.py

  • @bolichen97 posted a complete reasoning template for 7d4b155.

@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

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 7d4b1558a89e62afbd3d30fe9227fb7ab07b498d — 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 slash_commands and eager_spawn actually get the rest of their responsibility in the next PR. Until then they are thin owners.

What this change ships

Inventory (8 items) — 7 justified

Intent: shrink chat_runner.py toward the 2,000-line cap by moving 63 helpers into chat_turn owners, with no change to turn behaviour. This is an ADDITION (a refactor) that the AGENTS.md line-cap invariant requires.

  1. 63 runner helpers move unchanged into eight chat_turn owners, six of them new — justified
  2. chat_runner.<name> still resolves to the moved object through compose, so existing patches keep working — justified
  3. The _BASE_SURFACE table and its three tests move into the new test_chat_runner_base_surface.py — justified
  4. security_posture.NON_EGRESS_REDACTION_MODULES gains four owners that now hold redactor calls — justified
  5. Path-reading guards (owner set, task-entry homes, config-dir list, transcript plumbing, the redact-scan floor) now point at the new homes — justified
  6. jevRoute.test.tsx now reads chat_turn/decisions_hooks.py — justified
  7. Specs and docs now name each moved helper's owner in every citation form — justified
  8. _arm_queued_delivery_settlement's docstring now names subagent_injection.py as _defer_queued_delivery's home — undeclared in the Goal; a docstring-only change carrying no risk

[FIRST-PRINCIPLES-REVIEWED] 7d4b155

Description read

[DESCRIPTION-READ] 340e603fb288806481045cc4fd1c4ccb4800e2ef14df042f86f2d9c857871f9c

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

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 7d4b155
  • What rule changed: none. security_posture.NON_EGRESS_REDACTION_MODULES adds the four dashboard/chat_turn/ owners that now hold redactor calls moved out of dashboard/chat_runner.py (eager_spawn, prompt_assembly, recipient, segment_flush), with the registry comment naming what they redact.
  • Before -> after (what was allowed/blocked, now): the same redactor calls, with the same arguments, run on the same text and reach the same surfaces; only the module that holds each call changed, and the registry names that module.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a redactor site counted under the wrong module, so the posture panel's site count is off; no redaction, command or gate changes, since every moved definition is byte-identical (move audit: 100% moved, 0 changed).
  • Evidence checked (which sandbox result proves it): no sandbox path changes; the move audit, the omission test in test_security_posture.py, the whole-package redact scan in test_core_path_redact_before_bound.py (its chat_turn floor rises to the 11 owners that redact), and mutants that drop each non-egress row or one owner's redactor call and turn those tests red.
  • No regression:
    • Tools still work (which tools/commands were run, result): the dashboard turn suites (test_chat_runner_turn_*.py, which run whole turns) and every test that imports, patches or reads the runner pass on this head.
    • Backward compatible (old config / old data / old callers still work, how checked): every name chat_runner bound at the base is still bound as the same object (the composition contract and test_chat_runner_base_surface.py), so callers and patches of chat_runner.<name> are unchanged.
    • Existing tests (which suites passed on this head): test_security_posture.py, test_core_path_redact_before_bound.py and the 325 files that touch the runner, its owners or a moved name (on this head: the 325-file floor plus the upstream test files that touch the runner, its owners, the posture registry or the facades, 395 files, 25,597 passed; the only reds are 3 that need a git checkout the gate's exported tree lacks (the two line-cap checkout tests and the harness-parity git ls-files test), and they pass in the worktree at this SHA; mypy clean).
  • How to undo: revert this one commit; no data or config changes.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Check that any guard outside this patch that reads a moved helper by its runner path, such as a semgrep rule or a doc-lint anchor, was pointed at the helper's new home.

[DESIGN-REVIEWED] 7d4b155

Description read

[DESCRIPTION-READ] 52869d8ee91ff178ccb76061dae743c320cd00888b0aa753252e447ed943ac1a

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

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 7d4b155

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

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

@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 7d4b1558a89e62afbd3d30fe9227fb7ab07b498d and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 7d4b155

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

@bolichen97
bolichen97 enabled auto-merge (squash) October 16, 2026 05:35
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention 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 16, 2026
@bolichen97
bolichen97 force-pushed the refactor/linecap-g01-chat-runner-p4 branch from c9235b8 to 8bbaeed Compare October 16, 2026 10:47
@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 16, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • First Principles punchline: the four new NON_EGRESS_REDACTION_MODULES rows hold only moved call sites, with no new egress path -- covered

The four owners' 17 redactor calls (eager_spawn 1, prompt_assembly 4, recipient 1, segment_flush 11) sit in units that moved whole from chat_runner.py. The move audit reports 100% moved and 0 changed, so each call keeps its arguments, its input and the surface its result reaches. This PR adds no route, writer or sender.
test_security_posture.py::TestOmissionDetection::test_every_redactor_call_site_is_a_registered_sink_or_allowlisted fails on any redactor caller outside both registries. It passed on main with none of these four rows, so none of the four owners held a redactor call before this PR moved one in. Dropping any one row turns it red (mutants PR4-non-egress-segment-flush, -recipient, -eager-spawn, -prompt-assembly).
This PR changes no _REDACTION_SINKS row and no test in test_security_posture.py; the only edit to security_posture.py is the NON_EGRESS_REDACTION_MODULES block.

@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 8bbaeed (reserved for a human reviewer, no defect found).

This PR moves the account-identity gate into chat_turn/account_identity.py and the segment redaction into chat_turn/segment_flush.py, and it edits src/kiro_crew/security_posture.py. Identity, redaction and security-posture changes are reserved for human review, so I am not approving this even though the move looks clean.

What I checked: all 63 top-level units that leave chat_runner.py show up in the eight owners with the same AST as at the merge-base, with none changed and none missing. The four new NON_EGRESS_REDACTION_MODULES rows match owners that received moved redactor calls. Every AI lane passes, the First Principles punchline has a disposition, and CI is green. I did not run the test or mutation suites.

To clear: a maintainer reviews the identity-gate and redaction moves and the registry change.

— crew-pr-reviewer (r107)

@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
@bolichen97
bolichen97 force-pushed the refactor/linecap-g01-chat-runner-p4 branch from 8bbaeed to 1647195 Compare October 16, 2026 23:24
@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 16, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Design punchline: the whole-package redact scan and the non-egress registry both resolve the four new redactor-calling owners -- covered

test_core_path_redact_before_bound.py lists src/kiro_crew/dashboard/chat_turn in _SCANNED_PACKAGES and scans the package whole, so eager_spawn, prompt_assembly, recipient and segment_flush are scanned with no row of their own. Its floor of 11 is the number of owners that call a redactor on this head. A slice planted inside a redactor call in segment_flush turns it red (mutant PR4-slice-inside-redact-in-segment-flush), and so does dropping recipient's redactor call (PR4-redact-floor-an-owner-stops-redacting).
test_security_posture.py::TestOmissionDetection::test_every_redactor_call_site_is_a_registered_sink_or_allowlisted reads every module under src/kiro_crew. Dropping any one of the four NON_EGRESS_REDACTION_MODULES rows turns it red (mutants PR4-non-egress-segment-flush, -recipient, -eager-spawn, -prompt-assembly).

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • First Principles punchline: slash_commands (94 lines) and eager_spawn (180 lines) get filled by the next PR -- yes, built and gated locally

The next PR of this series (#20192, PR5) is built by recipe on this head. It moves the /workflow, /agent and /goal handlers (_handle_workflow_command, _handle_agent_command, _handle_goal_command) into slash_commands, bringing it to 313 lines.
It moves the eager spawn and resume prefetch entries (schedule_eager_spawn, _eager_spawn, _admit_prefetch, _spawn_admitted_prefetch, _prefetch_ttl and their caps) into eager_spawn, bringing it to 1,049 lines.
This PR leaves them out only to stay inside the series' per-PR move budget. Until PR5 lands, each owner's docstring and spec row name only what it holds.

@bolichen97
bolichen97 force-pushed the refactor/linecap-g01-chat-runner-p4 branch from 1647195 to f9137f3 Compare October 17, 2026 04:26
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/dashboard/chat_runner.py (#16847 added _member_capable_backend_names next to a helper this PR moves; it stays in the runner), chat_turn/recipient.py (#21219) and doc rows this PR also edits (docs/feature-map/README.md, decisions.md, session.md, learn-cron-dashboard.md, security.md) since this head went green (1c9c73d -> b6e801b); CI re-running. The runner's comment cites name slack/gateway_runtime/subagent_injection.py and chat_utils_injected_rows / chat_utils_turn_recovery.

@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 17, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • First Principles punchline: the posture panel's "Dashboard final message" sink still names chat_runner.py after _flush_segment moved -- correct at this head

That sink is the full-text pass over the assembled turn, _final = redact_credentials(redact_exfiltration_urls(turn.assistant_text)[0])[0], which stays in _run_chat here (dashboard/chat_runner.py, in the turn's stop-hook block). The two stream sinks' StreamRedactors are built and fed in _run_chat too. So all three rows name the module that holds their redactor on this head.
_flush_segment is a different redactor: the per-segment pass before a segment row is persisted. It moves into chat_turn/segment_flush.py here, and that owner is registered in NON_EGRESS_REDACTION_MODULES. Dropping that row turns test_security_posture.py::TestOmissionDetection red (mutant PR4-non-egress-segment-flush).
Each sink row is re-keyed in the later PR of this series that moves its redactor out of _run_chat.

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

Copy link
Copy Markdown
Contributor Author
  • Design punchline: CI's full suite is green, not only the local 325-file subset -- confirmed on this head

All 89 check runs on f9137f3f81294c4005a8148f15536e9b1ed47579 completed green and 11 were skipped by their own path rules; none failed. That includes the whole backend suite in Backend Tests (3.12) shards 1-8 and (Windows) shards 1-8, plus the IPv6 (ubuntu, windows), namespace sandbox, crew container and kernel-lock-owner lanes, Integration (in-process gateway), the E2E lanes (stub ACP backend, private member namespace, gateway boot on ubuntu and windows), Coverage Gate and Frontend Coverage Merge.
The local gate before the push ran 395 files (the 325-file floor plus the upstream test files touching the runner, its owners, the posture registry or the facades) with 25,597 passed and mypy clean. CI's shards are the authority for the rest.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 17, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

Holding f9137f3.

  1. Conflict: GitHub reports this head as not mergeable against main. Since this head, main has changed chat_runner.py, chat_turn/__init__.py, security_posture.py and spec docs this PR also edits. A rebase clears this, and the rebased commit needs a fresh review.
  2. Reserved for a maintainer: the PR moves the account-identity gate (chat_turn/account_identity.py) and segment redaction (chat_turn/segment_flush.py), and edits src/kiro_crew/security_posture.py. Identity, redaction and security-posture changes need a human reviewer.

No defect found. I compared the AST against merge base b6e801b: all 63 units removed from chat_runner.py land unchanged in the eight chat_turn owners, none are missing, and only the declared _arm_queued_delivery_settlement docstring changed. Every AI lane passes, both punchlines have dispositions for this head, and CI is green.

— crew-pr-reviewer (r108)

Move 63 more top-level helpers of chat_runner.py, whole, into the
chat_turn owner of each one's responsibility: six new owners
(account_identity, decisions_hooks, segment_flush, session_reset,
slash_commands, eager_spawn) and the recipient and prompt_assembly
owners. compose binds every moved name on the runner, so
chat_runner.<name> still resolves and a patch of it still reaches the
moved code.

Guards that read a moved construct by path read its new home: the
composition contract's owner set, homes map and task-entry homes, the
security posture non-egress registry, the transcript seam's plumbing
list and the config-dir guard's file list. The table of moved names
and the three tests that read it move, unchanged, into
test_chat_runner_base_surface.py, so the contract stays under the
line cap as the table grows.

Part of #20192
@bolichen97
bolichen97 force-pushed the refactor/linecap-g01-chat-runner-p4 branch from f9137f3 to 7d4b155 Compare October 17, 2026 11:25
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/feature-map/README.md and docs/system-specs/modules/security.md (rows next to this PR's cite edits, which are re-applied unchanged) and in src/kiro_crew/dashboard/chat_runner.py (#20973's imports and _run_chat lines, none of the helpers this PR moves) since this head went green (b6e801b -> 6a2bba1); CI re-running.

@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 merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 17, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Design punchline: guards outside this patch that read a moved helper by its runner path point at its new home -- swept, none left behind

Every repo path outside src/ and test/ that names the runner was checked. semgrep/ has no rule keyed on chat_runner.py. AUTOSDE.yaml's chat rule already lists src/kiro_crew/dashboard/chat_turn/**/*.py beside the runner. The chat_runner.py mentions in scripts/check_memory_store_seam.py and scripts/check_agent_sdk_boundary.py are synthetic probe paths in their own self-tests, not lookups. .github/agent-sdk-boundary-baseline.txt counts the ACP imports that stay in the runner.
Docs Lint passes on this head: each moved helper's citation in the specs names its owner (chat_turn.<owner>.<name>). Its line-ref baseline rows cite RFC line numbers, not helper names.
Tests that read the runner by path, __file__, getsource or AST were re-pointed or re-anchored in this PR. Each re-point has a mutation proof (94 of 94 red), listed in this PR's guard-reach sweep, and the sweep is re-run on every rebase.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • First Principles punchline: slash_commands and eager_spawn get the rest of their responsibility in the next PR -- yes, built and gated locally

The next PR of this series (Part of #20192) is built by recipe on this head and type-checks clean. It moves the /workflow, /agent and /goal handlers into slash_commands (94 to 313 lines). It also moves the eager spawn and resume prefetch entries into eager_spawn (180 to 1,049 lines): schedule_eager_spawn, _eager_spawn, _admit_prefetch, _spawn_admitted_prefetch, _prefetch_ttl and their caps.
This PR stops short of them to keep each PR within the series' move budget. Until the next PR lands, each owner's docstring and spec row name only what it holds.

@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 17, 2026

@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 on behalf of the maintainer: refactor held by the cron on a feature-map README touch alone. Every review lane is clean on head 7d4b155 (only PR Scope size notes). Code-move verified by lanes.

@bolichen97
bolichen97 merged commit 42ad637 into main Oct 17, 2026
105 checks passed
@bolichen97
bolichen97 deleted the refactor/linecap-g01-chat-runner-p4 branch October 17, 2026 17:10
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 17, 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.

3 participants