fix: prevent stale-runtime display on team lead for OpenCode teams

The team lead's runtime is tracked via config.leadSessionId, not as a
spawned runtime process. In the OpenCode adapter path,
buildTeamAgentRuntimeSnapshot creates a synthetic runtime entry for the
lead with alive:false (no CLI child pid) and no livenessKind, which the
getCurrentRuntimeOfflineVisualState function then classifies as
stale_runtime. This causes every team to show the lead as stale-runtime
permanently.

Add a guard in getCurrentRuntimeOfflineVisualState to skip the
stale_runtime classification when the member is the team lead and the
runtime entry carries the 'lead' backend marker.
This commit is contained in:
ShyamKumar1 2026-05-29 10:20:23 +05:30 committed by 777genius
parent 4458ec1fd7
commit c23ccde24d

View file

@ -949,6 +949,16 @@ function getCurrentRuntimeOfflineVisualState(
spawnBootstrapConfirmed: boolean | undefined,
isTeamProvisioning: boolean | undefined
): MemberLaunchVisualState {
// The team lead's runtime is tracked via config.leadSessionId, not as a
// spawned runtime process. In the OpenCode adapter path,
// buildTeamAgentRuntimeSnapshot creates a synthetic runtime entry for the
// lead with alive:false (no CLI child pid) and no livenessKind — which the
// checks below would classify as stale_runtime. Skip lead entries that
// carry the lead backend marker so every team doesn't show the lead as
// "stale-runtime" permanently.
if (isLeadMember(member) && runtimeEntry?.backendType === 'lead') {
return null;
}
if (runtimeEntry?.livenessKind === 'registered_only') {
return 'registered_only';
}