fix(team): map suffixed runtime metadata to launch statuses
This commit is contained in:
parent
560e14d5ad
commit
6ea8b469f0
2 changed files with 51 additions and 2 deletions
|
|
@ -11265,7 +11265,19 @@ export class TeamProvisioningService {
|
||||||
const runtimeByMember = await this.getLiveTeamAgentRuntimeMetadata(teamName);
|
const runtimeByMember = await this.getLiveTeamAgentRuntimeMetadata(teamName);
|
||||||
const nextStatuses = { ...statuses };
|
const nextStatuses = { ...statuses };
|
||||||
for (const [memberName, metadata] of runtimeByMember.entries()) {
|
for (const [memberName, metadata] of runtimeByMember.entries()) {
|
||||||
const current = nextStatuses[memberName];
|
const resolvedStatusKey =
|
||||||
|
nextStatuses[memberName] != null
|
||||||
|
? memberName
|
||||||
|
: (() => {
|
||||||
|
const matches = Object.keys(nextStatuses).filter((candidateName) =>
|
||||||
|
matchesTeamMemberIdentity(candidateName, memberName)
|
||||||
|
);
|
||||||
|
return matches.length === 1 ? matches[0] : null;
|
||||||
|
})();
|
||||||
|
if (!resolvedStatusKey) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const current = nextStatuses[resolvedStatusKey];
|
||||||
if (!current) {
|
if (!current) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -11288,7 +11300,7 @@ export class TeamProvisioningService {
|
||||||
nextEntry.livenessSource = current.bootstrapConfirmed ? current.livenessSource : 'process';
|
nextEntry.livenessSource = current.bootstrapConfirmed ? current.livenessSource : 'process';
|
||||||
nextEntry.launchState = deriveMemberLaunchState(nextEntry);
|
nextEntry.launchState = deriveMemberLaunchState(nextEntry);
|
||||||
}
|
}
|
||||||
nextStatuses[memberName] = nextEntry;
|
nextStatuses[resolvedStatusKey] = nextEntry;
|
||||||
}
|
}
|
||||||
return nextStatuses;
|
return nextStatuses;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5554,6 +5554,43 @@ describe('TeamProvisioningService', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('maps suffixed live runtime metadata keys back onto canonical spawn statuses', async () => {
|
||||||
|
const svc = new TeamProvisioningService();
|
||||||
|
(svc as any).getLiveTeamAgentRuntimeMetadata = vi.fn(
|
||||||
|
async () =>
|
||||||
|
new Map([
|
||||||
|
[
|
||||||
|
'bob-2',
|
||||||
|
{
|
||||||
|
alive: true,
|
||||||
|
model: 'gpt-5.2',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
|
const result = await (svc as any).attachLiveRuntimeMetadataToStatuses('beacon-desk-4', {
|
||||||
|
bob: createMemberSpawnStatusEntry({
|
||||||
|
status: 'error',
|
||||||
|
launchState: 'failed_to_start',
|
||||||
|
error: 'Teammate did not join within the launch grace window.',
|
||||||
|
hardFailure: true,
|
||||||
|
hardFailureReason: 'Teammate did not join within the launch grace window.',
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result.bob).toMatchObject({
|
||||||
|
status: 'online',
|
||||||
|
launchState: 'runtime_pending_bootstrap',
|
||||||
|
runtimeAlive: true,
|
||||||
|
hardFailure: false,
|
||||||
|
hardFailureReason: undefined,
|
||||||
|
error: undefined,
|
||||||
|
runtimeModel: 'gpt-5.2',
|
||||||
|
livenessSource: 'process',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('does not clear an explicit restart failure just because the old runtime is still alive', async () => {
|
it('does not clear an explicit restart failure just because the old runtime is still alive', async () => {
|
||||||
const svc = new TeamProvisioningService();
|
const svc = new TeamProvisioningService();
|
||||||
(svc as any).getLiveTeamAgentRuntimeMetadata = vi.fn(
|
(svc as any).getLiveTeamAgentRuntimeMetadata = vi.fn(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue