Repository navigation
fix(server): a compaction cut by a restart runs again and sends what was queued behind it #30207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1bedc7b
0c517b2
eae4d6b
792ef3e
ef424dc
3a5bc90
e8433dc
c9ceca1
7b081e1
1531602
1bee2e2
f28323d
c445255
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,9 @@ import { runRanAfter } from "@t3tools/shared/orchestrationV2ThreadError"; | |
| import { resolveProjectSettings } from "@t3tools/shared/projectSettings"; | ||
| import { | ||
| CommandId, | ||
| IDLE_COMPACTION_TEXT, | ||
| idleCompactionOf, | ||
| isCompactionCommandMessage, | ||
| isOrchestrationV2WorkActive, | ||
| latestProviderTurnForAttempt, | ||
| MessageId, | ||
|
|
@@ -311,7 +314,13 @@ export const continueRestartedRun = Effect.fn("RestartContinuation.continueResta | |
| const sourceMessage = (yield* threads.getThreadRecords(input.threadId, ["messages"], { | ||
| messageIds: [source.userMessageId], | ||
| })).messages.find((message) => message.id === source.userMessageId); | ||
| if (sourceMessage !== undefined && isNativeMaintenanceCommand(sourceMessage)) return; | ||
| // Compaction changes nothing a repeat could double, so a cut one runs again. | ||
| const recompact = | ||
| sourceMessage !== undefined && | ||
| isCompactionCommandMessage(sourceMessage) && | ||
| !isRestartNoteSource(source, projection.providerTurns); | ||
| if (!recompact && sourceMessage !== undefined && isNativeMaintenanceCommand(sourceMessage)) | ||
| return; | ||
| const note = restartContinuationNote( | ||
| source, | ||
| projection.runs, | ||
|
|
@@ -334,22 +343,30 @@ export const continueRestartedRun = Effect.fn("RestartContinuation.continueResta | |
| commandId: CommandId.make(`command:restart-continuation:${input.sourceRunId}`), | ||
| threadId: input.threadId, | ||
| messageId, | ||
| text, | ||
| notification: { | ||
| source: { kind: "system" }, | ||
| outcome: "updated", | ||
| summary: | ||
| input.cause === "provider_exit" | ||
| ? "The agent runtime exited and stopped background work" | ||
| : note.settled | ||
| ? "T3 Code restarted and stopped background work" | ||
| : "T3 Code restarted and resumed this turn", | ||
| detail: text, | ||
| }, | ||
| text: recompact ? IDLE_COMPACTION_TEXT : text, | ||
| idleCompaction: recompact ? sourceMessage.idleCompaction : undefined, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With restart continuation enabled and idle compaction set to Useful? React with 👍 / 👎.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in c445255. The fresh-idle busy check now skips commands that carry |
||
| notification: recompact | ||
| ? undefined | ||
| : { | ||
| source: { kind: "system" }, | ||
| outcome: "updated", | ||
| summary: | ||
| input.cause === "provider_exit" | ||
| ? "The agent runtime exited and stopped background work" | ||
| : note.settled | ||
| ? "T3 Code restarted and stopped background work" | ||
| : "T3 Code restarted and resumed this turn", | ||
| detail: text, | ||
| }, | ||
| attachments: [], | ||
| modelSelection: source.modelSelection, | ||
| dispatchMode: { type: "start_immediately" }, | ||
| createdBy: "agent", | ||
| // Agent + server with no idleCompaction reads as an automatic idle compaction. | ||
| createdBy: !recompact | ||
| ? "agent" | ||
| : idleCompactionOf(sourceMessage) === undefined | ||
| ? "user" | ||
| : sourceMessage.createdBy, | ||
| creationSource: "server", | ||
| restartContinuationOfRunId: input.sourceRunId, | ||
| }) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.