From bc35114839a2298cefe080fc3c3602108513785d Mon Sep 17 00:00:00 2001 From: Jinwoo-H Date: Sun, 8 Nov 2026 03:36:47 -0500 Subject: [PATCH] Keep chat reach checks out of per-publication attention and Crew rebuilds --- src/main/runtime/orchestration/crew/crew-party-snapshot.ts | 6 +++++- .../workers/lifecycle/session-worker-liveness.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/runtime/orchestration/crew/crew-party-snapshot.ts b/src/main/runtime/orchestration/crew/crew-party-snapshot.ts index f8f127c48d7..5138af1f54a 100644 --- a/src/main/runtime/orchestration/crew/crew-party-snapshot.ts +++ b/src/main/runtime/orchestration/crew/crew-party-snapshot.ts @@ -19,6 +19,7 @@ import { sessionActivityEvidence } from '../../../../shared/orchestration/fleet/orchestration-fleet-worker-projection' import { createSessionWorkerLivenessReader } from '../workers/lifecycle/session-worker-liveness' +import { isStructuredWorkerHandle } from '../../../../shared/orchestration/workers/structured-worker-handle' import { federatedMessageNamesOnlyHome } from '../workers/reports/dispatch-report-mailbox' import { workerReportRefusal } from '../workers/reports/worker-report-admission' import { isEquivalentPaneKey } from '../db/pane-key-match' @@ -154,7 +155,10 @@ export function buildCrewSnapshot( evidence.binding.terminalHandle === target.terminalHandle && evidence.binding.paneKey === target.paneKey && (evidence.binding.kind !== 'worker' || evidence.binding.dispatchId === assignment?.id))) - const session = worker ? observeSession(worker) : undefined + // Chats keep their own status row: their reach check queries SQLite on every Crew rebuild. + const session = isStructuredWorkerHandle(worker?.agentTerminalHandle) + ? observeSession(worker!) + : undefined const fresh = session ? sessionActivityEvidence(session) : bound && projectLiveness({ resource: null }, evidence, now).verdict === 'live' diff --git a/src/main/runtime/orchestration/workers/lifecycle/session-worker-liveness.ts b/src/main/runtime/orchestration/workers/lifecycle/session-worker-liveness.ts index d78ad540001..022a30e3a6c 100644 --- a/src/main/runtime/orchestration/workers/lifecycle/session-worker-liveness.ts +++ b/src/main/runtime/orchestration/workers/lifecycle/session-worker-liveness.ts @@ -77,7 +77,7 @@ export type DispatchSessionObserver = ( dispatch: Pick ) => FleetSessionObservation | undefined -/** One verdict per Dispatch, so a batched attention pass reads the verdict its pane projection took. */ +/** Structured workers' verdicts for per-pane attention, once per Dispatch so the batched pass reads the same one. */ export function createDispatchSessionLivenessReader( ...args: Parameters ): { @@ -88,6 +88,10 @@ export function createDispatchSessionLivenessReader( const byDispatch = new Map() return { observe: (dispatch) => { + // A chat's reach check queries SQLite; this runs per publication, so chats keep their status row here. + if (!isStructuredWorkerHandle(dispatch.assignee_handle)) { + return undefined + } if (!byDispatch.has(dispatch.id)) { byDispatch.set( dispatch.id,