Merge branch 'codex/simp-ui-identity-residue' into codex/simp-hide-concrete-agent-loop
This commit is contained in:
@@ -104,9 +104,10 @@ export function createStdioChat(ctx: Context, config: Config, runtime: StdioRunt
|
|||||||
// with durable parentSession lineage. Keeping the matching candidates also
|
// with durable parentSession lineage. Keeping the matching candidates also
|
||||||
// covers HMR's publish-new-before-dispose-old ordering without ever falling
|
// covers HMR's publish-new-before-dispose-old ordering without ever falling
|
||||||
// through to an unrelated root owned by another app or test fixture.
|
// through to an unrelated root owned by another app or test fixture.
|
||||||
const matchesConfiguredIdentity = (agent: Agent): boolean => config.resumeSessionId === undefined
|
const resumeSessionId = config.resumeSessionId === '' ? undefined : config.resumeSessionId
|
||||||
|
const matchesConfiguredIdentity = (agent: Agent): boolean => resumeSessionId === undefined
|
||||||
? agent.id.startsWith('main-session-')
|
? agent.id.startsWith('main-session-')
|
||||||
: agent.id === config.resumeSessionId
|
: agent.id === resumeSessionId
|
||||||
const configuredRoots = new Set(ctx.agents.roots().filter(matchesConfiguredIdentity))
|
const configuredRoots = new Set(ctx.agents.roots().filter(matchesConfiguredIdentity))
|
||||||
let target: Agent | undefined = [...configuredRoots].at(-1)
|
let target: Agent | undefined = [...configuredRoots].at(-1)
|
||||||
ctx.on('agent/created', (agent) => {
|
ctx.on('agent/created', (agent) => {
|
||||||
|
|||||||
@@ -747,6 +747,15 @@ describe('createStdioChat input', () => {
|
|||||||
await new Promise(r => setImmediate(r))
|
await new Promise(r => setImmediate(r))
|
||||||
expect(agent.sent).toHaveLength(1)
|
expect(agent.sent).toHaveLength(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('treats an empty resume session id as a fresh configured identity', async () => {
|
||||||
|
const { ctx, input } = await setup({ welcome: 'w', resumeSessionId: '' })
|
||||||
|
const agent = makeAgent('main-session-fresh')
|
||||||
|
ctx.agents.register(agent)
|
||||||
|
input.feed('hi')
|
||||||
|
await new Promise(r => setImmediate(r))
|
||||||
|
expect(agent.sent).toHaveLength(1)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('createStdioChat EOF exit', () => {
|
describe('createStdioChat EOF exit', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user