fix(team-mode): close peer message delivery races
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
settleAfterSessionIdle,
|
||||
} from "./session-idle-settle"
|
||||
|
||||
export const DEFAULT_PROMPT_ASYNC_POST_DISPATCH_HOLD_MS = 250
|
||||
export const DEFAULT_PROMPT_ASYNC_POST_DISPATCH_HOLD_MS = 2_000
|
||||
export const DEFAULT_PROMPT_DISPATCH_TIMEOUT_MS = 30_000
|
||||
export const DEFAULT_PROMPT_GATE_MESSAGES_FETCH_TIMEOUT_MS = 5_000
|
||||
export const DEFAULT_PROMPT_QUEUE_RETRY_MS = 250
|
||||
@@ -420,7 +420,7 @@ function latestAssistantTurnBlocksInternalPrompt(messages: unknown[]): boolean {
|
||||
const role = messageRole(message)
|
||||
if (role === "assistant") {
|
||||
const finish = messageFinish(message)
|
||||
if (finish === undefined) {
|
||||
if (finish === undefined || finish === "unknown") {
|
||||
return true
|
||||
}
|
||||
if (!isRecord(message) || !Array.isArray(message.parts)) {
|
||||
|
||||
@@ -344,6 +344,9 @@ await dispatchInternalPrompt(options)
|
||||
}
|
||||
|
||||
const contents = await readFile(filePath, "utf8")
|
||||
if (!contents.includes("prompt")) {
|
||||
continue
|
||||
}
|
||||
if (detectRawPromptInSnippet(contents)) {
|
||||
offenders.push(relativeSourcePath(filePath))
|
||||
}
|
||||
@@ -395,6 +398,9 @@ await dispatchInternalPrompt(options)
|
||||
// when
|
||||
for (const filePath of files) {
|
||||
const contents = await readFile(filePath, "utf8")
|
||||
if (!contents.includes("dispatchInternalPrompt")) {
|
||||
continue
|
||||
}
|
||||
const missingLines = findPromptGateCallsWithoutQueueBehavior(filePath, contents)
|
||||
for (const line of missingLines) {
|
||||
offenders.push(`${relativeSourcePath(filePath)}:${line}`)
|
||||
@@ -413,6 +419,12 @@ await dispatchInternalPrompt(options)
|
||||
// when
|
||||
for (const filePath of files) {
|
||||
const contents = await readFile(filePath, "utf8")
|
||||
if (
|
||||
!contents.includes("promptWithModelSuggestionRetry")
|
||||
&& !contents.includes("promptSyncWithModelSuggestionRetry")
|
||||
) {
|
||||
continue
|
||||
}
|
||||
const missingLines = findPromptRetryCallsWithoutQueueBehavior(filePath, contents)
|
||||
for (const line of missingLines) {
|
||||
offenders.push(`${relativeSourcePath(filePath)}:${line}`)
|
||||
|
||||
Reference in New Issue
Block a user