codeberg_api is a bash function in the gardener script's own process,
not available to claude-p's tool execution environment. Claude was
silently failing to call it and returning CLEAN.
Switch to curl commands with $CODEBERG_TOKEN env var that claude-p
can actually execute via its bash tool.
Tech-debt→backlog promotion was only in prompt text, not in the
problem list. Claude focused on detected problems (dupes, thin issues)
and printed CLEAN, ignoring the primary mission.
Fix: explicitly list up to 10 tech-debt issues in the problem list
so claude sees them as actionable items.
Also bumped --max-turns from 10 to 30 — promoting issues requires
reading + editing + relabeling via API, needs more turns.
When PR has merge conflicts (mergeable=false), attempt git rebase
before merge. If rebase fails, abort and escalate via notify.
Flow: approval → check mergeable → rebase if needed → wait CI → merge
Resolves the serial seed PR bottleneck where append-only files
(manifest.jsonl) create trivial conflicts that block the pipeline.
Root cause: Two bugs combined to silently close PRs without merging.
1. HTTP 405 ('not allowed to merge') was in the success condition
alongside 200/204. Codeberg returns 405 when branch protection
blocks the merge (e.g., stale approvals).
2. append_state_log pushed a new commit AFTER review_bot approved,
but BEFORE the merge attempt. With dismiss_stale_approvals=true,
the new commit automatically dismissed the approval → 405.
Impact: 6 PRs (#683, #688, #692, #695, #696, #699) were 'merged'
(logged as success, branch deleted, issue closed) but never actually
merged into master. All work was lost.
Fixes:
- Remove 405 from merge success check
- Move STATE.md append out of pre-merge path
The merged-PR search was over-engineered and caused false negatives
(couldn't match PR to issue when title/body didn't contain #NNN).
Issue closed = dep satisfied. Factory only closes after merging.
Codeberg uses shared issue/PR numbering. When a PR IS the dep issue
(e.g. PR #665 fixes issue #665), the title search misses it.
Fallback checks if pulls/{dep_num} is merged.
Moved from dark-factory to harb. Dev-agent appends one line to
STATE.md on the PR branch right before merge — goes through
review like any other change.
After each successful PR merge, dev-agent appends one line to
STATE.md: - [date] what now exists (#PR)
Lives in dark-factory repo (harb master is protected).
Planner will collapse this into a compact snapshot later.
When dev-agent exhausts CI fix budget, writes escalation marker.
Supervisor picks it up next poll and invokes claude -p to diagnose
(flaky test? rate limit? real bug?) and decide: fix, close PR, or
escalate to human.
PR #649 sat blocked for hours — CI passed, review approved, but
merge conflict from other PRs landing. Supervisor said 'all clear'.
Now checks mergeable=false before CI state, alerts on conflict.
Factory supervisor reverted OptimizerV3.sol during an active evolution run,
killing all candidate scoring. Added evolution pipeline awareness to git
best-practices: check for running evolve.sh before reverting dirty state.
- Moved ci-debug.sh from dev/ to lib/ (shared utility)
- README: fixed supervisor description (all alerts go to claude)
- README: replaced implementation details with actual design principles
- PROMPT.md references best-practices/ files instead of inlining all knowledge
- best-practices/{memory,disk,ci,dev-agent,git}.md — loaded on demand by claude
- All alerts go to claude -p. Claude decides what to fix and what to escalate.
- update-prompt.sh targets specific best-practices files for self-learning