@devries-cameron20 / t3code-1 / commits / 7f2ff41bc8
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix: prevent subagents inheriting parent settlement protections (#26035)

Co-authored-by: Jarmo Isotalo <jarmo@tokenterminal.xyz> Co-authored-by: maria-rcks <maria@kuuro.net>

agentic-jarmo committed Oct 30, 2026 at 23:17 UTC 7f2ff41bc839f591be8ad22440bbe8182d8a7304
2 files changed +16 -8
apps/server/src/orchestration-v2/SubagentProjection.test.ts
+15 -8
@@ -120,14 +120,17 @@ it("keeps a subagent child awake when its parent thread is snoozed", () => {
120 });
121 });
122
123 -it.effect.each([
124 - ["sql", ProjectionStore.layer.pipe(Layer.provideMerge(SqlitePersistence.layerMemory))],
125 -] as const)(
126 - "%s: a pinned parent's subagent child is born unpinned and settles once idle",
127 - ([, testLayer]) =>
123 +it.effect.each(["provider", "mcp"] as const)(
124 + "a %s child does not inherit parent settlement protections and settles once idle",
125 + (creationSource) =>
126 Effect.gen(function* () {
127 const store = yield* ProjectionStore.ProjectionStoreV2;
130 - const parentThread = { ...makeParentThread(), pinnedAt: parentCreatedAt, pinOrderKey: "a0" };
128 + const parentThread = {
129 + ...makeParentThread(),
130 + pinnedAt: parentCreatedAt,
131 + pinOrderKey: "a0",
132 + autoSettleDisabledAt: parentCreatedAt,
133 + };
134 const childThread = makeSubagentChildThread({
135 parentThread,
136 childThreadId,
@@ -138,13 +141,14 @@ it.effect.each([
141 title: "Child",
142 now: childCreatedAt,
143 createdBy: "agent",
141 - creationSource: "provider",
144 + creationSource,
145 });
146
147 assert.equal(parentThread.pinnedAt, parentCreatedAt);
148 assert.equal(parentThread.pinOrderKey, "a0");
149 assert.isNull(childThread.pinnedAt);
150 assert.isNull(childThread.pinOrderKey);
151 + assert.isNull(childThread.autoSettleDisabledAt);
152
153 for (const thread of [parentThread, childThread]) {
154 yield* store.apply({
@@ -158,6 +162,7 @@ it.effect.each([
162 const savedParent = yield* store.getThread(parentThreadId);
163 assert.deepEqual(savedParent.pinnedAt, parentCreatedAt);
164 assert.equal(savedParent.pinOrderKey, "a0");
165 + assert.deepEqual(savedParent.autoSettleDisabledAt, parentCreatedAt);
166 const candidates = yield* store.getSettlementCandidates();
167 assert.deepEqual(
168 candidates.map((candidate) => candidate.id),
@@ -171,7 +176,9 @@ it.effect.each([
176 autoSettleOnMerge: false,
177 });
178 assert.equal(settledAt && DateTime.formatIso(settledAt), DateTime.formatIso(childCreatedAt));
174 - }).pipe(Effect.provide(testLayer)),
179 + }).pipe(
180 + Effect.provide(ProjectionStore.layer.pipe(Layer.provideMerge(SqlitePersistence.layerMemory))),
181 + ),
182 );
183
184 function taskFixture() {
packages/provider-core/src/server/subagentProjection.ts
+1
@@ -84,6 +84,7 @@ export function makeSubagentChildThread(input: {
84 snoozedAt: null,
85 pinnedAt: null,
86 pinOrderKey: null,
87 + autoSettleDisabledAt: null,
88 // A guest link belongs to the thread it was made for.
89 guestShare: null,
90 lastVisitedAt: null,