Commit graph

989 commits

Author SHA1 Message Date
openhands
30b31c76aa fix: stuck PR detection only matched fix/issue-NNN branches
PRs with custom branch names (fix/fitness-factory-address,
chore/seed-consolidation) were invisible to priority 1.5.
Now also extracts issue number from PR title (#NNN) as fallback.
2026-03-14 11:12:27 +00:00
openhands
7fd913596b fix: write_state_entry defined after call site — crashes dev-agent
Function was defined at line 867 but called at line 550. Bash requires
functions to be defined before invocation. Moved to top with other
helpers. Also removed duplicate definition.
2026-03-14 11:01:05 +00:00
openhands
c3f24460a7 fix: gardener must ACTION or ESCALATE every tech-debt issue, never skip
Claude was silently skipping ambiguous issues instead of escalating.
Made output format mandatory and explicit: every issue in the list
must result in ACTION (promoted) or ESCALATE (needs decision).
2026-03-14 08:40:19 +00:00
openhands
0f979fd6c9 fix: stuck PRs priority + STATE.md in first commit + 405 bug in dev-poll
1. PRIORITY 1.5 in dev-poll: scan ALL open PRs for REQUEST_CHANGES or CI
   failure before picking new backlog issues. Stuck PRs get fixed first
   to avoid complex rebases piling up.

2. STATE.md written in worktree before claude starts (included in first
   commit, not a separate push that dismisses stale approvals).

3. Removed HTTP 405 from merge success check in dev-poll.sh (was fixed
   in dev-agent.sh but not here — 2 occurrences).
2026-03-14 07:34:47 +00:00
openhands
793dafdb8a fix: gardener uses curl+CODEBERG_TOKEN instead of codeberg_api function
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.
2026-03-13 22:35:30 +00:00
openhands
a6dea87de0 factory: learned — keccak-derived FEE_DEST requires anvil_setBalance before impersonation 2026-03-13 22:34:44 +00:00
openhands
d137862813 fix: gardener tech-debt promotion not surfaced as problem
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.
2026-03-13 20:50:16 +00:00
openhands
2f14d12032 factory: learned — False Positive: Status Unchanged Alert 2026-03-13 20:21:54 +00:00
openhands
8e3b72d13f feat: dev-agent auto-rebase before merge
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.
2026-03-13 19:56:12 +00:00
openhands
0132c7acc4 fix: 405 treated as merge success + STATE.md push dismissed approvals
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
2026-03-13 17:41:10 +00:00
openhands
f7531d6ee9 Revert "lesson: fork safety — ERC-4337 code, impersonation, chain addresses, docker perms"
This reverts commit 0d0838bea0.
2026-03-13 16:16:47 +00:00
openhands
0d0838bea0 lesson: fork safety — ERC-4337 code, impersonation, chain addresses, docker perms 2026-03-13 16:13:01 +00:00
openhands
4362f58a16 factory: learned — FEE_DEST address must match DeployLocal.sol 2026-03-13 15:53:45 +00:00
openhands
36fe3c8575 lesson: dep resolution — trust closed state, don't hunt for PRs 2026-03-13 11:26:52 +00:00
openhands
98210cc302 fix: dep check — trust closed state, drop merged-PR search
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.
2026-03-13 11:25:35 +00:00
openhands
d61dead3f1 fix: dep check fallback — also check PR with same number as issue
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.
2026-03-13 11:24:14 +00:00
openhands
b8097f1144 fix: gitignore *.log.old, *.log.*, escalations.jsonl 2026-03-13 10:43:37 +00:00
openhands
499f6d8828 feat: STATE.md append before merge, lives in harb repo
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.
2026-03-13 10:27:10 +00:00
openhands
f10e0a1545 state: seed with current reality snapshot 2026-03-13 10:25:23 +00:00
openhands
ed58874890 feat: STATE.md append on merge (dark-factory#5)
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.
2026-03-13 10:25:00 +00:00
openhands
cdbe668b0d security: gardener uses codeberg_api helper, never exposes tokens
Prompt now references codeberg_api function instead of raw curl+token.
Explicit instruction to never echo/log credentials.
2026-03-13 09:33:38 +00:00
openhands
4ce16f30dc feat: gardener primary mission — promote tech-debt to actionable backlog
Reads source files + repo docs to understand each issue, adds
acceptance criteria + affected files + deps, relabels backlog.
Max 10 per run. Escalates ambiguous scope with options.
2026-03-13 09:32:39 +00:00
openhands
4f34e2dd01 fix: gardener reads repo docs (PRODUCT-TRUTH, ARCHITECTURE, AGENTS) before making decisions 2026-03-13 09:30:49 +00:00
openhands
d9de5b3708 fix: gardener dupe detection — strip series prefixes (LLM seed, Push3 evolution) 2026-03-13 09:22:44 +00:00
openhands
174187f6a6 feat: issue gardener — daily backlog grooming agent
Bash pre-checks (zero tokens): duplicate titles, thin issues, stale
issues, missing deps. Then claude -p for analysis and action.

Escalates decisions in compact format:
  1. #123 "title" — reason (a) opt1 (b) opt2 (c) opt3

Cron: daily 07:00 UTC. Light touch — grooms, doesn't invent work.
2026-03-13 09:17:09 +00:00
openhands
64b464b01b feat: dev-agent → supervisor escalation via escalations.jsonl
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.
2026-03-13 06:51:53 +00:00
openhands
6abe24f3a5 docs: PR #608 post-mortem — staleness detection lessons 2026-03-13 06:47:07 +00:00
openhands
2262fcaab1 docs: supervisor owns merge-conflict rebases 2026-03-13 06:37:35 +00:00
openhands
2778fa4ea5 fix: detect merge conflicts in approved PRs
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.
2026-03-13 06:36:23 +00:00
openhands
00dc3a6195 fix: don't revert files during evolution runs
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.
2026-03-12 20:08:38 +00:00
openhands
4895ad1989 refactor: ci-debug to lib, rewrite README
- 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
2026-03-12 18:10:25 +00:00
openhands
04e80ee391 feat: factory stall detection + Codeberg rate-limit best practices
- New P2 check: backlog exists + no agent ran in 20min = stalled
- best-practices/codeberg.md: rate limiting awareness, retrigger cooldown
- PROMPT.md: added codeberg best-practices reference
2026-03-12 18:06:08 +00:00
openhands
56cf332575 docs: moved roadmap to Codeberg issues #1-#4 2026-03-12 13:21:02 +00:00
openhands
f89b0611ab docs: factory roadmap — resource management, self-tuning, multi-repo, multi-VPS 2026-03-12 13:18:47 +00:00
openhands
d48b0f17ac fix: swap threshold — only P0 if swap >3GB AND avail <2GB
High swap with healthy available RAM is normal (dockerd pages out).
Only alert when both swap is high and available RAM is low.
2026-03-12 13:16:24 +00:00
openhands
19ef44f5b9 feat: review-agent best practices + credential access in prompt 2026-03-12 13:09:55 +00:00
openhands
5eb17020d5 feat: progressive disclosure + escalate everything to claude
- 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
2026-03-12 13:04:50 +00:00
openhands
cb7dd398c7 feat: factory supervisor with priorities, auto-fix, and claude -p escalation
- P0: memory crisis (auto-kill stale claude, drop caches, restart Anvil)
- P1: disk pressure (docker prune, log truncate, worktree cleanup, WP log trim)
- P2: factory stopped (CI stuck, dev-agent dead, git broken — auto-fix where possible)
- P3: factory degraded (derailed PRs, auto-trigger reviews)
- P4: housekeeping (stale processes, log rotation)

Calls claude -p only for P0/P1 issues that auto-fix couldn't resolve.
PROMPT.md contains distilled operational knowledge + self-update mechanism.
2026-03-12 13:00:17 +00:00
openhands
cb24968d9b feat: dark factory — autonomous CI/CD agents for harb
Three agents extracted from ~/scripts/harb-{dev,review}/:

- dev/ — pull-based dev agent (find ready issues → implement → PR → merge)
- review/ — AI code review (structured verdicts, follow-up issues)
- factory/ — supervisor (bash health checks, auto-fix, escalation)

All secrets externalized to .env (see .env.example).
Shared env/helpers in lib/env.sh.
2026-03-12 12:44:15 +00:00