Skip to content

Fix #94: resolve claude-worker-loop.sh from the lib dir, not repo_root - #96

Merged
laird merged 1 commit into
masterfrom
feature/issue-94
Aug 8, 2026
Merged

Fix #94: resolve claude-worker-loop.sh from the lib dir, not repo_root#96
laird merged 1 commit into
masterfrom
feature/issue-94

Conversation

@laird

@laird laird commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Closes #94

Root Cause

restart-worker.sh killed the hung worker but never relaunched it, leaving the pane at a bare shell — while still printing ✅ Worker restarted.

Callers derive AGENTS_REPO_ROOT as SCRIPT_DIR/../../.., which is only correct for a repo checkout. An installed plugin lives at cache/plugin-marketplace/autocoder/<version>/scripts, so that walk lands on the cache root; appending plugins/autocoder/scripts/claude-worker-loop.sh produces exactly the hybrid path in the report — real in neither the cache nor the marketplace layout.

Solution

claude-worker-loop.sh always ships beside worker-launch-lib.sh, so resolve it from the lib's own directory instead of from repo_root.

Changes Made

  • worker-launch-lib.sh — resolve the loop script via WORKER_LAUNCH_LIB_DIR (the lib's own dir). Fail loudly with a non-zero return if it is missing, rather than emitting an unusable path.
  • restart-worker.sh — after sending WORKER_CMD, capture the pane and exit non-zero if it reports No such file or directory / command not found. A killed-but-not-restarted worker can no longer be reported as success.
  • tests/test_worker_launch_lib.sh — assert the emitted loop path exists on disk when repo_root does not follow the checkout layout, and that it is not derived from repo_root.

Verification

  • Test written first and confirmed red against the pre-fix code, failing with the exact reported path shape:
    .../not-a-repo-checkout/plugins/autocoder/scripts/claude-worker-loop.sh
  • Green after the fix.
  • 17/17 shell unit tests pass; bash -n plugins/autocoder/scripts/*.sh and py_compile clean.

Note on scope

Only claude-worker-loop.sh is repointed. The codex/droid loops legitimately live under the repo-level scripts/ dir, not beside this lib, so their repo_root derivation is left unchanged.

Unrelated observation (already tracked)

On origin/master the regression harness reports ✅ All tests passed while running 0/0 unit tests ("No unit test command configured — skipping") — the failure class #73/#85 address. Those fixes are still stuck behind the blocked #74 stack, so this PR was gated on the unit tests directly rather than on that harness.

🤖 Generated with Claude Code

restart-worker.sh killed the hung worker but never relaunched it, leaving the
pane at a bare shell while still printing "✅ Worker restarted".

Root cause: callers derive AGENTS_REPO_ROOT as SCRIPT_DIR/../../.., which is
only correct for a repo checkout. An installed plugin lives at
cache/plugin-marketplace/autocoder/<version>/scripts, so that walk lands on the
cache root; appending plugins/autocoder/scripts/claude-worker-loop.sh yields the
hybrid path from the report — real in neither the cache nor marketplace layout.

Changes:
- worker-launch-lib.sh: resolve the loop script from the lib's own directory
  (WORKER_LAUNCH_LIB_DIR); both ship in the same scripts/ dir. Fail loudly with
  a non-zero return if it is missing instead of emitting an unusable path.
- restart-worker.sh: after sending WORKER_CMD, capture the pane and exit
  non-zero if it reports "No such file or directory"/"command not found", so a
  killed-but-not-restarted worker can no longer be reported as success.
- test_worker_launch_lib.sh: assert the emitted loop path EXISTS on disk when
  repo_root does not follow the checkout layout, and that it is not derived from
  repo_root. Verified red before the fix with exactly the reported path shape.

Verification: 17/17 shell unit tests pass; bash -n + py_compile clean.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@laird
laird merged commit 30bb349 into master Aug 8, 2026
4 checks passed
@laird
laird deleted the feature/issue-94 branch August 8, 2026 23:22
laird added a commit that referenced this pull request Aug 10, 2026
…ng (2026-08-02..2026-08-10)

Collapses 28 commits into one. The individual commits are not preserved:
intermediate revisions of skills/improve/SKILL.md named the internal
platform the validation loop was developed against, and squashing to the
current tree is what removes those revisions from this branch's history.
The resulting tree is byte-identical to the pre-squash HEAD (9f73851) —
this changes history, not content.

What the squashed range delivered:

  Skills
  - The validation & refinement loop skill (run/grade/fix/log to N-clean;
    scope + exercise preflight; swarm cadence; per-round report-grade
    logging; model tier guidance), renamed harden -> improve (#112).
  - Packaged the root skills/ tree into the Claude Code plugins, which had
    shipped no skills at all — `improve` and the model-config reference
    were unreachable for every Claude Code user.

  Issue backends
  - Jira search migrated to /rest/api/3/search/jql after Atlassian removed
    the v2 endpoint (#100), with ADF descriptions flattened to plain text.
  - ado-smoke-test.sh, mirroring jira-smoke-test.sh.

  Autocoder runtime
  - Ship gate: issues close only when their work reaches the ship branch (#35).
  - Claim lock held to a terminal outcome (#14).
  - Branch-claimed issues excluded from the candidate list (#48).
  - claude-worker-loop.sh resolved from the lib dir, not repo_root (#94/#96).
  - Env-var-driven model selection with startup confirmation (#110).
  - Three failing test suites resolved (#116).

  Housekeeping
  - Platform packaging drift repaired across Claude/Codex/Gemini/Droid.
  - Planning-pipeline spec, implementation plan and critical reviews.
  - Version bumps through autocoder 4.14.1 / marketplace 3.36.1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

restart-worker.sh: stale relaunch path — kills the worker but the fresh agent never starts (pane left a bare shell)

1 participant