fix(server): settle no longer leaves monitors and dev servers running #5774
Mergedt3dotgg(GitHub profile, opens in a new tab)merged 3 commits into
main fromrefs/pull/5774/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- @@ -1054,16 +1063,17 @@10541063 const result = yield* dispatchNormalizedCommand(normalizedCommand);1055- if (normalizedCommand.type === "thread.archive") {1056- if (shouldStopSessionAfterArchive) {1064+ if (parkingCommand) {1065+ const parkingKind = parkingCommand.type === "thread.archive" ? "archive" : "settle";1066+ if (shouldStopSessionAfterCommand) {10571067 yield* Effect.gen(function* () {10581068 const stopCommand = yield* normalizeDispatchCommand({10591069 type: "thread.session.stop",10601070 commandId: CommandId.make(1061- `session-stop-for-archive:${normalizedCommand.commandId}`,1071+ `session-stop-for-${parkingKind}:${parkingCommand.commandId}`,10621072 ),1063- threadId: normalizedCommand.threadId,1073+ threadId: parkingCommand.threadId,10641074 createdAt: yield* nowIso,10651075 });1066107610671077 yield* dispatchNormalizedCommand(stopCommand);10681078 }).pipe(10691079 Effect.catchCause((cause) =>@@ -1046,8 +1039,13 @@1046- onNone: () => false,1047- onSome: (thread) =>1048- thread.session !== null && thread.session.status !== "stopped",1049- }),1050- ),1051- Effect.orElseSucceed(() => false),1052- )1053- : false;1039+ // Archive and settle both mean "done with this thread", so a1040+ // live provider session must not keep running background work1041+ // (PR monitors, dev servers, subagent fleets) after either1042+ // lands. The decider rejects settling a starting/running1043+ // session, so for settle this only ever stops an idle one; a1044+ // stopped session-set does not count as activity, so the stop1045+ // cannot un-settle the thread it follows.1046+ const parkingCommand =1047+ normalizedCommand.type === "thread.archive" ||1048+ normalizedCommand.type === "thread.settle"1049+ ? normalizedCommand1050+ : undefined;1051+ const shouldStopSessionAfterCommand = parkingCommand
- @@ -1054,14 +1069,17 @@1069+ )1070+ : false;10541071 const result = yield* dispatchNormalizedCommand(normalizedCommand);1055- if (normalizedCommand.type === "thread.archive") {1056- if (shouldStopSessionAfterArchive) {1072+ if (parkingCommand) {1073+ const parkingKind = parkingCommand.type === "thread.archive" ? "archive" : "settle";1074+ if (shouldStopSessionAfterCommand) {10571075 yield* Effect.gen(function* () {10581076 const stopCommand = yield* normalizeDispatchCommand({10591077 type: "thread.session.stop",10601078 commandId: CommandId.make(1061- `session-stop-for-archive:${normalizedCommand.commandId}`,1079+ `session-stop-for-${parkingKind}:${parkingCommand.commandId}`,10621080 ),1063- threadId: normalizedCommand.threadId,1081+ threadId: parkingCommand.threadId,10641082 createdAt: yield* nowIso,10651083 });1066108410671085 yield* dispatchNormalizedCommand(stopCommand);
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
96cc87ba-821f-48c3-a84e-076c49e55e85You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share