mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
fix: stabilize scheduled runs and background task tracking (#365)
* fix: stabilize scheduled runs and background task tracking * fix: complete scheduled runs and harden background task status - Route directory-less OpenCode session events (session.execution.*, session.usage.updated) to backend listeners by remembering each session's directory in the SSE aggregator, so scheduled runs finish and failure push notifications fire; browser delivery is unchanged. - Resolve background shell status from the transcript completion notice when OpenCode no longer lists the shell, keep the first terminal status so a kill is not reported as completed, and share one status icon and colour mapping between the transcript and background bar. - Reconcile child sessions only while unknown or running, trigger it from the EventProvider alone, refresh children that drop to unknown after a poll, and forget deleted sessions. - Fetch the model list and default concurrently while waiting for the schedule model, share configured-model selection, and consolidate schedule startup cancellation cleanup. - Reduce background work re-renders, prune shell exit records, remove dead exports, and document background work in the chat guide. * fix: hide finished background tasks and clip long dialog titles
This commit is contained in:
1 parent
e80016cc22
commit
304f636516
35 files changed
+4272
-254
No files matched your search
@@ -22,6 +22,7 @@ import { EditableUserMessage, ClickableUserMessage } from './EditableUserMessage
|
||||
import { useSettings } from '@/hooks/useSettings'
|
||||
import { useTTS } from '@/hooks/useTTS'
|
||||
import { CopyButton } from '@/components/ui/copy-button'
|
||||
import { backgroundShellID, collectBackgroundParts, type ShellNoticeOutcome } from '@/lib/backgroundWork'
|
||||
|
||||
function getMessageText(message: SessionMessageInfo): string {
|
||||
switch (message.type) {
|
||||
@@ -364,6 +365,7 @@ interface MessageRowProps {
|
||||
model?: string
|
||||
simpleChatMode: boolean
|
||||
showReasoning: boolean
|
||||
shellOutcomes: ReadonlyMap<string, ShellNoticeOutcome>
|
||||
}
|
||||
|
||||
const MessageRow = memo(function MessageRow({
|
||||
@@ -382,8 +384,11 @@ const MessageRow = memo(function MessageRow({
|
||||
model,
|
||||
simpleChatMode,
|
||||
showReasoning,
|
||||
shellOutcomes,
|
||||
}: MessageRowProps) {
|
||||
const messageTextContent = getMessageText(message)
|
||||
const shellOutcomeFor = (part: SessionMessageAssistant['content'][number]) =>
|
||||
part.type === 'tool' ? shellOutcomes.get(backgroundShellID(part) ?? '') : undefined
|
||||
const streaming = message.type === 'assistant' && message.time.completed === undefined
|
||||
const isEditingThisMessage = editingUserMessageId === message.id
|
||||
const canEditUserMessage = isLastUserMessage && !isSessionBusy
|
||||
@@ -479,6 +484,8 @@ const MessageRow = memo(function MessageRow({
|
||||
<MessagePart
|
||||
part={part}
|
||||
messageID={message.id}
|
||||
directory={directory}
|
||||
shellOutcome={shellOutcomeFor(part)}
|
||||
onFileClick={onFileClick}
|
||||
onChildSessionClick={onChildSessionClick}
|
||||
/>
|
||||
@@ -516,6 +523,8 @@ const MessageRow = memo(function MessageRow({
|
||||
<MessagePart
|
||||
part={part}
|
||||
messageID={message.id}
|
||||
directory={directory}
|
||||
shellOutcome={shellOutcomeFor(part)}
|
||||
onFileClick={onFileClick}
|
||||
onChildSessionClick={onChildSessionClick}
|
||||
/>
|
||||
@@ -607,6 +616,15 @@ export const MessageThread = memo(function MessageThread({
|
||||
|
||||
const lastUserMessageId = useMemo(() => findLastUserMessageId(messages), [messages])
|
||||
|
||||
const shellOutcomesKey = useMemo(
|
||||
() => [...collectBackgroundParts(messages).shellNotices].map(([id, outcome]) => `${id}=${outcome}`).join(','),
|
||||
[messages],
|
||||
)
|
||||
const shellOutcomes = useMemo(
|
||||
() => new Map(shellOutcomesKey ? shellOutcomesKey.split(',').map((entry) => entry.split('=') as [string, ShellNoticeOutcome]) : []),
|
||||
[shellOutcomesKey],
|
||||
)
|
||||
|
||||
const nextAssistantIdByMessageId = useMemo(() => {
|
||||
const map = new Map<string, string | undefined>()
|
||||
let nextAssistantId: string | undefined
|
||||
@@ -656,6 +674,7 @@ export const MessageThread = memo(function MessageThread({
|
||||
model={model}
|
||||
simpleChatMode={simpleChatMode}
|
||||
showReasoning={showReasoning}
|
||||
shellOutcomes={shellOutcomes}
|
||||
/>
|
||||
))}
|
||||
{pending.map((item) => (
|
||||
|
||||
Reference in new issue
Block a user