suggest_next: end turn automatically and add summary parameter#214
Conversation
Implementation PlanProblem
Deliverables
Files to Modify
Design Decisions
Testing Approach
Acceptance Criteria
Plan created by mach6 |
- Add endTurn: true to success return path so agent loop stops after suggest_next (saves one LLM round-trip per suggestion) - Error path (invalid command) does NOT set endTurn, allowing model retry - Add optional summary parameter for agent to provide a markdown wrap-up of work done, rendered above the suggestion arrow - Update promptGuidelines to instruct models about summary and turn ending - Add tests for endTurn behavior and summary parameter
Implementation CompleteChanges in b7c03c7:
All 3146 tests pass. Build clean. Progress update by mach6 |
Code ReviewImportantFinding 1: The const command = rawCommand?.replace(/[\x00-\x1f\x7f]/g, "").trim();But details: { suggestion: command, summary: summary?.trim() || undefined },Both reach Suggested fix — strip non-newline control characters from const sanitizedSummary = summary?.replace(/[\x00-\x09\x0b-\x1f\x7f]/g, "").trim() || undefined;
details: { suggestion: command, summary: sanitizedSummary },Finding 2: The test suite only calls A test should create a minimal theme mock and assert:
SuggestionsFinding 3: Array-push-join pattern could be a simple ternary (confidence: 93) The 7-line array-push-join pattern can be expressed as a 2-line template literal with identical behavior: const arrow = theme.fg("toolOutput", `→ ${details.suggestion}`);
return details.summary ? `${details.summary}\n\n${arrow}` : arrow;Strengths
Agents run: code-reviewer, error-auditor, completeness-checker, test-reviewer, simplifier Reviewed by mach6 |
Review AssessmentClassifications
Action Plan
Assessment by mach6 |
Progress UpdateFixed markdown rendering in
Commit: Progress tracked by mach6 |
Code ReviewImportantFinding 1:
The test suite only calls Finding 2: Issue 210 AC item 4 requires: "Update the tool's Missing explicit guideline like: "Calling Finding 3: Carriage return ( The summary sanitization regex Fix: SuggestionsFinding 4: Duplicated The error and no-summary branches both do Finding 5:
Finding 6: Redundant truthiness guard in
Strengths
Agents run: code-reviewer, error-auditor, test-reviewer, completeness-checker, simplifier Reviewed by mach6 |
Review AssessmentClassifications
Action Plan
Deferred: Finding 1 (renderResult test coverage) — consistent with project patterns; no tools currently test renderResult individually. Not creating a tracking issue since this is a project-wide concern, not specific to this tool. Assessment by mach6 |
…ne, exclude from subagents
Progress UpdateAddressed review findings 2 and 3, plus two additional improvements:
Commit: Progress tracked by mach6 |
Code ReviewImportantFinding 1: The new conditional: const alwaysActiveBuiltins = options.tools
? ["skill", "tasks_update", "search"]
: ["skill", "tasks_update", "search", "suggest_next"];…determines whether No test verifies either behavior. A regression here could cause Finding 2:
The summary branch is non-trivial (calls SuggestionsFinding 3: JSDoc for The Finding 4: Branches 1 (error/no details) and 3 (details but no summary) both get-or-create a if (details?.summary) {
// Container branch (unchanged)
}
const text = (context.lastComponent as Text | undefined) ?? new Text("", 0, 0);
const msg = details
? `→ ${details.suggestion}`
: content?.type === "text" && content.text ? content.text : "";
text.setText(theme.fg("toolOutput", msg));
return text;Finding 5:
Strengths
Agents run: code-reviewer, error-auditor, test-reviewer, completeness-checker, simplifier Reviewed by mach6 |
Review AssessmentClassifications
Action Plan
Assessment by mach6 |
Progress UpdateAddressed review finding 2 (renderResult untested). Added 5 tests covering all 3 branches:
All 3155 tests pass (including 24 suggest-next tests). Build clean. Commit: Progress tracked by mach6 |
Closes #210
Make
suggest_nextend the agent turn automatically (likewaitandsubagent) and add an optionalsummaryparameter so the agent can consolidate its wrap-up into the tool call — saving one LLM round-trip per suggestion.Implementation plan posted as a comment below.