lock worktree/PR off for the non-committing coordinator task types - #3422
Merged
Conversation
branch-cleanup shipped with no taskMetadata at all, so applyAppWorktreeDefault filled useWorktree/openPR from the app's defaultOpenPR. Every run got a CoS-managed worktree it never cd's into (holding the very refs it is trying to delete) and a PR expectation a branch-deletion task can never satisfy, so finalization scored completed runs `pr-missing`. branch-cleanup, branch-reconcile, issue-reconcile, and jira-status-report now share one NON_COMMITTING_COORDINATOR_METADATA posture: useWorktree/openPR explicitly false and locked in MANAGED_AGENT_OPTIONS, plus worktreeChangesExpected: false so the TUI idle-complete gate doesn't read a clean tree as "produced no work". jira-status-report was hit for a subtler reason: readOnly skips worktree creation but the finalize-time PR-claim check reads metadata.openPR directly. A guard test iterates NON_COMMITTING_COORDINATOR_TASK_TYPES so a future coordinator type can't be added to one list and not the other.
…ata:null clear can't drop it loadSchedule preserves an explicit `taskMetadata: null` (skipping the defaults deep-merge), and enforceManagedAgentOptions rebuilds only the MANAGED fields — so worktreeChangesExpected went absent on that path and a successful clean-tree coordinator run was scored idle-no-changes again. It is now managed on all four coordinator types, with a falsifiability-verified test per type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A
branch-cleanupCoS run did its whole job — pruned stale tracking refs, deleted the one fully-merged local branch, correctly skipped the protected and worktree-held ones — and was still recorded as failed withpr-missing.Root cause:
branch-cleanupwas the only git/gh coordinator type shipping with notaskMetadataat all.applyAppWorktreeDefaultfillsuseWorktree/openPRon an=== undefinedcheck, so it took them from the managed app'sdefaultOpenPR: true. Every run got a CoS-managed worktree it nevercds into (holding the very refs it was trying to delete) plus a PR expectation a branch-deletion task can never satisfy, and finalization scored the completed runpr-missing.The four non-committing coordinator types —
branch-cleanup,branch-reconcile,issue-reconcile,jira-status-report, already enumerated inNON_COMMITTING_COORDINATOR_TASK_TYPESfor their commit-criterion exemption — now share one documented posture:useWorktree/openPRexplicitlyfalse, not merely absent, so the app defaults can't fill them; locked inMANAGED_AGENT_OPTIONSso a per-app override can't re-attach them.worktreeChangesExpected: false— a clean tree is the success shape for a branch deletion or a posted report, so the TUI idle-complete gate must not read it as "the model produced no work". Managed as well, becauseloadSchedulepreserves an explicittaskMetadata: null(skipping the defaults deep-merge) andenforceManagedAgentOptionsrebuilds only the managed fields — unmanaged, it would silently go absent on that path and reintroduceidle-no-changes.jira-status-reportwas hit by the same bug for a subtler reason worth calling out: itsreadOnly: trueskips worktree creation (agentWorkspacePrep.js) but the finalize-time PR-claim check readsmetadata.openPRdirectly (agentTuiSpawning.js), so a posted report still scoredpr-missing.A guard test iterates
NON_COMMITTING_COORDINATOR_TASK_TYPESrather than a hand-typed list, so a future coordinator type can't be added to one place and not the other — which is exactly how this shipped.No migration needed. Existing installs converge on the next schedule load: the
taskMetadatadeep-merge backfills the new keys, andenforceManagedAgentOptionsrewrites any storedtrue.Test plan
cd server && NODE_ENV=test npx vitest run— 24,334 passed, 211 skipped (DB suites gated off the non-test database as designed).taskSchedule.test.js, both parameterized off the realNON_COMMITTING_COORDINATOR_TASK_TYPESset:taskMetadata: null.jira-status-report's lock fails the first; droppingworktreeChangesExpectedfrom the managed list fails the second for all four types.loadScheduleforces storeduseWorktree/openPR: trueback off, and that a per-app override is stripped.gpt-5.6-terra) and a local ollama model; codex's one finding (thetaskMetadata: nullpath) is fixed in this branch and confirmed clean on re-review.