Skip to content

fix(chain): add issues:write + fix var-less skill discovery in chain-runner#553

Merged
aaronjmars merged 1 commit into
mainfrom
fix/chain-runner-issues-write-and-discovery
Jun 25, 2026
Merged

fix(chain): add issues:write + fix var-less skill discovery in chain-runner#553
aaronjmars merged 1 commit into
mainfrom
fix/chain-runner-issues-write-and-discovery

Conversation

@aaronjmars

Copy link
Copy Markdown
Owner

What

Two bugs on the chain path that the fork canary surfaced. Chains are unused on prod today (0 defined), so these were latent — but both are real and would bite the first time a chain runs.

1. Missing issues: write

The §3 issues-as-state append (wired into chain-runner.yml by #548/#550) calls the Issues API via state_store.sh ensure/comment. The workflow only had contents: write + actions: write, so the append 403'd — chain run-events never reached the ledger Issue. Dual mode masked this (the file path still recorded the event), but in issues mode the chain events would be lost from the ledger entirely.

2. Var-less skill discovery regex

dispatch_skill() polls for the sub-run it launched with test("skill: ${skill}("). The literal ( is an unterminated regex group — jq throws Regex failure: end pattern with unmatched parenthesis — and it only "works" by accident when a skill has a var (skill: digest (AI agents)). Var-less steps (skill: heartbeat) never matched, so discovery timed out and the chain aborted at step 1. Fixed to test("skill: ${skill}( |$)") — matches name-then-space (var present) or name-then-end (no var). Confirmed it still rejects near-misses like skill: heartbeat2.

Verified end-to-end on a fork (aaronjmars/aeontmp)

A 2-step heartbeat chain (canary-chain) now completes green:

  • both heartbeat sub-runs discovered + awaited (fix 2),
  • chain state appended to issue #4 (backend=dual) succeeds (fix 1),
  • Chain 'canary-chain' completed successfully.

(Before the fixes: same chain aborted at step 1, and the §3 append logged Issues-as-state append failed.)

🤖 Generated with Claude Code

…runner

Two bugs the fork canary surfaced on the chain path (chains are unused on prod
today, so these were latent):

1. Missing `issues: write` — the §3 issues-as-state append (added in #548/#550)
   calls the Issues API via state_store.sh. chain-runner only had contents+actions
   write, so the append 403'd: chain run-events never reached the ledger Issue
   (dual mode masked it via the file path; `issues` mode would have lost them).

2. Sub-run discovery regex `test("skill: ${skill}(")` — the literal '(' is an
   unterminated regex group (jq throws "end pattern with unmatched parenthesis")
   and only appears in run titles when a skill has a var ("skill: digest (x)").
   Var-less steps ("skill: heartbeat") never matched, so dispatch_skill timed out
   and the chain aborted at step 1. Fixed to `test("skill: ${skill}( |$)")` —
   matches name-then-space (var) or name-then-end (no var).

Verified end-to-end on a fork: a 2-step heartbeat chain now completes green —
both sub-runs discovered + awaited, and "chain state appended to issue #N
(backend=dual)" succeeds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@aaronjmars aaronjmars merged commit ec6a98a into main Jun 25, 2026
1 check passed
@aaronjmars aaronjmars deleted the fix/chain-runner-issues-write-and-discovery branch June 25, 2026 19:44
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.

1 participant