fix: stop publishing rejected PRs + worker/snapshot/fork fixes (#85)#86
fix: stop publishing rejected PRs + worker/snapshot/fork fixes (#85)#86konard wants to merge 9 commits into
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: Payel-git-ol#85
…t-ol#85) Stop the pipeline from publishing a pull request when the Boss validation rejected the solution. Previously 'Boss validation rejected' was immediately followed by 'Creating GitHub pull request'. The gate is fail-open (validateSolution returns Approved on AI errors) and can be disabled with VALIDATION_GATE=off.
Payel-git-ol#85) The group chat orchestrator swallowed agent errors (emitted as events only), so a worker timeout (ollama DeadlineExceeded) produced zero files yet the manager still reported success. Now record agent errors and treat an empty file set as a failure for code tasks. Adds isCodeTask helper + test.
…ayel-git-ol#85) The snapshot crashed with 'copy_file_range: is a directory' because it followed the 'result' nix-build symlink into /nix/store. copyFile now reports skipped entries, skips /nix/store symlinks, directories and broken symlinks, and recreates ordinary symlinks.
…-ol#85) When pushing the branch fails with a permission error (no write access to the upstream repo), fork the repository, wait for it to be ready, push the branch to the fork and open a cross-repo pull request using the 'forkOwner:branch' head format.
Working session summaryBoth CI commands pass ( Done — PR #86 updated and ready for reviewPR: #86 All four problems from issue #85 are fixed at the root cause, each with a regression test:
Tests added: Verification (run locally):
Housekeeping: removed the placeholder This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:Claude Opus 4.8: (2 sub-sessions)
Total: (27.2K new + 197.9K cache writes + 5.4M cache reads) input tokens, 45.6K output tokens, $5.216796 cost 🤖 Models used:
📎 Log file uploaded as Gist (2246KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
|
fix conflicts |
|
🤖 AI Work Session Started Starting automated work session at 2026-06-14T19:04:56.807Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback. |
🔄 Auto-restart triggered (iteration 1)Reason: Merge conflicts detected Starting new session to address the issues. Auto-restart-until-mergeable mode is active. This run will stop after 5 restart iterations. |
…into issue-85-d15da1c8214b # Conflicts: # orchestrator/internal/service/rules/boss/github.go # orchestrator/internal/service/rules/boss/task.go
…into issue-85-d15da1c8214b # Conflicts: # orchestrator/internal/service/rules/boss/github.go # orchestrator/internal/service/rules/boss/task.go
…e-85-d15da1c8214b
✅ Merge conflicts resolved — ready for reviewThe PR was conflicting because the base branch Conflicts resolved
All four issue #85 fixes intact after the merge
Verification
|
Summary
Fixes the four problems reported in #85 — the orchestrator finished work but published a pull request even when validation rejected the solution, and several edge cases caused crashes or false success. Each problem is fixed at the root cause with a regression test.
Problems & fixes
1. Validation as a gate (
boss/task.go)Logs showed
Boss validation rejectedimmediately followed byCreating GitHub pull request. The validation result was computed but never used to stop publishing.validateSolution, computeapproved := validation == nil || validation.Approved.task.Status = "rejected", and emit arejectedstatus carrying the boss review so the UI can show the required fixes.validateSolutionreturnsApproved: trueon AI errors, so transient failures don't block delivery.VALIDATION_GATE=offto restore the previous always-publish behaviour.2. Worker timeout → false success (
groupchat/orchestrator.go,worker/assign.go,worker/assign_helpers.go)A worker failed with
ollama rpc DeadlineExceededand produced no code, yet the manager reported success. Root cause: the group chat orchestrator only emitted agent errors as events andRunreturnednil, so callers never saw the failure.Orchestratornow records agent errors (recordError/Errors()) instead of dropping them.isCodeTaskkeeps the check scoped to code tasks (document/research/presentation may legitimately produce no code files).3. Snapshot crash on
resultsymlink (boss/project.go)The snapshot crashed with
copy_file_range: is a directorybecause it followed theresultnix-build symlink into a/nix/storedirectory.copyFilenow returns(skipped bool, err error)and: skips/nix/storesymlinks (the build artifact), skips directories and broken symlinks, and recreates ordinary symlinks instead of dereferencing them.4. 403 → fork fallback (
github/fork.go,boss/github.go)When the bot lacks write access to the upstream repo, the push failed with 403 and no PR was created.
github/fork.go:IsPermissionError,ForkRepository(POST/forks),WaitForRepository(polls until the fork is ready),PushBranchToRemote.createPullRequestdetects a permission error, forks the repo, pushes the branch to the fork, and opens a cross-repo PR using theforkOwner:branchhead format.Tests
boss/snapshot_test.go— nix-store symlink skipped, directory symlink skipped, regular file copied, fullprepareSnapshotDirignores theresultartifact.github/fork_test.go—IsPermissionErrortable (nil / 403 / "Permission … denied" / "Write access … not granted" / unrelated).worker/result_gate_test.go—isCodeTaskclassification.Closes #85