Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
822b977
fix(orchestration): steer mail notices into a busy native chat's runn…
brennanb2025 Oct 14, 2026
4f1d256
fix(orchestration): drain mail that arrives while a notice is pending
brennanb2025 Oct 14, 2026
ddce215
fix(orchestration): native chats get each orchestration message whole…
brennanb2025 Oct 14, 2026
25273a3
fix(orchestration): keep the at-most-once gate's mail-lane assertions…
brennanb2025 Oct 14, 2026
bb6645d
Preserve native mail compatibility and drain delivery backlogs
brennanb2025 Oct 14, 2026
9a3b380
Drain native mail with a finite ordered pass and scoped operation own…
brennanb2025 Oct 14, 2026
c8ec903
Bound mail formatting and honor accepted queue handoffs
brennanb2025 Oct 14, 2026
2d7bc07
Merge main into orchestration-mail-content and rebuild native mail on…
brennanb2025 Oct 16, 2026
2f006fc
Run the native mail tests that open SQLite in the Node runtime project
brennanb2025 Oct 17, 2026
1798eae
Preserve live mailbox ownership and recover full reports by id
brennanb2025 Oct 17, 2026
f2cbf3a
Use a typed runtime client in inbox compatibility test
brennanb2025 Oct 17, 2026
0262f55
Preserve historical mail evidence and scope the test clock
brennanb2025 Oct 17, 2026
021e26d
Map historical structured-send evidence to the current test command
brennanb2025 Oct 17, 2026
9c6168d
fix(orchestration): settle mail handoffs per message and recover inte…
brennanb2025 Oct 22, 2026
5c181f8
Hold native chat mail until the chat is idle, as terminal mail waits
brennanb2025 Oct 23, 2026
fe6c675
test: cover idle orchestration report turns
brennanb2025 Oct 23, 2026
e3d767a
fix: preserve independent mail authorization through grouped delivery
brennanb2025 Oct 23, 2026
1cbdded
fix: preserve routed mail identity and private inbox state
brennanb2025 Oct 24, 2026
3545d0c
test: bound mailbox query work on repeated delivery
brennanb2025 Oct 24, 2026
505b722
Merge origin/main into brennanb2025/fix-stuck-codex-review
brennanb2025 Oct 24, 2026
8c4ec2e
Merge origin/main to resolve current integration conflicts
brennanb2025 Oct 24, 2026
04e58b0
fix(orchestration): consolidate terminal mail imports
brennanb2025 Oct 24, 2026
c35b0fc
Validate mailbox query rows and type delivery fixtures
brennanb2025 Oct 24, 2026
6342786
Keep host forwarders typed and inline single-use mail evidence reader
brennanb2025 Oct 24, 2026
8c96b57
Merge origin/main to include adapter lint repair
brennanb2025 Oct 24, 2026
b5516cc
Declare the mail handoff store method boundary
brennanb2025 Oct 24, 2026
fa658a3
Preserve mailbox contracts across typed boundaries
brennanb2025 Oct 24, 2026
0c4d606
Retain existing main cleanup row boundaries
brennanb2025 Oct 24, 2026
b29676d
Fix mailbox handoff fixtures and helper mail transfer
brennanb2025 Oct 24, 2026
bf68389
Name the mailbox fixture constructor type
brennanb2025 Oct 24, 2026
3679048
Merge main into mail recovery fix
brennanb2025 Oct 25, 2026
6b9ce8b
test: complete mailbox dialog pane identity
brennanb2025 Oct 25, 2026
d7eb6e7
Merge delivery settlement with durable personal mail boundaries
brennanb2025 Oct 25, 2026
ccaf163
Keep structured mail ordering and ownership current at claim
brennanb2025 Oct 26, 2026
fcda71c
Bound mailbox preparation and immutable cohort selection
brennanb2025 Oct 26, 2026
5650038
Consolidate structured mail contract fixtures
brennanb2025 Oct 26, 2026
11f8ca1
Merge stack base into mail delivery branch
brennanb2025 Oct 26, 2026
c438508
Consolidate duplicate mailbox imports
brennanb2025 Oct 26, 2026
f10475c
Fix mail handoff type contracts and deterministic test fixtures
brennanb2025 Oct 26, 2026
44f5bfa
Repair journal forwarding and align mail contract fixtures
brennanb2025 Oct 26, 2026
426fe86
Fix mailbox corpus message type inference
brennanb2025 Oct 26, 2026
4c22f1c
Correct personal provenance in ACP backlog fixtures
brennanb2025 Oct 26, 2026
4ae2d04
Correct ACP mail contract measurement and epoch wake fixtures
brennanb2025 Oct 26, 2026
a16034d
Retain full ACP contract diagnostic arguments
brennanb2025 Oct 26, 2026
46529d1
Restore reliability gate coverage and consolidate mail fixtures
brennanb2025 Oct 26, 2026
f674356
Preserve unknown alias release coverage
brennanb2025 Oct 26, 2026
fc763c9
Route native reports through the durable chat queue
brennanb2025 Oct 27, 2026
22a0472
Preserve exact legacy mail holds in queue lineage proof
brennanb2025 Oct 27, 2026
fd6ee95
Merge pinned main for ordinary queue reconstruction
brennanb2025 Oct 28, 2026
39a039b
Use ordinary queued messages for worker reports
brennanb2025 Oct 28, 2026
ae4a2f8
Use semantic queue and check completion for report delivery
brennanb2025 Oct 28, 2026
5e08e23
Record bounded queue recovery work and request cleanup proofs
brennanb2025 Oct 28, 2026
ea91728
Preserve report creation evidence and bounded source wakes
brennanb2025 Oct 28, 2026
c6d7786
Preserve report source work and check ownership
brennanb2025 Oct 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions config/reliability-gates.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,8 @@
"oracle": "Inject adapter/RPC acknowledgement loss, caller replacement, logical-client close after response, auth recovery with a written request, missing host submissions, legacy pending rows, stale fences, expiry, mobile remount, and phone storage refusal. Assert at most one dispatch for repeated transmission of one operation. For a later phone Send, assert a fresh id and second delivery while the original host entry remains unknown; equal images use current uploaded paths and delivery fields follow current host capabilities.",
"commands": [
"ORCA_BACKGROUND_LAUNCH=1 pnpm test src/shared/agent-session-operation-ledger.test.ts src/shared/structured-agent-session-send-evidence.test.ts src/main/runtime/agent-session/ownership/agent-session-operation-admission.test.ts src/main/native-chat/agent-session-wire/structured-agent-session-send-idempotency.test.ts src/main/native-chat/agent-session-wire/structured-agent-session-send.test.ts src/main/runtime/orchestration/structured-mailbox-pointer-delivery.test.ts src/main/runtime/orchestration/structured-mailbox-pointer-host.test.ts src/main/runtime/orchestration/structured-pointer-operation-id.test.ts src/renderer/src/components/native-chat/structured-agent-session-message-sender.test.ts src/renderer/src/components/native-chat/use-structured-agent-session.test.tsx src/renderer/src/lib/launch-structured-agent-session.test.ts",
"ORCA_BACKGROUND_LAUNCH=1 pnpm --dir mobile test ../mobile/src/session/mobile-structured-send-new-action.test.ts ../mobile/src/session/use-mobile-structured-agent-session-send.test.tsx ../mobile/src/session/use-mobile-structured-agent-session-queued.test.tsx ../mobile/src/session/mobile-structured-send-delivery.test.ts ../mobile/src/session/use-mobile-structured-agent-session-background-tasks.test.tsx ../mobile/src/session/use-mobile-structured-agent-session-newer-approval-send.test.tsx ../mobile/src/session/use-mobile-structured-agent-session-read-failure.test.tsx ../mobile/src/session/use-mobile-structured-agent-session.test.tsx ../mobile/src/session/use-mobile-structured-agent-session-prompt-cancel.test.tsx ../mobile/src/session/native-chat/composer/mobile-native-chat-image-attachment.test.ts ../mobile/src/session/native-chat/composer/use-mobile-native-chat-image-attachments.test.ts ../mobile/src/session/use-mobile-structured-native-chat-send-bridge.test.ts ../mobile/src/mobile-web-shell/page-storage-keys.test.ts ../mobile/src/mobile-web-shell/bridge/page-async-storage.test.ts ../mobile/src/mobile-web-shell/use-page-host-snapshot.test.tsx ../mobile/src/mobile-web-shell/bridge-host-init.test.ts ../mobile/src/transport/mobile-relay-rpc-session.test.ts ../mobile/src/transport/rpc-client-delivery-ambiguity.test.ts ../mobile/src/transport/stable-logical-rpc-client.test.ts --maxWorkers=2"
"ORCA_BACKGROUND_LAUNCH=1 pnpm --dir mobile test ../mobile/src/session/mobile-structured-send-new-action.test.ts ../mobile/src/session/use-mobile-structured-agent-session-send.test.tsx ../mobile/src/session/use-mobile-structured-agent-session-queued.test.tsx ../mobile/src/session/mobile-structured-send-delivery.test.ts ../mobile/src/session/use-mobile-structured-agent-session-background-tasks.test.tsx ../mobile/src/session/use-mobile-structured-agent-session-newer-approval-send.test.tsx ../mobile/src/session/use-mobile-structured-agent-session-read-failure.test.tsx ../mobile/src/session/use-mobile-structured-agent-session.test.tsx ../mobile/src/session/use-mobile-structured-agent-session-prompt-cancel.test.tsx ../mobile/src/session/native-chat/composer/mobile-native-chat-image-attachment.test.ts ../mobile/src/session/native-chat/composer/use-mobile-native-chat-image-attachments.test.ts ../mobile/src/session/use-mobile-structured-native-chat-send-bridge.test.ts ../mobile/src/mobile-web-shell/page-storage-keys.test.ts ../mobile/src/mobile-web-shell/bridge/page-async-storage.test.ts ../mobile/src/mobile-web-shell/use-page-host-snapshot.test.tsx ../mobile/src/mobile-web-shell/bridge-host-init.test.ts ../mobile/src/transport/mobile-relay-rpc-session.test.ts ../mobile/src/transport/rpc-client-delivery-ambiguity.test.ts ../mobile/src/transport/stable-logical-rpc-client.test.ts --maxWorkers=2",
"ORCA_BACKGROUND_LAUNCH=1 pnpm test src/main/native-chat/agent-session-wire/structured-agent-session-mail-queue.test.ts src/main/native-chat/agent-session-wire/structured-agent-session-mail-creation-recovery.test.ts"
],
"testFiles": [
"src/shared/agent-session-operation-ledger.test.ts",
Expand All @@ -2033,6 +2034,8 @@
"src/main/runtime/orchestration/structured-mailbox-pointer-delivery.test.ts",
"src/main/runtime/orchestration/structured-mailbox-pointer-host.test.ts",
"src/main/runtime/orchestration/structured-pointer-operation-id.test.ts",
"src/main/native-chat/agent-session-wire/structured-agent-session-mail-queue.test.ts",
"src/main/native-chat/agent-session-wire/structured-agent-session-mail-creation-recovery.test.ts",
"src/renderer/src/components/native-chat/structured-agent-session-message-sender.test.ts",
"src/renderer/src/components/native-chat/use-structured-agent-session.test.tsx",
"src/renderer/src/lib/launch-structured-agent-session.test.ts",
Expand Down Expand Up @@ -2086,12 +2089,16 @@
"assertions": ["reuses an option operation after a pending admission refusal"]
},
{
"file": "src/main/runtime/orchestration/structured-mailbox-pointer-delivery.test.ts",
"assertions": ["retries a rejected nudge on the next journal edge"]
"file": "src/main/native-chat/agent-session-wire/structured-agent-session-mail-queue.test.ts",
"assertions": [
"recovers only the original ordinary creation after ambiguous acceptance, a lost delivered stamp, edits, Move, Delete, epoch retirement, read and resetTasks"
]
},
{
"file": "src/main/runtime/orchestration/structured-pointer-operation-id.test.ts",
"assertions": ["never re-mints an ambiguous batch after the host replay window expires"]
"file": "src/main/native-chat/agent-session-wire/structured-agent-session-mail-creation-recovery.test.ts",
"assertions": [
"reconciles a saved random batch through original receipt/member history N=%i after Delete and restart, without recreating either report"
]
},
{
"file": "mobile/src/transport/rpc-client-delivery-ambiguity.test.ts",
Expand Down Expand Up @@ -2129,7 +2136,8 @@
"date": "2026-10-13",
"runner": "local",
"platform": "macos",
"command": "ORCA_BACKGROUND_LAUNCH=1 pnpm test src/shared/agent-session-operation-ledger.test.ts src/shared/structured-agent-session-send-evidence.test.ts src/main/runtime/agent-session/ownership/agent-session-operation-admission.test.ts src/main/native-chat/agent-session-wire/structured-agent-session-send-idempotency.test.ts src/main/native-chat/agent-session-wire/structured-agent-session-send.test.ts src/main/runtime/orchestration/structured-mailbox-pointer-delivery.test.ts src/main/runtime/orchestration/structured-mailbox-pointer-host.test.ts src/main/runtime/orchestration/structured-pointer-operation-id.test.ts src/renderer/src/components/native-chat/structured-agent-session-message-sender.test.ts src/renderer/src/components/native-chat/use-structured-agent-session.test.tsx src/renderer/src/lib/launch-structured-agent-session.test.ts",
"command": "ORCA_BACKGROUND_LAUNCH=1 pnpm test src/shared/agent-session-operation-ledger.test.ts src/shared/structured-agent-session-send-evidence.test.ts src/main/runtime/agent-session-operation-admission.test.ts src/main/native-chat/agent-session-wire/structured-agent-session-send-idempotency.test.ts src/main/native-chat/agent-session-wire/structured-agent-session-send.test.ts src/main/runtime/orchestration/structured-mailbox-pointer-delivery.test.ts src/main/runtime/orchestration/structured-mailbox-pointer-host.test.ts src/main/runtime/orchestration/structured-pointer-operation-id.test.ts src/renderer/src/components/native-chat/structured-agent-session-message-sender.test.ts src/renderer/src/components/native-chat/use-structured-agent-session.test.tsx src/renderer/src/lib/launch-structured-agent-session.test.ts",
"currentCommand": "ORCA_BACKGROUND_LAUNCH=1 pnpm test src/shared/agent-session-operation-ledger.test.ts src/shared/structured-agent-session-send-evidence.test.ts src/main/runtime/agent-session/ownership/agent-session-operation-admission.test.ts src/main/native-chat/agent-session-wire/structured-agent-session-send-idempotency.test.ts src/main/native-chat/agent-session-wire/structured-agent-session-send.test.ts src/main/runtime/orchestration/structured-mailbox-pointer-delivery.test.ts src/main/runtime/orchestration/structured-mailbox-pointer-host.test.ts src/main/runtime/orchestration/structured-pointer-operation-id.test.ts src/renderer/src/components/native-chat/structured-agent-session-message-sender.test.ts src/renderer/src/components/native-chat/use-structured-agent-session.test.tsx src/renderer/src/lib/launch-structured-agent-session.test.ts",
"result": "passed",
"durationSeconds": 6.47,
"summary": "Eleven focused host, shared, renderer and orchestration files passed 196 tests, including unknown send outcomes, reused message IDs and host replay without duplicate dispatch. The send-idempotency suite pins only that an unknown outcome is never resent; the removed refusal-retry matrix has no replacement here."
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Test capability-gated queue writes with authoritative cards; Stop preserves host-held drafts and legacy Edit copies before deleting.

import { createElement } from 'react'
import { createElement, memo } from 'react'
import { agentJournalSubmissionKey } from '../../../src/shared/agent-session-journal-item-key'
import { act, create, type ReactTestRenderer } from 'react-test-renderer'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
Expand Down Expand Up @@ -66,13 +66,19 @@ describe('mobile structured queued messages', () => {
close: () => {}
}

const queueRender = vi.fn()
const QueueObserver = memo(({ cards, pause }: { cards: unknown; pause: unknown }) => {
queueRender(cards, pause)
return null
})

function Harness({
hostSupport,
sessionId = SESSION_ID
}: {
hostSupport: StructuredAgentSessionHostSupport
sessionId?: string
}): null {
}) {
hook = useMobileStructuredAgentSession({
client,
sessionId,
Expand All @@ -84,7 +90,7 @@ describe('mobile structured queued messages', () => {
appendComposerText: appendText,
onSendError
})
return null
return createElement(QueueObserver, { cards: hook.queued.cards, pause: hook.queued.pause })
}

async function mountSession(
Expand Down Expand Up @@ -144,6 +150,27 @@ describe('mobile structured queued messages', () => {
unmountSession()
})

it.each([100, 1000])(
'does not render the mounted N=%i queue consumer for token-only frames',
async (count) => {
const cards = Array.from({ length: count }, (_, position) =>
queuedDraft({ messageId: `report-${position}`, position })
)
await mountSession(CAPABLE, snapshotEvent({ queuedMessages: cards }))
await act(async () => {})
queueRender.mockClear()
await act(async () =>
listener?.({ ...batchEvent(), activity: { turnId: 'working', text: 'token' } })
)
await act(async () => {})
expect(hook?.queued.cards).toHaveLength(count)
expect(queueRender).not.toHaveBeenCalled()
await act(async () => listener?.(batchEvent(cards.slice(1))))
await vi.waitFor(() => expect(hook?.queued.cards).toHaveLength(count - 1))
expect(queueRender).toHaveBeenCalledTimes(1)
}
)

it('reverts an optimistic relative move when the host reports a changed queue', async () => {
const mail = queuedDraft({
messageId: 'mail',
Expand Down Expand Up @@ -700,6 +727,50 @@ describe('mobile structured queued messages', () => {
expect(onSendError).toHaveBeenCalledWith(expect.any(String))
})

it('uses existing Resume for report-only and returned-prefix worker queues and follows the released host state', async () => {
sendRequest.mockImplementation(async (method) =>
method === 'agentSession.queuedMessagesResume'
? mutationOk({ resumed: true })
: method === 'agentSession.options'
? ok({ models: [], current: {} })
: ok({})
)
const worker = queuedDraft({
messageId: 'worker',
position: 2,
body: {
kind: 'message',
role: 'user',
blocks: [],
from: {
kind: 'agent',
senders: [],
orchestration: {
message: 'mail-notice',
mailbox: 'run:r',
dispatchId: null,
messages: []
}
}
}
})
await mountSession(CAPABLE, snapshotEvent({ queuedMessages: [worker] }))
for (const cards of [
[worker],
[queuedDraft({ messageId: 'returned', state: 'returned', returnedReason: null }), worker]
]) {
act(() => listener?.(batchEvent(cards, [], { reason: 'stopped' })))
expect(hook!.queued.pause).toEqual({ reason: 'stopped' })
expect(hook!.queued.cards.find((card) => card.messageId === 'worker')?.hold).toBe('turn')
await act(async () => expect(await hook!.queued.resume()).toBe(true))
expect(Object.keys(requestOf('agentSession.queuedMessagesResume').params)).toEqual([
'envelope'
])
act(() => listener?.(batchEvent(cards, [], null)))
expect(hook!.queued.pause).toBeNull()
}
})

it('an incapable Stop is exactly today’s cancel', async () => {
sendRequest.mockImplementation(async (method) => {
if (method === 'agentSession.cancel') {
Expand Down
30 changes: 30 additions & 0 deletions src/cli/handlers/orchestration-legacy-read-only.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ vi.mock('../format', () => ({ printResult: vi.fn() }))
vi.mock('../selectors', () => ({ getTerminalHandle: vi.fn() }))

import { printResult } from '../format'
import { parseArgs, validateCommandAndFlags } from '../args'
import { COMMAND_SPECS } from '../specs'
import { RuntimeClient } from '../runtime-client'
import { ORCHESTRATION_HANDLERS } from './orchestration'

beforeEach(() => {
Expand All @@ -14,6 +17,33 @@ beforeEach(() => {
})

describe('legacy orchestration CLI inspection', () => {
it('filters exact-id results from an older host before printing', async () => {
callMock.mockResolvedValue({ result: { messages: [{ id: 'unrelated' }], count: 1 } })
const parsed = parseArgs(
'orchestration inbox --id old_report --terminal term_coord --full'.split(' ')
)
validateCommandAndFlags(COMMAND_SPECS, parsed)
const client = new RuntimeClient('/tmp/orca-pr-28567-cli-test', 60_000, null, null)
client.call = callMock
await ORCHESTRATION_HANDLERS['orchestration inbox']({
flags: parsed.flags,
client,
cwd: '/repo',
json: true
})
const printed = vi.mocked(printResult).mock.calls[0]
expect(callMock).toHaveBeenCalledWith(
'orchestration.inbox',
expect.objectContaining({ id: 'old_report' })
)
expect(printed?.[0].result).toEqual({ messages: [], count: 0 })
const guidance = printed?.[2]({ messages: [], count: 0 })
expect(guidance).toContain(
'same inbox command without --id, keeping its terminal and execution profile'
)
expect(guidance).toContain('--full --limit 100')
expect(guidance).toContain('increase --limit')
})
it('labels legacy rows in plain check output', async () => {
const result = {
messages: [
Expand Down
10 changes: 10 additions & 0 deletions src/cli/handlers/orchestration/message-inbox-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,25 @@ export const ORCHESTRATION_INBOX_HANDLERS: Record<string, CommandHandler> = {

'orchestration inbox': async ({ flags, client, json }) => {
const full = flags.has('full')
const id = getOptionalStringFlag(flags, 'id')
const result = await client.call<{
messages: MessageSummary[]
count: number
}>('orchestration.inbox', {
id,
limit: getOptionalPositiveIntegerFlag(flags, 'limit'),
terminal: getPresentStringFlag(flags, 'terminal')
})
// Older hosts ignore id; never print their unrelated history as an exact lookup.
if (id) {
result.result.messages = result.result.messages.filter((message) => message.id === id)
result.result.count = result.result.messages.length
}
printResult(result, json, (value) => {
if (value.count === 0) {
if (id) {
return `Message ${id} was not returned; an older host may only search recent history. Rerun the same inbox command without --id, keeping its terminal and execution profile, with --full --limit 100 and look for ${id}; increase --limit to look farther back.`
}
return 'No messages.'
}
return value.messages
Expand Down
5 changes: 2 additions & 3 deletions src/cli/specs/orchestration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { GLOBAL_FLAGS, type CommandSpec } from '../args'
import { ORCHESTRATION_WORKER_COMMAND_SPECS } from './orchestration-worker-specs'

export const ORCHESTRATION_COMMAND_SPECS: CommandSpec[] = [
{
path: ['orchestration', 'run-create'],
Expand Down Expand Up @@ -131,8 +130,8 @@ export const ORCHESTRATION_COMMAND_SPECS: CommandSpec[] = [
{
path: ['orchestration', 'inbox'],
summary: 'Show messages across (or for) recipients',
usage: 'orca orchestration inbox [--limit <n>] [--terminal <handle>] [--full] [--json]',
allowedFlags: [...GLOBAL_FLAGS, 'limit', 'terminal', 'full'],
usage: 'orca orchestration inbox [--id <id>] [--limit <n>] [--terminal <handle>] [--full]',
allowedFlags: [...GLOBAL_FLAGS, 'id', 'limit', 'terminal', 'full'],
identityFlagRoles: { terminal: 'target' }
},
{
Expand Down
Loading