Skip to content

fix(task-board): a stale card repo must not veto binding the sole repo - #7163

Open
viktormarinho wants to merge 1 commit into
mainfrom
t3code/fix-repo-pin-fallback
Open

viktormarinho wants to merge 1 commit into
mainfrom
t3code/fix-repo-pin-fallback

Conversation

@viktormarinho

@viktormarinho viktormarinho commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Regression from #7159, on the Super Agent dispatch path and not behind a flag — so it's live for every org.

pickSoleTaskRepo gained a preferredRepo parameter that filtered the choices, and an empty filter result meant "don't bind". But task.repo is free text (z.string()) that goes stale — a renamed repository, a value from the github-connection era, a typo. So an org with exactly one repo stopped binding it whenever a card named something else, falling through to the mid-run TASK_ADD_REPO pick and costing a turn. That org bound its sole repo before the parameter existed.

The preference is now a hint: it narrows when it matches, and is discarded when it doesn't.

Multi-repo behavior is unchanged — a preference that matches nothing, or matches ambiguously, still declines to bind and defers to the mid-run pick. The existing test asserting that (pickSoleTaskRepo(twoChoices, "other/repo") === null) still passes, and still for the right reason: the filter empties, the original two choices stand, and length !== 1 declines.

choices task.repo before #7159 after #7159 this PR
1 unset bind bind bind
1 matches bind bind bind
1 stale bind mid-run pick bind
N matches mid-run pick bind bind
N stale/ambiguous mid-run pick mid-run pick mid-run pick

Deliberately unflagged, like the regression it repairs: flagging it off would leave the broken case live.

Validation: the new unit test fails on main (expect(pickSoleTaskRepo(sole, "acme/renamed-away")?.id).toBe("one") → received undefined) and passes here. Workspace type checks, lint (14 pre-existing warnings, 0 errors), knip, formatting, and 8,717 unit tests all pass.


Summary by cubic

Fixes a regression where a card's stale repo value prevented binding an org's sole repository, forcing a mid-run pick that costs a turn. The card's repo is now a hint: it narrows the choices when it matches and is discarded when it doesn't.

  • Multi-repo behavior is unchanged — a preference that matches nothing or matches ambiguously still defers to the mid-run pick.
  • The fix is intentionally unflagged because the regression is live on the Super Agent dispatch path for every org.
  • Adds a unit test that fails on main and passes here.

Written for commit 1c6767e. Summary will update on new commits.

Review in cubic

`pickSoleTaskRepo`'s `preferredRepo` (added in #7159) filtered the
choices, and an empty filter result meant no bind. But `task.repo` is
free text that goes stale — a renamed repository, a value from the
github-connection era, a typo — so an org with exactly ONE repo stopped
binding it whenever a card named something else, falling back to the
mid-run `TASK_ADD_REPO` pick and costing a turn. That org bound its sole
repo before the parameter existed.

The preference is now a hint: it narrows when it matches, and is
discarded when it doesn't. Multi-repo behavior is unchanged — a
preference matching nothing or matching ambiguously still declines to
bind and defers to the mid-run pick, which the existing tests cover.

Unflagged on purpose, like the regression it repairs: this sits on the
Super Agent dispatch path for every org, so leaving it half-applied
behind a flag would keep the broken case live.
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