fix: prevent subagents inheriting parent settlement protections#26035

merged2
main
GitHub fork: fix/subagent-settlement-flags
opened7d agobyAagentic-jarmo
View on GitHubTwo-way sync enabledPR last imported 4d ago

Completed subagents can remain pinned and exempt from automatic settlement because makeSubagentChildThread spreads the parent thread without clearing those settings. This affects both provider-native and MCP children and can keep finished children in background PR discovery indefinitely.

Clear pinnedAt, pinOrderKey, and autoSettleDisabledAt when projecting a child. Keep the parent's settings and the child's repository, worktree, and lineage intact. This corrects newly projected children; it does not migrate existing records.

Validation: the two new provider/MCP regression cases fail before the fix and pass afterward. The full required vp run check:changed passes, including 9 tests and affected-package typechecks.

Model: GPT-6. Harness: Codex.

Checks

23 successful · 13 skipped
All checks passed
5f80f10

Added 1 commit

  • fix(server): give subagents independent settlement settingsdf851d4
Synced from GitHub

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — The shared subagent projection now clears pinning and automatic-settlement opt-out state for every newly created child, with regression coverage for provider and MCP paths. This changes the effective default lifecycle behavior of new subagents and warrants human review.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Review in Change Stack →

Walkthrough

makeSubagentChildThread now initializes autoSettleDisabledAt to null. Tests cover provider and MCP child creation, verify that the parent retains its timestamp, and check settlement candidate selection.

Changes: Subagent child fields

Layer / File(s)Summary
Clear child auto-settlement protection
packages/provider-core/src/server/subagentProjection.ts, apps/server/src/orchestration-v2/SubagentProjection.test.ts
The child projection initializes autoSettleDisabledAt to null. Tests cover both creation sources, verify the child does not inherit the parent timestamp, and check that the persisted parent retains it.

Priority: External image Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • pingdotgg/t3code#19657: The issue reports subagent children entering auto-settlement sweeps and inheriting pins. This change clears the child’s inherited autoSettleDisabledAt value.

Possibly related PRs

  • pingdotgg/t3code#21271: This PR and #21271 both change makeSubagentChildThread to clear child protection fields. This change also clears autoSettleDisabledAt.
  • pingdotgg/t3code#19665: Both PRs address subagent child settlement behavior. This change clears an inherited auto-settlement protection field.

Suggested labels: bugfix

Suggested reviewers: only21mil, juliusmarminge, t3dotgg

Merge Risk: External image Minimal · up to 5f80f

No concrete merge-blocking issue is established by the reviewed change.

Pre-merge checks: Passed 4
Check nameStatusExplanation
Title checkPassedThe title clearly and concisely describes the main change: preventing subagents from inheriting parent settlement protections.
Description checkPassedThe description explains the problem, the change, preserved behavior, migration scope, and verification results. It does not use the template headings or provide explicit scope or approval details, bu…
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, the change, preserved behavior, migration scope, and verification results. It does not use the template headings or provide explicit scope or approval details, but it is otherwise sufficiently complete for this focused bug fix.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

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

Synced from GitHub

Wild, my agent was debugging lagging and slow T3 code on a VM, and apparently Sol wanted to contribute this upstream.

I have a few monster threads open on T3, with autosettle off. I don't want my monster threads to ever vanish. Apparently, after ~1k PRs with tons of subagents, none of those sub-worktrees got settled, and it kept on checking for git status constantly. On a GCP VM machine with a pd-disk, the IO is slowish, and this amplified the delays.

Added 1 commit

  • fix(server): keep child settlement independent when merging main5f80f10

Note

Written by gpt-6.1-sol on behalf of Maria

thanks @agentic-jarmo. the original correctly identified that child projections inherit the parent's automatic-settlement opt-out.

i preserved your commit and merged current main into this branch. main already resets both pin fields, so the remaining production change is one line: autoSettleDisabledAt: null. i folded the duplicate regression cases into main's existing sql persistence/settlement test and parameterized it for provider and mcp children. parent protections, child lineage and worktree behavior remain intact. existing children are not migrated.

verification at 5f80f106de76dbebeeda9d188011eec0a3d260b3:

  • both provider/mcp cases failed against main's production code because the child retained the parent's opt-out timestamp, then passed with the reset.
  • blacksmith vp run check:changed passed: formatting, lint, knip, graphql checks, 23 package typechecks, and 10 tests.
  • 34 existing projection-settlement and settlement-service tests passed through blacksmith.
  • two independent read-only reviews of this head found no blocker, should, or nit findings.

unverified: a fresh live provider/subagent spawn through a client, desktop/mobile, and remote/relay connections. this changes hidden server lifecycle state and no client rendering; no screenshot evidence applies. the existing human-approval requirement remains for maria's review.

Note

Written by gpt-6.1-sol on behalf of Maria

Verified in a real dev environment

verified as-is at 5f80f106de76dbebeeda9d188011eec0a3d260b3. no code changes or pushes were needed.

ran github/main (6575ce3250) in /home/user/main first, then stopped it before starting the exact pr head. installed each checkout with vp i. used the real dev web client, repository Playwright, /usr/bin/google-chrome, and real Codex gpt-6.1-sol turns through the local proxy. created a local git project and parent thread through the app, pinned the parent, and disabled its auto-settle through its action menu. no mocks, fixtures, or direct database writes.

  • on main, both native spawn_agent and T3 MCP delegate_task children completed their real git status --short tasks, but inherited the parent's autoSettleDisabledAt. the child menu showed auto-settle disabled.
  • on the pr head, both paths completed again. both children had autoSettleDisabledAt, pinnedAt, and pinOrderKey set to null; the child menus showed auto-settle enabled. parent pin/opt-out values stayed intact. parent lineage, model, branch, and current-checkout context remained correct.
  • nearby behavior: manually settled and un-settled the mcp child through the client and confirmed the persisted events. a subsequent real Codex turn returned FOLLOWUP_OK and cleared the manual active override. the parent remained protected.

short transcript from read-only inspection of the app-created persisted records:

text
1 parent opt-out native child opt-out mcp child opt-out
2main timestamp same timestamp same timestamp
3pr timestamp null null
4child pins, both builds null null
5real provider results NATIVE_CHILD_OK MCP_CHILD_OK
6pr follow-up FOLLOWUP_OK

full command transcript

blacksmith checks passed: all 43 existing projection/settlement tests and vp run check:changed (format, lint, knip, graphql, 23 affected-package typechecks, 10 tests). fetched the public pr history into the worker to satisfy the changed-check merge base. inspected the captures and checked uploaded video playback and seeking.

main: completed native child incorrectly inherits disabled auto-settle

pr: equivalent completed native child has auto-settle enabled

pr: completed mcp child also has auto-settle enabled

protected parent, enabled children, and manual settle/un-settle in the real client

Not verified

wall-clock inactivity auto-settlement requires at least one day, so i did not wait for that sweep or fabricate old timestamps. the live proof covers the changed inheritance and persisted settings; the existing settlement tests cover eligibility and expiry. also unverified: native desktop/mobile clients, macos/windows, other providers, isolated child worktrees, and remote/relay/tunnel connections. existing children are not migrated by this pr.