Skip to content

fix(auto-review): persist pending git action so review cards can't strand - #613

Open
TyroneNel wants to merge 1 commit into
cline:mainfrom
TyroneNel:fix/persist-pending-git-action
Open

fix(auto-review): persist pending git action so review cards can't strand#613
TyroneNel wants to merge 1 commit into
cline:mainfrom
TyroneNel:fix/persist-pending-git-action

Conversation

@TyroneNel

@TyroneNel TyroneNel commented Aug 24, 2026

Copy link
Copy Markdown

A card's armed auto-review state lives in browser memory. Reload the tab, close it, or switch project between sending the commit prompt and the commit landing, and the only record that a git action was requested is gone. The commit can succeed and the card still sits in review until someone trashes it by hand.

Fixes #365.

The fix

One optional additive field on the board card, pendingGitAction. Existing board.json files parse unchanged; there is no migration.

export const runtimeTaskPendingGitActionSchema = z.object({
  action: runtimeTaskAutoReviewModeSchema,
  requestedAt: z.number(),
  headCommitAtRequest: z.string().nullable(),
  attempt: z.number().int().nonnegative().default(0),
});
  • Written when auto-review triggers a git action, capturing the workspace headCommit at that moment.
  • Completed on evidence, not absence: the action succeeds when HEAD differs from headCommitAtRequest. changedFiles === 0 with an unchanged HEAD does not advance the card.
  • Guarded: a second git action is refused while pendingGitAction is non-null and recent. The state is on the card, so this is a cross-tab lock.
  • Bounded: after 15 minutes the pending action is cleared and the user is warned, rather than the card staying armed forever.

The staleness constant and helper live in src/core/task-board-mutations.ts, not api-contract.ts. web-ui consumes the contract type-only; a value import would pull zod into the SPA bundle.

This is the base of a stack. #615 builds on it and moves the actor from the browser into the runtime. This PR is complete on its own: it fixes #365 whether or not #615 lands.

Tests

New tests in web-ui/src/hooks/use-review-auto-actions.test.tsx (remount survival / #365 regression, no-advance on clean tree with unchanged HEAD, second action refused, legacy board hydration, staleness) and schema parse tests in test/runtime/api-validation.test.ts.

Revert-and-rerun proof that the new tests fail without the source change:

$ <revert implementation sources to origin/main>
$ npm --prefix web-ui run test -- src/hooks/use-review-auto-actions.test.tsx
 Test Files  1 failed (1)
      Tests  4 failed | 2 passed (6)
   × persists the pending git action when arming and advances the card after remount once HEAD moves (issue #365)
   × refuses to start a second git action while a recent pending action is armed
   × clears a stale pending git action instead of leaving the card armed forever
   × parses legacy boards without pendingGitAction and keeps valid pendingGitAction values

$ <restore>
$ npm --prefix web-ui run test -- src/hooks/use-review-auto-actions.test.tsx
 Test Files  1 passed (1)
      Tests  6 passed (6)

npm run check, npm run build, npm run web:typecheck and npm run web:test pass.

@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown

PR author is not in the allowed authors list.

…rand

The auto-review arming state lived only in a React ref, so a reload,
unmount, or project switch between triggering a commit and it landing
lost the only record that a git action was requested. The card then sat
in review with zero changed files forever (cline#365).

Persist a pendingGitAction field on the board card when auto-review
triggers a git action, complete it on evidence (HEAD moved past the
commit recorded at arming time) instead of absence (changedFiles == 0),
guard against double-triggering across tabs, and clear it after a
staleness timeout.

Refs cline#365
@TyroneNel
TyroneNel force-pushed the fix/persist-pending-git-action branch from 2504d46 to 5f72f1e Compare August 24, 2026 14:46
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.

Auto Review Commit doesn't auto trash

1 participant