Skip to content

CL-6946 part 2: delete prose-based sub-agent stop-reason matchers - #610

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-6946-part2-delete-the-prose-report-matchers
Aug 24, 2026
Merged

CL-6946 part 2: delete prose-based sub-agent stop-reason matchers#610
TheGreatAxios merged 1 commit into
mainfrom
cl-6946-part2-delete-the-prose-report-matchers

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

Threads the structured ForcedStopReason through the sub-agent dispatch path instead of re-deriving it by parsing the returned report's prose.

  • runSubAgent now returns { report, stopReason? } instead of a bare string; stopReason is set whenever the run ends via a forced stop (turn budget, no-progress, never-acted, never-edited, deadline, cancelled, stalled, repetition, incomplete-report).
  • SubAgentDirector exposes the reason via observeForcedStop, wired into runSubAgent's return.
  • task-tool.ts classifies the salvage outcome and selects the parent hint from result.stopReason directly, and stamps ToolResult.detail.stopReason so the parent chat director can do the same without parsing tool-result content.
  • classifyBriefSalvage is now (input: { stopReason?, wasCancelled }) => BriefSalvageKind | null — a trivial passthrough, no string/regex matching anywhere.
  • appendSubAgentParentHints now switches on the structured reason instead of re-parsing report text.
  • src/agent/director.ts's hard-block-salvage nudge (previously classifyBriefSalvage(toolResultContentString)) now reads the same structured detail.stopReason off the tool result.

Deleted

  • isForcedStopSubAgentReport and every per-reason wrapper (isTurnBudgetSubAgentReport, isNeverActedSubAgentReport, isNeverEditedSubAgentReport, isDeadlineSubAgentReport, isRepetitionSubAgentReport, isNoShipSubAgentReport, isNoProgressSubAgentReport, isStalledSubAgentReport, isCancelledSubAgentReport, isIncompleteReportSubAgentReport).
  • appendTurnBudgetParentHint, appendNeverActedParentHint, appendNeverEditedParentHint, appendDeadlineParentHint, appendNoShipParentHint, appendRepetitionParentHint, appendNoProgressParentHint (folded into one structured switch in appendSubAgentParentHints).
  • parseSubAgentReport import from brief-dispatch.ts's consumer path (the genuinely different completeness-gate use of hasReportEnvelope in stop-policy.ts — checking the model's own final turn for a report envelope as a nudge trigger — is unrelated and kept).
  • Tests that asserted prose-matching behavior of the removed functions; replaced with tests proving classifyBriefSalvage decides from the structured value with no text involved.

Not touched

The sibling lanes (CL-6994, CL-6995) hadn't landed on main as of this branch, so nothing described in the ticket was already removed — all the ForcedStopReason variants and their prose renderers in FORCED_STOP_SUMMARIES are still present; only the classification path changed.

Net diff

git diff --stat origin/main...HEAD: 18 files changed, 302 insertions(+), 339 deletions(-) — net −37 lines.

Test plan

  • bun test src/subagent/index.test.ts src/agent/director.test.ts src/subagent/run-authority.test.ts src/subagent/agent-fleet.test.ts src/subagent/task-tool-worktree.test.ts src/perf/permission-subagent-spans.test.ts tests/unit/subagent-session-store.test.ts tests/unit/subagent.test.ts tests/unit/telemetry-product-events.test.ts — 250 pass, 0 fail
  • bunx tsc --noEmit — clean
  • bun run check — lint/typecheck/build pass; 8 pre-existing failures in unrelated integration suites (git-push-scoped, late-MCP-dispatch, reactor-permission-multi-turn) — timing/network flakes untouched by this change

…rt 2)

Replaces prose-matching of forced-stop reports (isXxxSubAgentReport family,
per-reason parent hint functions, classifyBriefSalvage(string)) with a
structured ForcedStopReason value threaded through runSubAgent's return and
the task tool result's detail field. The parent chat director and task-tool
dispatch path now classify salvage outcomes and select hint text from that
typed value instead of parsing report text.
@linear-code

linear-code Bot commented Aug 24, 2026

Copy link
Copy Markdown

CL-6946

@TheGreatAxios
TheGreatAxios merged commit af06c54 into main Aug 24, 2026
5 checks passed
TheGreatAxios added a commit that referenced this pull request Aug 27, 2026
…rt 2) (#610)

Replaces prose-matching of forced-stop reports (isXxxSubAgentReport family,
per-reason parent hint functions, classifyBriefSalvage(string)) with a
structured ForcedStopReason value threaded through runSubAgent's return and
the task tool result's detail field. The parent chat director and task-tool
dispatch path now classify salvage outcomes and select hint text from that
typed value instead of parsing report text.
TheGreatAxios added a commit that referenced this pull request Aug 27, 2026
…rt 2) (#610)

Replaces prose-matching of forced-stop reports (isXxxSubAgentReport family,
per-reason parent hint functions, classifyBriefSalvage(string)) with a
structured ForcedStopReason value threaded through runSubAgent's return and
the task tool result's detail field. The parent chat director and task-tool
dispatch path now classify salvage outcomes and select hint text from that
typed value instead of parsing report text.
@TheGreatAxios
TheGreatAxios deleted the cl-6946-part2-delete-the-prose-report-matchers branch August 28, 2026 00:09
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.

1 participant