mirror of
https://github.com/stablyai/orca.git
synced 2026-10-20 08:03:28 +00:00
fix(native-chat): stop calling a starting chat "mid-handoff"
A send refused because the chat's owner is not settled showed "The session is mid-handoff (<stage>)." in the composer. With the handoff gone, the stages that reach it are a chat that is still starting, or one whose previous agent process has not yet been confirmed stopped. The message now says which of the two it is. The refusal code is unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -133,7 +133,7 @@ describe('admitAgentSessionMutation', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('refuses a writer mid-handoff', () => {
|
||||
it('refuses a writer while the chat is still starting', () => {
|
||||
const admission = admitAgentSessionMutation({
|
||||
...base,
|
||||
lease: { ...LEASE, handoffStage: 'new-owner-proving' },
|
||||
@@ -141,7 +141,23 @@ describe('admitAgentSessionMutation', () => {
|
||||
})
|
||||
expect(admission).toMatchObject({
|
||||
decision: 'refused',
|
||||
refusal: { code: 'agent_session_conflict' }
|
||||
refusal: { code: 'agent_session_conflict', message: 'The chat is still starting.' }
|
||||
})
|
||||
})
|
||||
|
||||
it('names recovery rather than a handoff when a restart left the owner unproven', () => {
|
||||
const admission = admitAgentSessionMutation({
|
||||
...base,
|
||||
lease: { ...LEASE, handoffStage: 'recovering' },
|
||||
ledger: ADMIT('f'.repeat(64))
|
||||
})
|
||||
expect(admission).toMatchObject({
|
||||
decision: 'refused',
|
||||
refusal: {
|
||||
code: 'agent_session_conflict',
|
||||
message:
|
||||
"Orca has not yet confirmed that this chat's previous agent process stopped. Reopen the chat to check again."
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -146,7 +146,10 @@ function refuseUnlessWriterAdmitted(lease: AgentSessionLease): AgentSessionWireR
|
||||
if (lease.handoffStage !== null) {
|
||||
return {
|
||||
code: 'agent_session_conflict',
|
||||
message: `The session is mid-handoff (${lease.handoffStage}).`
|
||||
message:
|
||||
lease.handoffStage === 'new-owner-proving'
|
||||
? 'The chat is still starting.'
|
||||
: "Orca has not yet confirmed that this chat's previous agent process stopped. Reopen the chat to check again."
|
||||
}
|
||||
}
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user