Skip to content

Commit e75bc55

Browse files
committed
fix(goal): regenerate the state manifest and pin the v1 close-pause difference
The goal close-pause changes the replayable state manifest and makes v2 report "Paused after agent closed" where v1 still reports "Paused after agent resume". agent-core v1 has no agent close hook, so the behaviour cannot be mirrored there; the parity test now compares every other field and asserts each engine's own reason.
1 parent 0629108 commit e75bc55

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

packages/agent-core-v2/docs/state-manifest.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@ export interface SessionStateSnapshot {
888888
imageUrl: {
889889
url: string;
890890
id?: string;
891+
name?: string;
891892
};
892893
} | /* AudioURLPart — packages/agent-core-v2/src/kosong/contract/message.ts */ {
893894
type: 'audio_url';
@@ -900,6 +901,7 @@ export interface SessionStateSnapshot {
900901
videoUrl: {
901902
url: string;
902903
id?: string;
904+
name?: string;
903905
};
904906
})[];
905907
readonly attachments?: readonly /* PromptFileAttachment — packages/agent-core-v2/src/agent/contextMemory/types.ts */ {

packages/node-sdk/test/v1-v2-parity.test.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3160,15 +3160,28 @@ describe('v1↔v2 goal parity', () => {
31603160
pair.v2.resumeSession({ id: input.sessionId }),
31613161
]);
31623162
// An active goal cannot still be running after a restart: both engines
3163-
// demote it to paused with the same reason on replay.
3163+
// demote it to paused. The reason differs by design and is pinned here.
3164+
// v2 pauses the goal when the agent closes, so its elapsed wall-clock is
3165+
// saved before the session goes away and offline time is not charged; v1
3166+
// has no agent close hook at all, so it only notices on replay. Every
3167+
// other field still compares in full.
31643168
const [v1Got, v2Got] = await Promise.all([pair.v1.getGoal(input), pair.v2.getGoal(input)]);
3165-
const projectGet = KNOWN_DIFFS.getGoal;
3169+
const projectGet = (result: GoalToolResult): unknown => {
3170+
const projected = KNOWN_DIFFS.getGoal(result) as Record<string, unknown>;
3171+
delete projected['terminalReason'];
3172+
return projected;
3173+
};
31663174
expect(projectGet(v2Got)).toEqual(projectGet(v1Got));
31673175
expect(v1Got.goal).toMatchObject({
31683176
status: 'paused',
31693177
objective: 'Persisted parity goal.',
31703178
terminalReason: 'Paused after agent resume',
31713179
});
3180+
expect(v2Got.goal).toMatchObject({
3181+
status: 'paused',
3182+
objective: 'Persisted parity goal.',
3183+
terminalReason: 'Paused after agent closed',
3184+
});
31723185
// The demoted goal resumes identically.
31733186
const [v1Resumed, v2Resumed] = await Promise.all([
31743187
pair.v1.resumeGoal(input),

0 commit comments

Comments
 (0)