feat: sub-agent coordination module for Loop 2#72
Conversation
Pre-wave overlap detection with prompt injection and post-wave file conflict detection for the sub-agent pipeline. Advisory only -- overlaps generate hints in prompts; conflicts are logged but don't fail builds. Eight public functions: extract_file_references, detect_overlaps, generate_coordination_hints, inject_hints, detect_file_conflicts, format_conflict_report, coordinate_wave, log_conflicts. 47 new tests. Loop 2: 90% -> 100%. Overall: 87% -> 91%. Task #83. Closes #86 (duplicate).
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b0e354dd79
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| task_refs: dict[int, set[str]] = {} | ||
| for order in wave: | ||
| refs: set[str] = set(extract_file_references(order["prompt"])) |
There was a problem hiding this comment.
Exclude shared prompt boilerplate from overlap detection
detect_overlaps() currently extracts paths from the entire order["prompt"], but work-order prompts include shared repository context (not task-specific targets), so any common path in that boilerplate (for example .github/copilot-instructions.md from build_work_order_prompt) is reported as an overlap for every task in the wave. This creates systematic false-positive hints and drowns out real coordination signals when repos contain slash-based instruction-file paths.
Useful? React with 👍 / 👎.
| for f in tc["files_created"]: | ||
| file_to_tasks.setdefault(f, []).append(tc["task_id"]) | ||
| for f in tc["files_modified"]: | ||
| file_to_tasks.setdefault(f, []).append(tc["task_id"]) |
There was a problem hiding this comment.
Deduplicate per-task file entries before conflict checks
detect_file_conflicts() appends task_id for both files_created and files_modified without deduplication, then treats len(task_ids) > 1 as a conflict. If one task reports the same file twice (e.g., a newly created file also listed as modified), the function emits a conflict with duplicated IDs like [1, 1] even though only one task touched the file, producing incorrect conflict reports.
Useful? React with 👍 / 👎.
When tasks tie on priority, the build operator now prefers the task whose vision_section targets the lowest-percentage tracker section, preventing consecutive sessions from advancing only one section while others stagnate. Closes task #72.
When tasks tie on priority and expected tracker impact, the build operator now prefers the task targeting the lowest-percentage vision section in TRACKER.md. Rule documented in SKILL.md and GUIDE.md with a worked example. Advisory only -- no code change required.
…reaker feat: add vision-alignment tiebreaker to task selection (task #72)
Summary
nightshift/coordination.pywith 8 public functions for pre-wave overlap detection (with prompt injection) and post-wave file conflict detectionFileOverlap,FileConflict,ConflictReportTypedDicts totypes.pyFILE_REFERENCE_PATTERNregex andCOORDINATION_HINT_TEMPLATEtoconstants.pycoordinate_wave()andlog_conflicts()intobuild_feature()wave loopTracker Impact
Tasks
Test plan
make checkpasses (814 tests, all lint/format/mypy clean)