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:
Chris Scott authored and GitHub committed 2026-09-28 23:55:01 -04:00
1 parent e80016cc22
commit 304f636516
35 files changed
+4272 -254

No files matched your search

+3 -12
View File
@@ -2,7 +2,7 @@ import { API_BASE_URL } from "@/config";
import { settingsApi } from "./settings";
import { fetchWrapper } from "./fetchWrapper";
import { callOpenCode } from "./opencodeApi";
import { openCodeLocation, type ConfigEntry, type FormAnswer, type ModelInfo } from "@opencode-manager/shared/opencode";
import { openCodeLocation, selectConfiguredModelRef, type FormAnswer, type ModelInfo } from "@opencode-manager/shared/opencode";
import type { CredentialListResponse, CredentialStatusResponse } from "@opencode-manager/shared/schemas";
import type { OpenCodeConfigFile } from "./types/settings";
@@ -128,20 +128,11 @@ export async function getProviders(directory?: string): Promise<ProvidersResult>
}
}
type ConfigDocumentModel = Extract<ConfigEntry, { type: "document" }>["info"]["model"];
function formatConfigModel(model: NonNullable<ConfigDocumentModel>): string {
return typeof model === "string" ? model : `${model.providerID}/${model.model}`;
}
export async function getOpenCodeConfigModel(directory?: string): Promise<string | null> {
try {
const entries = await callOpenCode((api) => api.config.get(openCodeLocation(directory)));
const model = entries.reduce<ConfigDocumentModel>(
(current, entry) => (entry.type === "document" && entry.info.model ? entry.info.model : current),
undefined,
);
return model ? formatConfigModel(model) : null;
const ref = selectConfiguredModelRef(entries);
return ref ? `${ref.providerID}/${ref.id}` : null;
} catch {
return null;
}