Coder code patterns, refactor-first guidance, and structural task blocking - #9
Merged
Merged
Conversation
Extends the Coder role's default system prompt with explicit code style guidance: prefer early returns over if/else, avoid else-if chains, and prefer map lookup defaults/fallbacks over if/else value assignment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QASDYY4oStKvQBBK9m8GAG
The Coder agent now proposes a separate refactor ticket instead of refactoring inline when one would make a task trivial to implement, and waits on human approval before blocking the original task on it via a new gitzi_block_task tool. Tasks gain a blocked_by list, and the agent pool's task pick-up skips tasks whose blockers haven't reached Done (KanbanBoard::next_unblocked), enforcing the link structurally rather than as a free-text note. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QASDYY4oStKvQBBK9m8GAG
tools_list_returns_all_seven_tools hardcoded an expected count of 7 gitzi_* tools, which went stale once gitzi_block_task was registered. Bump to 8, add the new tool to the expected name list, and rename the test so it no longer encodes a count in its name.
wparad
added a commit
that referenced
this pull request
Jul 25, 2026
…fznmgy Coder code patterns, refactor-first guidance, and structural task blocking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AgentRole::Coder's default system prompt (src/dispatcher/mod.rs) with explicit code-pattern guidance, following the same approach used for the Designer role's prompt extension:ifoverif/else.else ifchains — use early returns or amatch/switchinstead.dict[key] || default,map.get(key).unwrap_or(default)) overif/elsevalue assignment.gitzi_create_task) under the same epic, asks the human to confirm viagitzi_create_review_item, and — once accepted in a later run — blocks the original task on the refactor ticket instead of refactoring inline.Taskgains ablocked_by: Vec<String>field (src/model/task.rs).KanbanBoard::next_unblocked(src/dispatcher/board.rs) picks the highest-priority task in a column whose blockers have all reachedStage::Done; an unknown blocker ID fails closed (task stays blocked).agent_pool.rs's task pick-up loop now callsnext_unblockedinstead of taking the column's first task unconditionally.gitzi_block_task(task_id, blocked_by)tool, wired throughprotocol.rs(schema),tools.rs(dispatch + ownership check), andcoding_tools.rs(CodingLoop fallback). It moves the task back to the top of Prioritized and records the blocker list — unlikegitzi_park_task, which is a free-text note only, this is a structural link the pipeline enforces.Test plan
cargo build— succeedscargo test --lib— all 90 tests pass, including newKanbanBoard::next_unblockedcases (no blockers, unfinished blocker, blocker reaches Done, unknown blocker ID)cargo clippy --lib— no warningsGenerated by Claude Code