Commit graph

169 commits

Author SHA1 Message Date
openhands
f716a75351 fix: Preserve worktrees on crash for debugging (#726)
On crash (PHASE:crashed or non-zero exit), preserve the worktree and log
its location instead of destroying it unconditionally. Successful sessions
still clean up normally. Supervisor runs housekeeping to remove stale
crashed worktrees older than 24h.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 13:41:33 +00:00
openhands
af39b833af fix: Session lock must not block during idle phases (awaiting_review/awaiting_ci) (#724)
Restructure session.lock from command-wrapper flock to fd-based flock so
the lock can be released when Claude is idle and re-acquired before
injecting the next prompt.

- agent-session.sh: add session_lock_acquire/release helpers, open fd in
  create_agent_session instead of wrapping claude with flock, auto-acquire
  in agent_inject_into_session before injecting
- phase-handler.sh: call session_lock_release at start of awaiting_ci and
  awaiting_review handlers (Claude is idle during CI polling / review wait)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 10:11:50 +00:00
openhands
ec5de7d2e0 chore: gardener housekeeping 2026-03-26 2026-03-26 06:06:51 +00:00
Gardener
99933bef7b chore: gardener housekeeping 2026-03-26 2026-03-26 00:05:34 +00:00
openhands
86c8ef4720 fix: feat: kill prediction/backlog — planner must act or dismiss, with action budget (#686)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 17:16:13 +00:00
openhands
8a912ec87e chore: gardener housekeeping 2026-03-25 2026-03-25 12:07:39 +00:00
johba
47fd876813 Merge pull request 'chore: gardener housekeeping' (#654) from chore/gardener-20260325-0606 into main 2026-03-25 08:04:07 +01:00
openhands
ac5448323b fix: dev-agent worktree pushes to origin (Codeberg) instead of forgejo (local) — PR creation fails (#653)
Detect which git remote matches FORGE_URL by comparing the host portion
of FORGE_URL against remote push URLs.  Store the result in FORGE_REMOTE
(defaults to "origin" when no match — preserving existing behavior for
Codeberg-direct setups).

Replace every hardcoded "origin" in fetch, push, worktree-add, and
prompt-injection commands across:
- dev/dev-agent.sh (worktree setup, phase protocol prompt)
- dev/phase-handler.sh (CI retrigger, review feedback, rebase instructions)
- review/review-poll.sh (review feedback injection)
- action/action-agent.sh (worktree setup, push instructions)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 06:17:34 +00:00
openhands
40093e92e2 chore: gardener housekeeping 2026-03-25 2026-03-25 06:06:48 +00:00
openhands
b8dc01b06f chore: gardener housekeeping 2026-03-25 2026-03-25 00:07:52 +00:00
openhands
a5cbd30bb6 fix: stale phase file poisons recovery — clear before respawn (#628)
- Clear phase file after reading it in recovery mode so new sessions
  start clean instead of inheriting stale state
- When last phase was escalate, tell Claude "previous session escalated —
  starting fresh" instead of "resume from escalate" to prevent re-escalation
- Add explicit "PR already exists — do NOT create a new PR" instructions
  to recovery prompt to prevent Claude from calling forge API directly

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 20:56:41 +00:00
openhands
32c336f3df fix: escalation notifications should @mention human on Matrix (#624)
Add MATRIX_MENTION_USER config to project TOML and include a Matrix
mention pill in escalation notify_ctx calls so humans get notified
even in muted rooms.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 19:21:46 +00:00
openhands
e535ed776f fix: feat: active-state files — per-cron guard with self-off semantics (#622)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 21:46:59 +00:00
openhands
7bc74caa63 fix: Push to public mirrors after merge (#614)
Add fire-and-forget mirror push support so merges to the primary branch
are automatically pushed to configured public mirrors (GitHub, Codeberg,
etc.). Mirror failures are logged but never block the pipeline.

- lib/mirrors.sh: new shared mirror_push() helper
- lib/load-project.sh: parse [mirrors] TOML section into MIRROR_* env vars
- dev/phase-handler.sh: call mirror_push after do_merge() success
- dev/dev-poll.sh: call mirror_push after try_direct_merge() success
- gardener/gardener-run.sh: call mirror_push after _gardener_merge() success
- bin/disinto: set up mirror remotes during init, add commented mirrors to
  generated TOML
- projects/*.toml.example: show [mirrors] section (commented out)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 19:19:16 +00:00
openhands
d9427ebe78 chore: gardener housekeeping 2026-03-23 2026-03-23 18:05:26 +00:00
openhands
50dff34b89 fix: Wire Woodpecker CI to local Forgejo (#612)
Add ci_commit_status() and ci_pipeline_number() helpers to
lib/ci-helpers.sh that query Woodpecker directly with a forge API
fallback. Replace all 12 inline forge commit status calls across 6
files with the new helpers.

Add setup_woodpecker() to bin/disinto init that creates a Forgejo
OAuth2 app for Woodpecker and activates the repo.

Document manual Woodpecker+Forgejo setup in BOOTSTRAP.md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 17:19:01 +00:00
openhands
a66bd91721 fix: Replace Codeberg dependency with local Forgejo instance (#611)
- Add setup_forge() to bin/disinto: provisions Forgejo via Docker,
  creates admin + bot users (dev-bot, review-bot), generates API
  tokens, creates repo, and pushes code — all automated
- Rename env vars: CODEBERG_TOKEN→FORGE_TOKEN, REVIEW_BOT_TOKEN→
  FORGE_REVIEW_TOKEN, CODEBERG_REPO→FORGE_REPO, CODEBERG_API→
  FORGE_API, CODEBERG_WEB→FORGE_WEB, CODEBERG_BOT_USERNAMES→
  FORGE_BOT_USERNAMES (with backwards-compat fallbacks)
- Rename API helpers: codeberg_api()→forge_api(), codeberg_api_all()
  →forge_api_all() (with compat aliases)
- Add forge_url field to project TOML; load-project.sh derives
  FORGE_API/FORGE_WEB from forge_url + repo
- Update parse_repo_slug() to accept any host URL, not just codeberg
- Forgejo data stored under ~/.disinto/forgejo/ (not in factory repo)
- Update all 58 files: agent scripts, formulas, docs, site HTML

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 16:57:12 +00:00
openhands
0775514bf8 chore: gardener housekeeping 2026-03-23 2026-03-23 12:47:32 +00:00
openhands
38f4b385cc chore: gardener housekeeping 2026-03-23
- Update all AGENTS.md watermarks to f6fb79d (current HEAD)
- lib/AGENTS.md: document nudge behavior in agent-session.sh stop hook
- pending-actions.json: enrich #598 body + promote to backlog
2026-03-23 12:08:26 +00:00
openhands
13f62390a7 fix: Duplicate read_phase definition in phase-test.sh (#179)
Source the canonical read_phase() from lib/agent-session.sh instead of
maintaining a local copy that could drift.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 08:30:13 +00:00
openhands
06cddb456d fix: investigate: PreToolUse guard blocks do_merge() in dev-agent — every disinto PR escalates on merge (#568)
Root cause: two code paths injected merge curl commands into Claude's
session (review-poll.sh APPROVE injection and dev-agent.sh prompt
instructions). The PreToolUse guard correctly blocked these, causing
Claude to write PHASE:escalate instead of merging.

The bash phase handler already handles merging via do_merge() — which
runs outside Claude tool use and is not subject to the guard. Remove
the merge/close curl instructions from both Claude-facing prompts so
the bash orchestrator handles merges as intended.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 07:24:04 +00:00
openhands
d8cf0a39bc fix: restore closing --> on AGENTS.md watermark HTML comments
The sed watermark-update pattern stripped the closing --> from 9 of 10
AGENTS.md files, making entire file bodies invisible in rendered markdown.
Fix by appending --> to the affected lines.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 06:09:19 +00:00
openhands
30cc5688bd chore: gardener housekeeping 2026-03-23
- Update AGENTS.md watermarks to current HEAD (9ec0c02)
- lib/AGENTS.md: document parse-deps.sh inline scan now skips fenced
  code blocks to prevent false positives from code examples in issue bodies
- No blocked issues to review
- Pending actions: none

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 06:03:14 +00:00
openhands
d2db178d30 chore: gardener housekeeping 2026-03-23
- Update AGENTS.md watermarks to current HEAD (e8df73e)
- No code changes since last gardener run — watermark-only refresh
- No blocked issues to review
- Pending actions: none

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 00:47:57 +00:00
openhands
149211c78d chore: gardener housekeeping 2026-03-23
- dev/AGENTS.md: document two-tier priority queue (priority+backlog first,
  then plain backlog); note do_merge() HTTP 405 already-merged detection
- gardener/AGENTS.md: document merge-through protocol (stay alive through
  CI/review/merge); note session kill on PHASE:escalate
- lib/AGENTS.md: add ensure_priority_label() to ci-helpers.sh entry;
  document optional CALLBACK param in run_formula_and_monitor()
- predictor/AGENTS.md: update watermark (content already current from v2 PR)
- Update watermarks for action, planner, review, supervisor, vault, root

Grooming actions:
- #574: added ## Affected files section (lib/parse-deps.sh) to meet quality gate
- #568: escalated — needs human decision on guard/merge architecture
- #466: escalated — dep #393 closed; needs decision on external vs in-repo example

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 00:23:02 +00:00
openhands
604d1f13ca fix: feat: dev-poll checks priority-labeled issues before plain backlog (#555)
Add two-tier backlog pickup in dev-poll.sh:
1. in-progress issues (existing)
2. priority + backlog issues (FIFO within tier)
3. plain backlog issues (FIFO within tier)

The priority label coexists with backlog (not a replacement).
ensure_priority_label() auto-creates the label if missing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 13:41:57 +00:00
openhands
d67b79d3ad fix: fix: dev-agent escalates when dev-poll races it to merge — should detect already-merged PR (#548)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 12:24:58 +00:00
openhands
f37546c6fc chore: gardener housekeeping 2026-03-22
- Update all AGENTS.md watermarks to current HEAD (251d160)
- dev/AGENTS.md: document dev-poll's early direct-merge scan (before lock
  check) — approved PRs now merge without waiting for active dev sessions;
  chore/gardener PRs merge without issue numbers in branch name
- planner/AGENTS.md: document dispatch-idle-formulas phase (step 4); note
  that planner reads both factory and project-specific formulas; clarify
  that all planner artifacts use $PROJECT_REPO_ROOT, not $FACTORY_ROOT

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 12:07:31 +00:00
openhands
ea4c55dbbf chore: gardener housekeeping 2026-03-22 2026-03-22 10:43:58 +01:00
openhands
7f2c5efd9d fix: fix: dev-poll pre-lock should merge chore/gardener PRs without issue numbers (#539)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 09:12:04 +00:00
openhands
00b20b5a67 fix: break duplicate-detection false positive in pre-lock section
Add log statement between pre-lock merge exit and lock check to break
a coincidental 5-line sliding-window match with dev-agent.sh.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 06:52:39 +00:00
openhands
236e19eae1 fix: dev-poll should attempt direct merges before checking agent lock (#531)
Move the direct-merge scan (approved + CI green → try_direct_merge())
above the lock check. Merging an approved PR is a single API call that
doesn't need the dev-agent lock or a Claude session. This ensures
approved PRs get merged even while a dev-agent is running on an
unrelated issue.

The lock still guards dev-agent spawning (AD-002 preserved). Direct
merge failures fall through to the post-lock code for dev-agent
fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 06:46:26 +00:00
openhands
5822dc89d9 fix: feat: unified escalation — single PHASE:escalate path for all agents (#510)
Replace PHASE:needs_human with PHASE:escalate across all agent types.
Consolidates 6 overlapping escalation mechanisms into one unified path:
detect → notify via Matrix → session stays alive → human reply injected → resume.

Key changes:
- PHASE:escalate replaces PHASE:needs_human everywhere (16 files)
- CI exhausted now escalates instead of immediately marking blocked
- Matrix listener routes free-text replies to vault tmux sessions
- Vault agent writes PHASE:escalate files for procurement requests
- Supervisor monitors PHASE:escalate sessions in health checks
- 24h timeout on escalation → blocked label + session killed
- All 38 phase protocol tests updated and passing

Supersedes #462, #458, #465.
2026-03-21 19:39:04 +00:00
openhands
b4f1666a80 chore: gardener housekeeping 2026-03-21 2026-03-21 18:07:37 +00:00
openhands
694936e663 fix: dev/phase-handler.sh still has divergent infra heuristics (#427)
Replace inline case git*/128/137 heuristics in phase-handler.sh with a
call to the shared is_infra_step() helper from lib/ci-helpers.sh.
This eliminates the divergence between phase-handler.sh and
classify_pipeline_failure(), ensuring a single source of truth for
CI infra failure classification.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 16:50:15 +00:00
openhands
1cd1b09041 fix: dev-agent.sh uses hardcoded bot usernames instead of dynamic resolution (#425)
Replace hardcoded Disinto_bot/disinto-factory filter with dynamic /user
API resolution + CODEBERG_BOT_USERNAMES env var fallback, matching the
pattern established in action-agent.sh by PR #424.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 16:35:00 +00:00
openhands
ac13bf110c fix: Status file is not per-project in multi-project setups (#423)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 16:20:07 +00:00
openhands
a9b8144401 fix: bundled dust cleanup — AGENTS.md (#420)
- Add phase-handler.sh to dev Key files (#332)
- Document ci_required_for_pr() in ci-helpers.sh (#347)
- Update planner trigger: weekly → daily, note optional project arg (#416)
- Add dev-agent.sh, action-agent.sh to formula-session.sh sourced-by (#418)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 16:02:29 +00:00
openhands
8b293331b6 fix: phase-handler.sh FAILURE_REASON fallback does not handle missing phase file (#410)
The sed pipeline `sed -n 2p "$PHASE_FILE" 2>/dev/null | sed "s/^Reason: //"` exits 0
even when $PHASE_FILE does not exist because the second sed reads empty stdin and
succeeds, leaving FAILURE_REASON as "" instead of "unspecified".

Replace with an explicit file-existence check and use ${FAILURE_REASON:-unspecified}
as the default assignment.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:00:01 +00:00
johba
631563e58a Merge pull request 'chore: gardener housekeeping 2026-03-21' (#498) from chore/gardener-20260321-1433 into main 2026-03-21 15:41:26 +01:00
openhands
24cf01028a chore: gardener housekeeping 2026-03-21
- Update AGENTS.md watermarks (all 10 files) to HEAD 038581e5
- Content already current from recent gardener migration and setup PRs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 14:33:26 +00:00
openhands
962f26b24d fix: Stale ${PROJECT_NAME:-harb} fallbacks in agent scripts (#400)
Replace all harb-specific fallbacks with generic 'default' sentinel
in dev-agent.sh, dev-poll.sh, action-agent.sh, and action-poll.sh.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 14:25:13 +00:00
openhands
b630c6fcc1 fix: gardener migration — run-gardener.toml via direct cron, remove legacy scripts (#490)
Rewrite gardener-run.sh as direct cron runner (matching supervisor/planner/
predictor pattern): lock guard, memory check, worktree, tmux session with
Claude sonnet + formulas/run-gardener.toml, phase monitoring, cleanup.

- Delete gardener-poll.sh and gardener-agent.sh (superseded)
- Extract consume_escalation_reply() to lib/formula-session.sh (shared
  by gardener and supervisor, eliminates duplicate blocks)
- Update AGENTS.md, gardener/AGENTS.md, lib/AGENTS.md, CI smoke test,
  and cross-references

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 13:09:17 +00:00
openhands
f480cbe5d0 chore: gardener housekeeping 2026-03-21
Progressive disclosure split of AGENTS.md (487→152 lines):
- Extracted per-directory AGENTS.md files for all 8 agents + lib/
- Root AGENTS.md now serves as a table of contents with summary table
- All watermarks updated to 16e430e

Grooming results:
- Promoted #469 (WATCH flow missing curl) and #436 (idle_pane_count bug) to backlog
- 12 dust items classified, no groups ripe for bundling yet
- No blocked issues, no AD violations
2026-03-21 12:44:23 +00:00
openhands
85fffd9fb7 fix: CI fix counter can be wasted by guard hits — consider check_only mode (#377)
Orphan and stuck-PR CI-failure paths in dev-poll.sh called
handle_ci_exhaustion without check_only, incrementing the fix counter on
every poll cycle even when guards (session checks, is_blocked) prevented
an actual agent launch. This could exhaust the 3-attempt budget without
any real fix attempts.

Now both paths use the same two-phase pattern as the backlog scan:
1. check_only during the scan (no counter increment)
2. Increment atomically at actual launch time

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 11:22:07 +00:00
openhands
21489c1a17 fix: phase-handler.sh DELETE backlog label uses string 'backlog' not numeric ID (#375)
Replace string 'backlog' with $BACKLOG_LABEL_ID in the DELETE label API call
at dev-agent.sh:370. The Gitea API expects a numeric label ID in that path
segment. The variable is already resolved at the top of the script (line 46-48)
and used correctly elsewhere.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 10:59:46 +00:00
openhands
0b453fdab0 fix: fix: action formulas must not contain secrets in issue body (#291)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 09:54:21 +00:00
openhands
33a92c3fee fix: feat: stream dev-agent Claude output to Matrix thread (extend #293 to dev-agent) (#355)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 08:11:45 +00:00
openhands
02f483ff71 fix: matrix_listener.sh drops dev/review injections — PROJECT_NAME is unset (#354)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 07:38:39 +00:00
openhands
d29c6ad1c9 fix: dev-poll.sh: redundant manual state exclusions alongside ci_passed (#113)
Add ci_failed() helper to lib/ci-helpers.sh and replace three compound
`! ci_passed && CI_STATE != "" && != "pending" && != "unknown"` patterns
in dev/dev-poll.sh with the cleaner ci_failed() call.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 06:10:39 +00:00