fix: allow concurrent and unrestricted Runtime sessions

Local embedded OpenCode serialized otherwise independent conversations, and GoodBuddy could stop long Runtime tasks after fixed tool, activity, model-call, or accumulated display-output limits.

Different conversations can now run concurrently while requests in the same conversation stay ordered. Dynamic MCP tools remain isolated to the current request. OpenCode, Continue, managed ACP, and the Agent model gateway no longer stop native execution at GoodBuddy-defined call counts or prompt-wide output totals; display copies truncate and transport queues apply backpressure instead. Prompt-wide quota fields are removed from the current contracts.

Per-call model settings, provider request timeouts, cancellation, and same-conversation ordering remain unchanged.

Release note: 修复本机 OpenCode 不同会话互相等待的问题,并移除 GoodBuddy 对单次 Runtime 工具、活动和模型调用次数的人为上限;长输出现在只截断展示或施加传输背压,不再取消原生任务。
This commit is contained in:
mesalogo
2026-09-03 17:17:09 +08:00
parent b1e3101857
commit 8b9dbf55df
32 changed files with 687 additions and 549 deletions
@@ -159,6 +159,43 @@ describe('AssistantDatabase', () => {
unchanged.close()
})
it('persists more than 100 tool activities in one message', async () => {
const database = await createDatabase()
const conversationId = '00000000-0000-4000-8000-000000000901'
const messageId = '00000000-0000-4000-8000-000000000902'
const tools = Array.from({ length: 101 }, (_, index) => ({
callId: `call-${index + 1}`,
name: 'read',
state: 'completed' as const,
summary: `Tool ${index + 1}`
}))
database.saveLocalConversations([
{
header: {
id: conversationId,
title: '长工具链',
updatedAt: 1
},
messages: [
{
id: messageId,
role: 'assistant',
content: '',
createdAt: 1,
state: 'complete',
tools
}
]
}
])
expect(
database.getConversation(conversationId)?.messages[0]?.tools
).toHaveLength(101)
database.close()
})
it('lists projects by creation time with newer projects last', async () => {
vi.useFakeTimers()
vi.setSystemTime(new Date('2026-08-07T00:00:00.000Z'))
+11 -20
View File
@@ -7,8 +7,6 @@ import {
conversationMessageSchema,
conversationSnapshotSchema,
expertCreateSchema,
maximumConversationSubagentActivities,
maximumConversationToolActivities,
normalizeInteractiveWorkMode,
persistedProjectExecutionSpaceSchema,
projectCreateSchema,
@@ -1170,7 +1168,6 @@ function serializeConversationMessageMetadata(
}
const maximumRecoveredMessageLength = 1_000_000
const maximumRecoveredMessageBlocks = 500
function appendRecoveredMessageBlock(
blocks: ConversationMessageBlock[] | undefined,
@@ -1190,7 +1187,7 @@ function appendRecoveredMessageBlock(
maximumRecoveredMessageLength
)
}
} else if (current.length < maximumRecoveredMessageBlocks) {
} else {
current.push({
id: randomUUID(),
type,
@@ -1221,12 +1218,10 @@ function upsertRecoveredToolBlock(
: block
)
}
return blocks.length >= maximumRecoveredMessageBlocks
? blocks
: [
...blocks,
{ id: randomUUID(), type: 'tool' as const, tool }
]
return [
...blocks,
{ id: randomUUID(), type: 'tool' as const, tool }
]
}
function upsertRecoveredSubagentBlock(
@@ -1262,12 +1257,10 @@ function upsertRecoveredSubagentBlock(
: block
)
}
return blocks.length >= maximumRecoveredMessageBlocks
? blocks
: [
...blocks,
{ id: randomUUID(), type: 'subagent' as const, childTaskId }
]
return [
...blocks,
{ id: randomUUID(), type: 'subagent' as const, childTaskId }
]
}
function terminalizeRecoveredToolBlocks(
@@ -1377,7 +1370,7 @@ function reduceRecoveredAgentEvent(
)
if (index >= 0) {
tools[index] = tool
} else if (tools.length < maximumConversationToolActivities) {
} else {
tools.push(tool)
}
next = {
@@ -1410,9 +1403,7 @@ function reduceRecoveredAgentEvent(
)
if (index >= 0) {
subagents[index] = subagent
} else if (
subagents.length < maximumConversationSubagentActivities
) {
} else {
subagents.push(subagent)
}
next = {