fix: keep question order and streamline contextual help
GoodBuddy Agents / Validate Agent source (push) Canceled after 0s
GoodBuddy Agents / Build darwin arm64 Agent (push) Canceled after 0s
GoodBuddy Agents / Build linux arm64 Agent (push) Canceled after 0s
GoodBuddy Agents / Build linux x64 Agent (push) Canceled after 0s
Cross-platform packages / Validate source (push) Canceled after 0s
Cross-platform packages / Authorize desktop packaging (push) Canceled after 0s
Cross-platform packages / linux arm64 (push) Canceled after 0s
Cross-platform packages / macos arm64 (push) Canceled after 0s
Cross-platform packages / windows arm64 (push) Canceled after 0s
Cross-platform packages / linux x64 (push) Canceled after 0s
Cross-platform packages / macos x64 (push) Canceled after 0s
Cross-platform packages / windows x64 (push) Canceled after 0s
Cross-platform packages / Publish GitHub and OSS release (push) Canceled after 0s
GoodBuddy Agents / Validate Agent source (push) Canceled after 0s
GoodBuddy Agents / Build darwin arm64 Agent (push) Canceled after 0s
GoodBuddy Agents / Build linux arm64 Agent (push) Canceled after 0s
GoodBuddy Agents / Build linux x64 Agent (push) Canceled after 0s
Cross-platform packages / Validate source (push) Canceled after 0s
Cross-platform packages / Authorize desktop packaging (push) Canceled after 0s
Cross-platform packages / linux arm64 (push) Canceled after 0s
Cross-platform packages / macos arm64 (push) Canceled after 0s
Cross-platform packages / windows arm64 (push) Canceled after 0s
Cross-platform packages / linux x64 (push) Canceled after 0s
Cross-platform packages / macos x64 (push) Canceled after 0s
Cross-platform packages / windows x64 (push) Canceled after 0s
Cross-platform packages / Publish GitHub and OSS release (push) Canceled after 0s
Keep interactive questions and answered cards at their original position in conversation history, including remote reception, recovery, and reopening. Preserve legacy history placement without a database migration. Move supplementary guidance into shared accessible contextual-help popovers across pages and settings. Add keyboard, modal, accessibility, and Electron regressions, plus bounded opt-in live canvas-analysis validation. Remove unused Agent, Runtime, and in-memory graph-search helpers, obsolete mocks and browser copy; reuse the existing package-size formatter. Keep production execution paths, protocol schemas, and released data migrations. Validation: targeted cleanup tests, typecheck, lint, shared Linux Host attach/read/re-attach, and added help/Electron checks passed. Final full-suite verification passed 4,858 tests with 67 skipped and zero failures (412 files passed, 9 skipped). Focused help checks passed 54 tests, including Electron style comparisons and Chromium accessibility descriptions. Details and validation boundaries are recorded in feature docs. Release note: 修复交互式问答在回答后排到后续输出末尾的问题,重新打开会话仍保留提问位置。页面和设置中的补充说明改为标题或字段旁的按需帮助,支持鼠标与键盘操作。
This commit is contained in:
@@ -4131,6 +4131,73 @@ describe('AssistantDatabase', () => {
|
||||
database.close()
|
||||
})
|
||||
|
||||
it.each([false, true])('keeps remote questions in arrival order through replay and reopen (legacy=%s)', async legacy => {
|
||||
const directory = await mkdtemp(join(tmpdir(), 'goodbuddy-question-order-'))
|
||||
temporaryDirectories.push(directory)
|
||||
const databasePath = join(directory, 'assistant.sqlite')
|
||||
const database = new AssistantDatabase(databasePath)
|
||||
database.initialize('C:\\Workspace')
|
||||
try {
|
||||
const project = database.createSshProject(validatedSshProjectWrite())
|
||||
const conversationId = randomUUID()
|
||||
const taskId = randomUUID()
|
||||
const assistantMessageId = randomUUID()
|
||||
database.saveLocalConversations([{
|
||||
header: { id: conversationId, projectId: project.id, title: 'Question order', updatedAt: Date.now() },
|
||||
messages: []
|
||||
}])
|
||||
database.createTask({
|
||||
id: taskId, projectId: project.id, conversationId, title: 'Question order',
|
||||
instructions: 'Ask then acknowledge', workMode: 'execute',
|
||||
remoteRecovery: { recoverable: true, currentUserMessageId: randomUUID(), currentAssistantMessageId: assistantMessageId }
|
||||
})
|
||||
if (legacy) {
|
||||
const raw = new DatabaseSync(databasePath)
|
||||
try {
|
||||
raw.prepare("UPDATE messages SET metadata_json = json_remove(metadata_json, '$.blocks') WHERE id = ?").run(assistantMessageId)
|
||||
} finally { raw.close() }
|
||||
}
|
||||
const append = (sequence: string, event: Parameters<AssistantDatabase['appendRemoteConversationTaskEventOnce']>[0]['event']) =>
|
||||
database.appendRemoteConversationTaskEventOnce({
|
||||
taskId, conversationId, assistantMessageId, bindingId: 'question-binding',
|
||||
operationId: 'question-operation', semanticSequence: sequence, eventIndex: 0, event
|
||||
})
|
||||
const question = {
|
||||
requestId: taskId, type: 'question' as const, questionId: 'first-question',
|
||||
questions: [{ header: 'Choice', question: 'Choose one', options: [{ label: 'Yes', description: 'Continue' }], multiple: false, custom: false }]
|
||||
}
|
||||
expect(append('1', question)).toBe(true)
|
||||
const initialBlocks = database.getConversation(conversationId).messages[1]!.blocks
|
||||
expect(initialBlocks).toEqual(legacy ? undefined : [expect.objectContaining({ type: 'question', questionId: question.questionId })])
|
||||
expect(append('1', question)).toBe(false)
|
||||
expect(append('2', { requestId: taskId, type: 'text', delta: 'After first. ' })).toBe(true)
|
||||
expect(append('3', { requestId: taskId, type: 'tool', callId: 'read-1', name: 'read', state: 'running', summary: 'Read fixture' })).toBe(true)
|
||||
expect(database.recordRemoteTaskQuestionArrival(taskId, 'second-question')).toBe(true)
|
||||
expect(database.recordRemoteTaskQuestionArrival(taskId, 'second-question')).toBe(true)
|
||||
expect(append('4', { ...question, questionId: 'second-question' })).toBe(true)
|
||||
// A fresh semantic envelope for the same live question must not move its marker.
|
||||
expect(append('5', question)).toBe(true)
|
||||
expect(append('6', { requestId: taskId, type: 'text', delta: 'After second.' })).toBe(true)
|
||||
const answer = { questionId: question.questionId, skipped: false, questions: question.questions.map(item => ({ ...item, answer: ['Yes'] })) }
|
||||
expect(database.recordRemoteTaskQuestionAnswer(taskId, answer)).toBe(true)
|
||||
expect(database.recordRemoteTaskQuestionAnswer(taskId, answer)).toBe(true)
|
||||
expect(database.recordRemoteTaskQuestionAnswer(taskId, { questionId: 'second-question', skipped: true, questions: question.questions })).toBe(true)
|
||||
const beforeTerminal = database.getConversation(conversationId).messages[1]!
|
||||
expect(beforeTerminal.blocks?.map(block => block.type)).toEqual(legacy ? undefined : ['question', 'text', 'tool', 'question', 'text'])
|
||||
if (!legacy) expect(beforeTerminal.blocks?.[0]).toEqual(initialBlocks?.[0])
|
||||
expect(append('7', { requestId: taskId, type: 'done' })).toBe(true)
|
||||
const completed = database.getConversation(conversationId).messages[1]!
|
||||
expect(completed.answeredQuestions).toHaveLength(2)
|
||||
expect(completed.content).toBe('After first. After second.')
|
||||
expect(completed.state).toBe('complete')
|
||||
expect(completed.blocks?.filter(block => block.type === 'question')).toEqual(beforeTerminal.blocks?.filter(block => block.type === 'question'))
|
||||
database.close()
|
||||
database.initialize('C:\\Workspace')
|
||||
expect(append('1', question)).toBe(false)
|
||||
expect(database.getConversation(conversationId).messages[1]).toEqual(completed)
|
||||
} finally { database.close() }
|
||||
})
|
||||
|
||||
it('rolls back a recovered event when its message update fails', async () => {
|
||||
const directory = await mkdtemp(
|
||||
join(tmpdir(), 'goodbuddy-remote-event-atomic-')
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import { magicNoteCanvasAnalysisText } from '../../shared/magic-note-canvas-text'
|
||||
import { knowledgeReferenceKey } from '../../shared/knowledge-reference'
|
||||
import { appendConversationQuestionBlock } from '../../shared/conversation-question-blocks'
|
||||
import { DatabaseSync } from 'node:sqlite'
|
||||
import { statSync } from 'node:fs'
|
||||
import { MagicNoteStorage } from '../magic-notes/magic-note-storage'
|
||||
@@ -1383,6 +1384,11 @@ function reduceRecoveredAgentEvent(
|
||||
blocks,
|
||||
status: undefined
|
||||
}
|
||||
} else if (event.type === 'question') {
|
||||
next = {
|
||||
...message,
|
||||
blocks: appendConversationQuestionBlock(message.blocks, event.questionId)
|
||||
}
|
||||
} else if (event.type === 'checklist') {
|
||||
next = { ...message, runtimeChecklist: event.checklist }
|
||||
} else if (event.type === 'status') {
|
||||
@@ -5099,6 +5105,27 @@ export class AssistantDatabase {
|
||||
})
|
||||
}
|
||||
|
||||
recordRemoteTaskQuestionArrival(taskIdInput: string, questionId: string): boolean {
|
||||
const taskId = assistantIdSchema.parse(taskIdInput)
|
||||
const database = this.requireDatabase()
|
||||
const row = database.prepare(
|
||||
`SELECT m.id, m.metadata_json
|
||||
FROM tasks t JOIN messages m
|
||||
ON m.id = t.current_assistant_message_id
|
||||
AND m.conversation_id = t.conversation_id AND m.request_id = t.id
|
||||
WHERE t.id = ? AND t.remote_recoverable = 1 AND m.role = 'assistant'`
|
||||
).get(taskId) as { id: string; metadata_json: string } | undefined
|
||||
if (!row) return false
|
||||
const metadata = JSON.parse(row.metadata_json) as MessageMetadata
|
||||
const blocks = appendConversationQuestionBlock(metadata.blocks, questionId)
|
||||
if (blocks !== metadata.blocks) {
|
||||
metadata.blocks = blocks
|
||||
database.prepare('UPDATE messages SET metadata_json = ? WHERE id = ?')
|
||||
.run(JSON.stringify(metadata), row.id)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
recordRemoteTaskQuestionAnswer(
|
||||
taskIdInput: string,
|
||||
answerInput: ConversationAnsweredQuestion
|
||||
|
||||
Reference in New Issue
Block a user