fix: reduce supervisor stalls and preserve task delivery

Load Supervisor graphs only when opened, preserve source details on demand, reuse indexed story digests and window selection lists without losing keyboard or focus behavior. Route heavy UI reads through the existing worker, batch scoped queries and construct each publication snapshot once.

Keep remote cancellation responsive during model-route cleanup, remove late routes and retain reported usage after response-cap cancellation. Preserve Telegram pending replies through polling conflicts, show delivery errors and honor the final rate-limit cooldown.

Schema 62 adds lookup indexes without rewriting user content; older clients cannot open upgraded data. Large review publication still blocks Main and remains documented follow-up work. Record the future storage-service direction without performing the architecture migration.

Validation: exact staged code passed isolated full tests (6212 passed, 87 skipped), typecheck and lint. Three-round source performance comparisons, SQLite migration equivalence, native Electron interaction checks and current-source Linux x64 Host validation completed; eight external text-model requests.

Release note: Supervisor opens reviews without loading the entire graph, keeps long selection lists responsive and preserves details and keyboard navigation. Remote cancellation and Telegram reply recovery are more reliable; remote fixes require an Agent build containing this change.
This commit is contained in:
mesalogo
2026-10-05 14:18:33 +08:00
parent e50ca6d149
commit b90ff50f2a
59 changed files with 2108 additions and 265 deletions
+24 -3
View File
@@ -141,12 +141,13 @@ const stories = [
const story = stories[Number(params.get('story') ?? 0)] ?? stories[0]
const titles = story.events
const labels = story.entities
const dense = params.has('dense')
const windowed = params.has('windowed')
const dense = params.has('dense') || windowed
const long = params.has('long')
const state = params.get('state')
const graph: SupervisionGraphView = {
storyLine: { id: 'fixture', scope_json: '{"kind":"global"}' },
events: Array.from({ length: dense ? 80 : 8 }, (_, index) => ({
events: Array.from({ length: windowed ? 600 : dense ? 80 : 8 }, (_, index) => ({
id: `event-${index}`,
title: dense
? `模拟事件 ${index + 1}`
@@ -158,7 +159,7 @@ const graph: SupervisionGraphView = {
? '2026-09-21T08:00:00.000Z'
: `2026-09-${String(14 + index).padStart(2, '0')}T08:00:00.000Z`
})),
entities: Array.from({ length: dense ? 40 : 6 }, (_, index) => ({
entities: Array.from({ length: windowed ? 600 : dense ? 40 : 6 }, (_, index) => ({
id: `entity-${index}`,
canonical_label: dense
? `模拟实体 ${index + 1}`
@@ -193,6 +194,12 @@ const graph: SupervisionGraphView = {
source_id: 'source-1'
}))
}
if (windowed) {
graph.relations = Array.from({ length: 600 }, (_, index) => ({ ...graph.relations[0]!, id: `relation-${index}`,
from_entity_id: `entity-${index}`, to_entity_id: `entity-${(index + 1) % 600}` }))
graph.eventEntities = graph.events.map((event, index) => ({ event_id: event.id, entity_id: `entity-${index}` }))
graph.eventSources = graph.events.map(event => ({ event_id: event.id, source_id: 'source-1' }))
}
if (params.has('short')) {
graph.events = graph.events.slice(0, 1)
graph.entities = graph.entities.slice(0, 1)
@@ -310,6 +317,20 @@ if (params.has('portable')) {
run: async () => { throw new Error('Read-only acceptance must not run reviews') }
})
}
if (windowed) {
const api = window.goodbuddy.supervision
const calls = { graph: 0, source: 0, edits: 0 }
const updateCalls = () => { document.documentElement.dataset.supervisorCalls = JSON.stringify(calls) }
const readGraph = api.graph, readSource = api.source
api.graph = async input => { calls.graph++; updateCalls(); return readGraph(input) }
api.source = async input => { calls.source++; updateCalls(); return readSource(input) }
api.entityAction = async input => {
calls.edits++; updateCalls()
const entity = graph.entities.find(item => item.id === input.entityId)
if (entity && input.action === 'revise' && input.label) entity.canonical_label = input.label
}
updateCalls()
}
const noop = async () => {}
createRoot(document.getElementById('root')!).render(
<UiLocaleProvider initialPreference="zh-CN">