fix(web): address steering review feedback

This commit is contained in:
imccyu
2026-08-02 17:50:00 +08:00
parent cf918fa05d
commit 7d08e43720
27 changed files with 248 additions and 78 deletions

View File

@@ -264,7 +264,12 @@ export class ReactLoopAgent implements Agent {
message: pending.item.message,
placement: 'steering',
})
this.outbox.push({ message: item.message, steering: true, item })
this.outbox.push({
message: item.message,
steering: true,
item,
...pending.delivery === undefined ? {} : { delivery: pending.delivery },
})
// Publish the replacement only after it is owned by the outbox. Its
// enqueue precedes the old occurrence's discard so reentrant
// cancellation can terminally account for both occurrences.

View File

@@ -179,8 +179,11 @@ describe('addressable inbox operations', () => {
const idle = waitForIdle(ctx, agent)
send(agent, 'open the turn')
const receipt = agent.steer(createUserMessage({
content: [{ type: 'text', text: 'steer this message' }],
source: { kind: 'user' },
}))
await entered.promise
send(agent, 'steer this message')
const queued = enqueued.find(item => inboxText(item) === 'steer this message')!
expect(agent.updateInbox(queued.id, { kind: 'steer' })).toBe('applied')
@@ -194,6 +197,7 @@ describe('addressable inbox operations', () => {
expect(agent.session.events.flatMap(event =>
event.type === 'steering/message' ? [event.data.message] : [],
)).toEqual([queued.message])
expect(await receipt.outcome).toEqual({ status: 'admitted', turn: 1, step: 1 })
expect(agent.updateInbox(queued.id, { kind: 'steer' })).toBe('not-found')
})