fix: call resolve_forge_remote before formula_worktree_setup in supervisor-run.sh (implements #1120) #1121

Open
opened 2026-04-21 13:10:00 +00:00 by dev-bot · 2 comments
Collaborator

Implements the fix for #1120.

Change

In supervisor/supervisor-run.sh, before the formula_worktree_setup "$WORKTREE" call (currently near line ~90, right after build_sdk_prompt_footer), add:

resolve_forge_remote

Rationale and full diagnosis in issue 1120.

Alternative (preferred per the bug analysis)

Make formula_worktree_setup in lib/formula-session.sh self-heal: if FORGE_REMOTE is unset, call resolve_forge_remote before using it. This eliminates the class of bug (silent-abort when a caller forgets the precondition) rather than patching one caller.

Prefer the library fix unless it breaks another caller — every current caller of formula_worktree_setup either already calls resolve_forge_remote or should. Please verify by grepping formula_worktree_setup usage before landing.

Acceptance

See issue 1120, "Acceptance" section. Summary:

  • Supervisor log shows full start→done cycle every 20 min.
  • Stderr sink data/logs/supervisor.log stays clean.
  • Add a regression test or a shellcheck-style assertion if the library-fix path is taken.

Prior art (attempt 1 — PR #1143, closed)

PR #1143 on branch fix/issue-1121-1 implemented the library self-heal path plus a regression test tests/smoke-formula-worktree-self-heal.sh. All functional CI green (smoke-init, edge-subpath, push/ci), but ci/woodpecker/pr/ci step duplicate-detection failed.

Why blocked

.woodpecker/detect-duplicates.py flagged a 5-line window shared between the new test and tests/smoke-credentials.sh:

set -euo pipefail
FACTORY_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
FAILED=0
fail() { printf 'FAIL: %s\n' "$*" >&2; FAILED=1; }
pass() { printf 'PASS: %s\n' "$*"; }

Detector's meaningful_lines() skips blank/comment lines, so comment-only separators will not break the window. The agent exhausted CI retry budget on this noise gate (not a real defect — functional smoke tests pass).

Suggested fixes (pick one)

  1. Reorder the new test — move the existing cleanup() + trap cleanup EXIT block between FACTORY_ROOT=... and FAILED=0. Breaks the 5-meaningful-line window; no semantic change. Smallest diff.
  2. Extract tests/lib/common.sh (preferred long-term) — shared set/FACTORY_ROOT/fail/pass harness; source from both smoke tests. Cleaner but touches smoke-credentials.sh too.
  3. Tune detector — add tests/ to a skip list in .woodpecker/detect-duplicates.py, or bump DUP_WINDOW for that path. Lowest-risk if more test-boilerplate duplicates are expected.

Branch fix/issue-1121-1 retained — rebase or cherry-pick the implementation from it.

Implements the fix for #1120. ## Change In `supervisor/supervisor-run.sh`, before the `formula_worktree_setup "$WORKTREE"` call (currently near line ~90, right after `build_sdk_prompt_footer`), add: ```bash resolve_forge_remote ``` Rationale and full diagnosis in issue 1120. ## Alternative (preferred per the bug analysis) Make `formula_worktree_setup` in `lib/formula-session.sh` self-heal: if `FORGE_REMOTE` is unset, call `resolve_forge_remote` before using it. This eliminates the class of bug (silent-abort when a caller forgets the precondition) rather than patching one caller. Prefer the library fix unless it breaks another caller — every current caller of `formula_worktree_setup` either already calls `resolve_forge_remote` or should. Please verify by grepping `formula_worktree_setup` usage before landing. ## Acceptance See issue 1120, "Acceptance" section. Summary: - Supervisor log shows full start→done cycle every 20 min. - Stderr sink `data/logs/supervisor.log` stays clean. - Add a regression test or a shellcheck-style assertion if the library-fix path is taken. --- ## Prior art (attempt 1 — PR #1143, closed) PR #1143 on branch `fix/issue-1121-1` implemented the library self-heal path plus a regression test `tests/smoke-formula-worktree-self-heal.sh`. All functional CI green (`smoke-init`, `edge-subpath`, `push/ci`), but `ci/woodpecker/pr/ci` step `duplicate-detection` failed. ### Why blocked `.woodpecker/detect-duplicates.py` flagged a 5-line window shared between the new test and `tests/smoke-credentials.sh`: ``` set -euo pipefail FACTORY_ROOT="$(cd "$(dirname "$0")/.." && pwd)" FAILED=0 fail() { printf 'FAIL: %s\n' "$*" >&2; FAILED=1; } pass() { printf 'PASS: %s\n' "$*"; } ``` Detector's `meaningful_lines()` skips blank/comment lines, so comment-only separators will not break the window. The agent exhausted CI retry budget on this noise gate (not a real defect — functional smoke tests pass). ### Suggested fixes (pick one) 1. **Reorder the new test** — move the existing `cleanup()` + `trap cleanup EXIT` block between `FACTORY_ROOT=...` and `FAILED=0`. Breaks the 5-meaningful-line window; no semantic change. Smallest diff. 2. **Extract `tests/lib/common.sh`** (preferred long-term) — shared `set/FACTORY_ROOT/fail/pass` harness; source from both smoke tests. Cleaner but touches `smoke-credentials.sh` too. 3. **Tune detector** — add `tests/` to a skip list in `.woodpecker/detect-duplicates.py`, or bump `DUP_WINDOW` for that path. Lowest-risk if more test-boilerplate duplicates are expected. Branch `fix/issue-1121-1` retained — rebase or cherry-pick the implementation from it.
dev-bot added the
backlog
label 2026-04-21 13:10:00 +00:00
dev-bot self-assigned this 2026-04-21 14:05:57 +00:00
dev-bot added
in-progress
and removed
backlog
labels 2026-04-21 14:05:58 +00:00
Author
Collaborator

Blocked — issue #1121

Field Value
Exit reason ci_timeout
Timestamp 2026-04-21T14:37:48Z
### Blocked — issue #1121 | Field | Value | |---|---| | Exit reason | `ci_timeout` | | Timestamp | `2026-04-21T14:37:48Z` |
dev-bot added
blocked
and removed
in-progress
labels 2026-04-21 14:37:49 +00:00
disinto-admin added
backlog
and removed
blocked
labels 2026-04-21 15:11:27 +00:00
dev-bot was unassigned by disinto-admin 2026-04-21 15:11:28 +00:00
dev-qwen2 self-assigned this 2026-04-21 17:04:50 +00:00
dev-qwen2 added
in-progress
and removed
backlog
labels 2026-04-21 17:04:50 +00:00
Collaborator

Blocked — issue #1121

Field Value
Exit reason ci_exhausted
Timestamp 2026-04-21T17:47:43Z
### Blocked — issue #1121 | Field | Value | |---|---| | Exit reason | `ci_exhausted` | | Timestamp | `2026-04-21T17:47:43Z` |
dev-qwen2 added
blocked
and removed
in-progress
labels 2026-04-21 17:47:43 +00:00
dev-bot removed the
blocked
label 2026-04-21 18:47:49 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: disinto-admin/disinto#1121
No description provided.