Skip to content

fix(state): default Stage for every new issue, not only the bot's - #52

Merged
Ardnived merged 1 commit into
mainfrom
claude/state-default-stage-any-author
Sep 5, 2026
Merged

Ardnived merged 1 commit into
mainfrom
claude/state-default-stage-any-author

Conversation

@Ardnived

@Ardnived Ardnived commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Summary

issues: opened set Stage: Proposed and awaiting only when the bot authored the issue:

if (action === 'opened' && ev.issue.user.login === BOT) {

So a ticket filed from a local Claude Code session, from the GitHub UI, or by an outside
contributor on the four public repos landed with an empty Stage and no awaiting — invisible on
🎫 Pipeline, and absent from 🙋 Awaiting you, the one view that answers "what needs me".

The failure this prevents

docs/why.md#the-state-machine-is-not-the-loops-job already says both halves of this:

if an event determines the answer, the workflow owns it. Two writers racing on one field means the loser's write is silent.

An actor guard was tried first, and it was wrong: the bot authors its own issues and PRs, so github.actor != 'sydevs-bot' would skip exactly the transitions that matter most.

This author test was that same mistake surviving inverted — and it had a measurable cost.
Three skills carry a paragraph telling a local run to write Stage and awaiting itself, which is
exactly the two-writers shape the doctrine forbids:

  • draft-ticket/SKILL.md — "This skill is the exception that writes its own state."
  • cross-repo-issue/SKILL.md — "No bot event fires here, so set Stage and awaiting yourself."
  • implement-issue/SKILL.md — "Locally, set both yourself, since no bot event fires."

Those paragraphs are what actually failed. The observed symptom was tickets filed locally with no
Stage, no Effort, and no awaiting. They come out in a follow-up PR, not this one — one
behaviour per PR, and the workflow half should run against real issues first.

Changes

  • The opened branch loses its author test. if (!stage) is unchanged, so the default never
    overwrites a Stage the filer chose, and the write stays idempotent.
  • The header comment now forbids an author guard in either direction, and records what BOT is
    still for: naming whose PR or assignment an event describes, never deciding whether a rule applies.
    Its three other uses (assigned, PR ours, unassignBot) are untouched.
  • docs/why.md gains the story under the existing anchor.
  • docs/routine-setup.md — the 📥 Backlog view's is:issue no:stage filter can now only ever
    show the pre-existing Stage-less backlog, so it is re-pointed at stage:Proposed. This needs a
    matching edit in the Projects UI
    , which has no API.

The ops-journal early return is untouched, so the diary still gets no Stage.

Verification

This cannot be tested before merge — for issues events GitHub always runs the workflow from the
default branch, so neither the reusable workflow nor a caller can be exercised from a branch.
After merging, in this repo:

gh issue create --repo sydevs/claude-workflow --title "test: state machine stage default" --body "throwaway"
gh api repos/sydevs/claude-workflow/issues/<n>/issue-field-values \
  --jq '.[] | {(.issue_field_name): (.single_select_option.name // .value)}'   # Stage: Proposed
gh issue view <n> --repo sydevs/claude-workflow --json labels --jq '.labels[].name'  # awaiting
gh issue close <n>    # awaiting removed

The run's job summary lists each transition, so a no-op is visible there.

🤖 Generated with Claude Code

`issues: opened` set `Stage: Proposed` and `awaiting` only when
`ev.issue.user.login === BOT`. A ticket filed from a local session, from the
GitHub UI, or by an outside contributor on the four public repos landed with
an empty `Stage` and no `awaiting` — invisible on the board, and absent from
`🙋 Awaiting you`, the one view that answers "what needs me".

The failure this prevents: the workflow's own doctrine is that if an event
determines the answer, the workflow owns it, and that an actor guard was
already tried once and was wrong. This author test was that same mistake
surviving inverted. It had a visible cost — three skills carry a paragraph
telling a local run to write `Stage` and `awaiting` itself, which is the
two-writers shape the doctrine forbids. Those paragraphs come out in a
follow-up, once this has run.

`if (!stage)` is unchanged, so the default never overwrites a Stage the filer
chose, and the write stays idempotent. The `ops-journal` early return still
keeps the diary out. `BOT` keeps its other three uses: whose assignment an
`assigned` event describes, whose PR opened, and who to unassign.

Also updates the 📥 Backlog board view, whose `is:issue no:stage` filter can
now only ever show the pre-existing Stage-less backlog.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant