Skip to content

fix(sdd-execute): per-item concurrency group (closes #308) - #309

Merged
norrietaylor merged 1 commit into
mainfrom
fix/execute-per-item-concurrency
Jun 22, 2026
Merged

fix(sdd-execute): per-item concurrency group (closes #308)#309
norrietaylor merged 1 commit into
mainfrom
fix/execute-per-item-concurrency

Conversation

@norrietaylor

Copy link
Copy Markdown
Owner

Closes #308.

Problem

The compiled execute lock used gh-aw's default workflow-level concurrency:

concurrency:
  group: "gh-aw-${{ github.workflow }}"   # shared across ALL same-tier execute runs

github.workflow is identical for every invocation of a tier, so all same-tier execute runs share one group. GitHub cancels a previously-pending run when a new run joins a group — so a freshly re-triggered task gets silently cancelled at its activation job when unrelated execute activity (a sibling task's PR review / /revise) queues on the same tier. The task strands: sdd:in-progress, no run, no escalation, no auto-retry — only a manual /execute re-bump recovers it.

Observed in a consumer pilot: route ✅ / ack ✅ / <tier> / activation cancelled, coincident with another same-tier run's activation window.

Fix

Override concurrency.group in each execute tier's .md frontmatter to include the resolved item number:

concurrency:
  group: "gh-aw-${{ github.workflow }}-${{ fromJSON(inputs.aw_context).item_number || github.run_id }}"

Distinct tasks get distinct groups → cross-task cancellation can no longer happen; same-task superseding is still handled by the wrapper's own per-issue group. Falls back to run_id (unique) when the context is absent, so it never over-collapses.

Scope / fidelity

  • Only the three sdd-execute-{haiku,sonnet,opus} .md + .lock.yml change; the concurrency group: line is the sole functional change.
  • Recompiled with the patched gh-aw v0.77.5; the other 10 locks and the digest snapshot are byte-identical (lint clean).

🤖 Generated with Claude Code

The compiled execute lock used gh-aw's default workflow-level concurrency
group `gh-aw-${{ github.workflow }}`, shared across every same-tier execute
run. GitHub cancels a *previously pending* run when a new run joins the same
group, so a freshly re-triggered task could be silently cancelled at its
`activation` job by unrelated execute activity on a sibling task of the same
tier — leaving it stranded (sdd:in-progress, no run, no escalation), needing a
manual /execute re-bump.

Override `concurrency.group` in each execute tier's frontmatter to include the
resolved item number, so distinct tasks never share a group; fall back to
run_id when the context is absent. Recompiled with the patched gh-aw v0.77.5;
only the three execute locks' concurrency lines change.

The wrapper already keys its own per-issue group; this aligns the called lock
so cross-task cancellation can no longer happen at either layer.

Closes #308

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ss8WXtUUr9PBHuJcJMseBj
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c91402a6-9d0c-4cb1-98e2-a81582542f1c

📥 Commits

Reviewing files that changed from the base of the PR and between aacd025 and d641900.

📒 Files selected for processing (6)
  • .github/workflows/sdd-execute-haiku.lock.yml
  • .github/workflows/sdd-execute-haiku.md
  • .github/workflows/sdd-execute-opus.lock.yml
  • .github/workflows/sdd-execute-opus.md
  • .github/workflows/sdd-execute-sonnet.lock.yml
  • .github/workflows/sdd-execute-sonnet.md

📝 Walkthrough

Summary by CodeRabbit

  • Infrastructure
    • Enhanced concurrency management across workflow execution tiers to prevent parallel runs for different items from interfering with each other.
    • Implemented per-item execution locking with fallback to run-level isolation, improving overall workflow reliability and execution independence.

Walkthrough

Three sdd-execute reusable workflow source files (haiku, opus, sonnet) each gain a concurrency block that scopes the group key to fromJSON(inputs.aw_context).item_number, falling back to github.run_id. The corresponding compiled lock files are regenerated, updating the activation job concurrency expression, rotating heredoc marker IDs throughout prompt/safe-outputs/MCP sections, and refreshing metadata hashes.

Changes

Per-item concurrency scoping across sdd-execute tiers

Layer / File(s) Summary
Concurrency block added to workflow source files
.github/workflows/sdd-execute-haiku.md, .github/workflows/sdd-execute-opus.md, .github/workflows/sdd-execute-sonnet.md
Each tier source gains a workflow-level concurrency.group expression keyed on fromJSON(inputs.aw_context).item_number with github.run_id as fallback, preventing cross-item run cancellations.
Lock file concurrency.group and metadata hash updates
.github/workflows/sdd-execute-haiku.lock.yml, .github/workflows/sdd-execute-opus.lock.yml, .github/workflows/sdd-execute-sonnet.lock.yml
All three lock files update the activation job concurrency.group expression to match the source change; gh-aw frontmatter hashes are regenerated to reflect the recompiled content.
Regenerated heredoc marker IDs in lock files
.github/workflows/sdd-execute-*.lock.yml
Prompt assembly, safe-outputs config.json, and MCP gateway heredoc boundary IDs are rotated across all three lock files with no content change to constraints or MCP config. The sonnet lock additionally adds push_to_pull_request_branch serialization to the safe-outputs config payload.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • norrietaylor/spectacles#145: Also modifies concurrency.group logic in sdd-execute workflows to prevent unintended cancellations, routing non-item events to a throwaway github.run_id group.
  • norrietaylor/spectacles#236: Overlaps in concurrency-key implementation, deriving a PR/item-scoped lock key in the sdd-execute wrapper workflows from pull_requests[0].number and head_branch.
  • norrietaylor/spectacles#214: Modifies the same sdd-execute-*.lock.yml prompt and MCP heredoc marker wiring sections updated by this PR.

Poem

🐇 Hop hop, each task gets its own lane,
No sibling's PR shall cancel my rain!
item_number carved in the group key's stone,
Each execution runs safe, all alone.
No more stranded tasks left in dismay—
The rabbit has fixed the concurrent fray! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(sdd-execute): per-item concurrency group (closes #308)' clearly and concisely summarizes the main functional change—adding per-item concurrency grouping to prevent cross-task cancellation.
Description check ✅ Passed The description is directly related to the changeset, explaining the problem of shared concurrency groups across same-tier execute runs, the proposed fix, and the scope of changes.
Linked Issues check ✅ Passed The PR fully addresses issue #308 by implementing the suggested fix: modifying the concurrency.group to be strictly per-item using workflow-item_number pattern with run_id fallback, preventing cross-task cancellation.
Out of Scope Changes check ✅ Passed All changes are in-scope: only the three sdd-execute tier .md and .lock.yml files are modified with the concurrency.group functional change and recompilation-generated artifact updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/execute-per-item-concurrency

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

sdd-execute: a re-triggered run can be cancelled at the activation job by concurrent same-tier execute activity on a different task

1 participant