Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
aea0ffc
Agent message cards keep their sender's agent icon when the agent can…
brennanb2025 Oct 31, 2026
850b7f3
Preserve known worker agents on federated cards and mail
brennanb2025 Oct 31, 2026
1668b25
Resolve agent message senders through shared host identity
brennanb2025 Oct 31, 2026
be364a5
Retain acquired worker launch identity for later sender snapshots
brennanb2025 Oct 31, 2026
33bc763
Prune repeated worker sender contract checks
brennanb2025 Oct 31, 2026
ce8fffd
Merge main into worker card icon branch
brennanb2025 Oct 31, 2026
c27de2a
Combine worker command contract projection imports
brennanb2025 Oct 31, 2026
d471882
Keep sender identity bounded and scoped per worktree
brennanb2025 Oct 31, 2026
c4d23de
Save each agent card's sender identity and open the pane it names
brennanb2025 Oct 31, 2026
baf7258
Resolve agent card senders by the terminal handle every card saves
brennanb2025 Oct 31, 2026
37fb76a
Send sender identity once per revision and judge every host by one rule
brennanb2025 Oct 31, 2026
6ea5f4a
CI: keep the sender delivery contract test out of the web project and…
brennanb2025 Oct 31, 2026
ce6d1bb
Merge #36653 (worker card icon) head into worker card identity
brennanb2025 Oct 31, 2026
fa037fd
CI: share the dispatch-address link rule and align the merged view te…
brennanb2025 Oct 31, 2026
a62d7f4
Merge origin/main into worker-card-icon
brennanb2025 Oct 31, 2026
fe50fad
Use the sender snapshot resolver in main's new receiving-account tests
brennanb2025 Oct 31, 2026
b7c70ba
Read a saved "unknown" agent kind as no kind for the card's icon and …
brennanb2025 Oct 31, 2026
fc12196
Apply a frame's sender scopes when the window receives it, ordered by…
brennanb2025 Oct 31, 2026
9f888e6
Read chat senders from open chats and their /clear predecessors, not …
brennanb2025 Oct 31, 2026
9193070
Walk live terminals once per session-tab inventory or broadcast, not …
brennanb2025 Oct 31, 2026
1b5fea2
Re-read a tab bucket's sender aliases only when a host it read changes
brennanb2025 Oct 31, 2026
05877ec
Merge #36653 (worker card icon, with main) into worker card identity
brennanb2025 Oct 31, 2026
1bb54d8
CI: restore the single-frame builder declaration and compare sender c…
brennanb2025 Oct 31, 2026
e0d165f
CI: give the sender no-op test's heartbeat a fixed timestamp instead …
brennanb2025 Oct 31, 2026
318e1a7
CI: assert one terminal walk per orchestration RPC and no identity re…
brennanb2025 Oct 31, 2026
be536c7
CI: reach the sender pass methods through a typed view of their proto…
brennanb2025 Oct 31, 2026
9f92519
CI: list every sender target kind in the link switch and merge the du…
brennanb2025 Oct 31, 2026
24bbddb
Skip a paired host's floating-terminal sender scope at receipt, as th…
brennanb2025 Oct 31, 2026
e876313
Read /clear predecessors through the record store's existing successo…
brennanb2025 Oct 31, 2026
65ff22d
Keep live workers' sender history between builds and re-read only wha…
brennanb2025 Oct 31, 2026
7bece8c
CI: build each sender trigger from a typed event list so its SQL part…
brennanb2025 Oct 31, 2026
4454c4f
CI: give startup runtime fakes the sender peer-key setter and drop ne…
brennanb2025 Oct 31, 2026
b7f201b
Ask the host to reveal a located sender this window holds no tab for,…
brennanb2025 Oct 31, 2026
b1783ea
Keep no worker history read inside an open transaction, and forget wo…
brennanb2025 Oct 31, 2026
d6647be
Test that sender names render only when what they show changes
brennanb2025 Oct 31, 2026
e81a6aa
CI: pass the sender target's dispatch id explicitly and write a real …
brennanb2025 Oct 31, 2026
5bbacf6
Read terminals' existing handles for sender rows instead of issuing them
brennanb2025 Oct 31, 2026
fda6d36
Open a located sender's own pane through its host when this window ha…
brennanb2025 Oct 31, 2026
30b1176
Merge origin/main into worker-card-icon
brennanb2025 Oct 31, 2026
b669dbd
Read a terminal's start-time handle for its sender row while no windo…
brennanb2025 Oct 31, 2026
5c00b08
Merge #36653 (worker card icon, with main 24d1d10da81) into worker ca…
brennanb2025 Oct 31, 2026
3d89386
CI: type the open helper's target as any runtime target so the paired…
brennanb2025 Oct 31, 2026
425c2b6
Lease the sidebar rows a sender name's link check reads, as its avata…
brennanb2025 Oct 31, 2026
f67edc5
Index a build's terminal handle records once instead of scanning them…
brennanb2025 Oct 31, 2026
507b2c0
Lease a replaced card's sidebar rows from where its sender runs befor…
brennanb2025 Oct 31, 2026
80920f0
Merge main (10e35fd76d7) into worker card identity: accept main's rem…
brennanb2025 Oct 31, 2026
0d2eff6
Show a paired host's worker status dot on its card when this window m…
brennanb2025 Oct 31, 2026
35e6c55
Publish a chat sender change even when the terminal read in the same …
brennanb2025 Oct 31, 2026
6124954
Merge main into sender identity review
brennanb2025 Nov 2, 2026
b83bbe4
Merge main into worker sender identity review
brennanb2025 Nov 2, 2026
2653684
Bound sender projection work to current consumers and lineage facts
brennanb2025 Nov 2, 2026
bb89101
Update runtime call assertions for sender demand options
brennanb2025 Nov 2, 2026
37abb7c
Merge current main to resolve sender lineage conflicts
brennanb2025 Nov 2, 2026
01a65ba
Preserve mobile sender navigation availability
brennanb2025 Nov 2, 2026
781bfff
Merge main into worker card identity
brennanb2025 Nov 3, 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
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import {
journalStateScalars
} from './journal-state-layout'
import { readStoredQueuedMessageRow } from './queued-message-stored-row'
import { readAgentMessageSource } from '../../../shared/agent-session/agent-session-message-source'
import { projectStructuredAgentStartItem } from '../../../shared/structured-agent-start-projection'

// Admission keeps the in-memory chat within what this build declares on every path a saved value
// takes into it, so restating that chat on a new epoch never drops a newer build's key.
Expand Down Expand Up @@ -275,3 +277,59 @@ it('reads an open string such as an agent type as a value, and still refuses a k
// @ts-expect-error `host` is a key the stored provider handle does not declare
expect(declared<UndeclaredStorageKeys<Later, Stored>>()).toBeUndefined()
})

it.each(['codex', 'future-agent', undefined, 42])(
'admits actual start, message and queued sender kind %j without losing the sender',
async (agent) => {
const journal = await open(journals)
const sender = {
party: { address: 'term_worker', terminalHandle: 'term_worker', orcaSessionId: null },
name: 'Inspect parser',
agent: 'codex'
}
const body = {
kind: 'message' as const,
role: 'user' as const,
blocks: [{ type: 'text' as const, text: 'Mail' }],
from: { kind: 'agent' as const, senders: [sender], orchestration: null }
}
await journal.appendItem(
item(0),
{ kind: 'agent-start', dispatchId: 'dispatch-1', task: 'Inspect parser', worker: sender },
SCOPE
)
await journal.appendItem(item(1), body, SCOPE)
await journal.queuedMessages.insert({ messageId: 'queued-1', body })
await journals.closeAll()
// A later or damaged writer can change this declared optional value without adding any key.
const records = db()
.prepare(
"SELECT generation, seq, ordinal, value_json FROM journal_outcomes WHERE field IN ('items', 'queue.cards')"
)
.all()
expect(records.length).toBeGreaterThanOrEqual(3)
for (const row of records) {
const json = JSON.stringify(JSON.parse(String(row.value_json)), (key, value) =>
key === 'agent' ? agent : value
)
db()
.prepare(
'UPDATE journal_outcomes SET value_json = ? WHERE generation = ? AND seq = ? AND ordinal = ?'
)
.run(json, Number(row.generation), Number(row.seq), String(row.ordinal))
}
const reopened = await open(journals)
const restored = reopened.snapshot().items
expect(restored).toHaveLength(2)
const fromStart = projectStructuredAgentStartItem(restored[0])?.from
const fromMessage = readAgentMessageSource(
restored[1].body.kind === 'message' ? restored[1].body.from : undefined
)
const expected = typeof agent === 'string' ? agent : undefined
const queued = reopened.queuedMessages.list()[0]
for (const from of [fromStart, fromMessage, readAgentMessageSource(queued.body.from)]) {
expect(from?.senders[0]).toMatchObject({ party: sender.party, name: sender.name })
expect(from?.senders[0].agent).toBe(expected)
}
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const sender = z.object({
.nullable()
.optional(),
name: salvaged,
agent: salvaged,
relation: salvaged
})
const orchestration = z.discriminatedUnion('message', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function createQueuedRigProvider(
link: {
linkId: `link-${fence}`,
handle:
options.agent === 'claude'
identity.agent === 'claude'
? claudeProviderHandle(thread, null)
: codexProviderHandle(thread),
origin: resumes ? ('resumed' as const) : ('created' as const),
Expand Down
1 change: 1 addition & 0 deletions src/main/orcad/orcad-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@
webClientRoot: resolveOrcadWebClientRoot(options.webClientRoot),
...orcadWsPortOptions(options.port)
})
runtime.setAgentSenderPeerKey(() => rpc.getE2EEPublicKey())

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (macos-15)

[node] src/main/orcad/orcad-push-startup.test.ts > leaves agent configs alone when status hooks are off

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:408:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (macos-15)

[node] src/main/orcad/orcad-push-startup.test.ts > installs agent status hooks on the host when it starts

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:382:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (macos-15)

[node] src/main/orcad/orcad-push-startup.test.ts > spawns the daemon while the hook server is still starting

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:341:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (macos-15)

[node] src/main/orcad/orcad-push-startup.test.ts > starts push after RPC identity is available and stops dispatch on shutdown

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:252:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / linux_glibc_floor (ubuntu-22.04)

[node] src/main/orcad/orcad-push-startup.test.ts > leaves agent configs alone when status hooks are off

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:408:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / linux_glibc_floor (ubuntu-22.04)

[node] src/main/orcad/orcad-push-startup.test.ts > installs agent status hooks on the host when it starts

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:382:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / linux_glibc_floor (ubuntu-22.04)

[node] src/main/orcad/orcad-push-startup.test.ts > spawns the daemon while the hook server is still starting

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:341:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / linux_glibc_floor (ubuntu-22.04)

[node] src/main/orcad/orcad-push-startup.test.ts > starts push after RPC identity is available and stops dispatch on shutdown

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:252:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (ubuntu-24.04-arm)

[node] src/main/orcad/orcad-push-startup.test.ts > leaves agent configs alone when status hooks are off

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:408:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (ubuntu-24.04-arm)

[node] src/main/orcad/orcad-push-startup.test.ts > installs agent status hooks on the host when it starts

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:382:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (ubuntu-24.04-arm)

[node] src/main/orcad/orcad-push-startup.test.ts > spawns the daemon while the hook server is still starting

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:341:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (ubuntu-24.04-arm)

[node] src/main/orcad/orcad-push-startup.test.ts > starts push after RPC identity is available and stops dispatch on shutdown

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:252:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / linux_glibc_floor (ubuntu-24.04-arm)

[node] src/main/orcad/orcad-push-startup.test.ts > leaves agent configs alone when status hooks are off

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:408:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / linux_glibc_floor (ubuntu-24.04-arm)

[node] src/main/orcad/orcad-push-startup.test.ts > installs agent status hooks on the host when it starts

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:382:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / linux_glibc_floor (ubuntu-24.04-arm)

[node] src/main/orcad/orcad-push-startup.test.ts > spawns the daemon while the hook server is still starting

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:341:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / linux_glibc_floor (ubuntu-24.04-arm)

[node] src/main/orcad/orcad-push-startup.test.ts > starts push after RPC identity is available and stops dispatch on shutdown

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:252:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (ubuntu-22.04)

[node] src/main/orcad/orcad-push-startup.test.ts > leaves agent configs alone when status hooks are off

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:408:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (ubuntu-22.04)

[node] src/main/orcad/orcad-push-startup.test.ts > installs agent status hooks on the host when it starts

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:382:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (ubuntu-22.04)

[node] src/main/orcad/orcad-push-startup.test.ts > spawns the daemon while the hook server is still starting

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:341:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (ubuntu-22.04)

[node] src/main/orcad/orcad-push-startup.test.ts > starts push after RPC identity is available and stops dispatch on shutdown

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:252:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (windows-2022)

[node] src/main/orcad/orcad-push-startup.test.ts > leaves agent configs alone when status hooks are off

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:408:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (windows-2022)

[node] src/main/orcad/orcad-push-startup.test.ts > installs agent status hooks on the host when it starts

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:382:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (windows-2022)

[node] src/main/orcad/orcad-push-startup.test.ts > spawns the daemon while the hook server is still starting

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:341:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (windows-2022)

[node] src/main/orcad/orcad-push-startup.test.ts > starts push after RPC identity is available and stops dispatch on shutdown

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:252:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (macos-15-intel)

[node] src/main/orcad/orcad-push-startup.test.ts > leaves agent configs alone when status hooks are off

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:408:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (macos-15-intel)

[node] src/main/orcad/orcad-push-startup.test.ts > installs agent status hooks on the host when it starts

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:382:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (macos-15-intel)

[node] src/main/orcad/orcad-push-startup.test.ts > spawns the daemon while the hook server is still starting

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:341:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (macos-15-intel)

[node] src/main/orcad/orcad-push-startup.test.ts > starts push after RPC identity is available and stops dispatch on shutdown

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:252:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (windows-11-arm)

[node] src/main/orcad/orcad-push-startup.test.ts > leaves agent configs alone when status hooks are off

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:408:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (windows-11-arm)

[node] src/main/orcad/orcad-push-startup.test.ts > installs agent status hooks on the host when it starts

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:382:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (windows-11-arm)

[node] src/main/orcad/orcad-push-startup.test.ts > spawns the daemon while the hook server is still starting

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:341:16

Check failure on line 309 in src/main/orcad/orcad-entry.ts

View workflow job for this annotation

GitHub Actions / persistence (windows-11-arm)

[node] src/main/orcad/orcad-push-startup.test.ts > starts push after RPC identity is available and stops dispatch on shutdown

TypeError: runtime.setAgentSenderPeerKey is not a function ❯ startOrcadRuntime src/main/orcad/orcad-entry.ts:309:11 ❯ src/main/orcad/orcad-lifecycle.ts:152:20 ❯ startOrcadWithLifecycle src/main/orcad/orcad-lifecycle.ts:121:20 ❯ startOrcad src/main/orcad/orcad-entry.ts:47:41 ❯ src/main/orcad/orcad-push-startup.test.ts:252:16
// Stop RPC before cleanup can tear down writers and runtime state.
registerCleanup(() => rpc.stop())
await timed('rpc', () => rpc.start())
Expand Down
1 change: 1 addition & 0 deletions src/main/runtime/agent-session-record-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export class AgentSessionRecordStore extends AgentSessionRecordTabs {

getConversation = (sessionId: string) => getAgentSessionConversation(this.state, sessionId)
listConversations = () => listAgentSessionConversations(this.state)
senderIdentityRevision = (): number => this.transactions.senderIdentityRevision
selectWritableRecord = (sessionId: string) =>
selectWritableAgentSessionRecord(this.state, sessionId)
requireWritableRecord = (sessionId: string) =>
Expand Down
32 changes: 32 additions & 0 deletions src/main/runtime/agent-session-sender-identity-revision.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { agentSessionScopeKey, type AgentSessionRecord } from '../../shared/agent-session-record'
import type { AgentSessionStoreState } from './agent-session-store-state'
import type { AgentSessionStoreRowWrites } from './agent-session-store-draft'

function senderFacts(record: AgentSessionRecord | undefined): string | undefined {
if (!record) {
return undefined
}
const command = record.conversationCommand
const clearedInto =
command?.command === 'clear' && command.phase === 'committed'
? (command.replacementSessionId ?? null)
: null
return JSON.stringify([agentSessionScopeKey(record.location), clearedInto])
}

/** Whether a commit changed what chat sender identity reads: which chats exist, where they run,
* their committed /clear successor, or which have open tabs. Lease renewals and receipts don't. */
export function changesAgentSenderIdentity(
published: AgentSessionStoreState,
draft: AgentSessionStoreState,
writes: AgentSessionStoreRowWrites
): boolean {
return (
writes.sessionTabs !== null ||
writes.records.remove.length > 0 ||
writes.records.upsert.some(
([sessionId]) =>
senderFacts(published.records.get(sessionId)) !== senderFacts(draft.records.get(sessionId))
)
)
}
6 changes: 6 additions & 0 deletions src/main/runtime/agent-session-store-transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
draftAgentSessionStoreState,
type AgentSessionStoreRowWrites
} from './agent-session-store-draft'
import { changesAgentSenderIdentity } from './agent-session-sender-identity-revision'

// Commit validated draft rows atomically before publication; failures discard the draft.
// The promise queue preserves FIFO and defers BEGIN beyond the caller's open journal transaction.
Expand Down Expand Up @@ -88,6 +89,8 @@ export class AgentSessionStoreTransactions {
private readonly admittedSends = new Map<string, number>()
readonly acceptedSendListeners = new Set<(sessionId: string) => void>()
private published: AgentSessionStoreState
/** Moves only when a commit changes what chat sender identity reads. */
senderIdentityRevision = 0
/** Loaded takeover evidence; immutable for this runtime. */
readonly replacedRuntimes: ReadonlyMap<string, AgentSessionReplacedRuntime>

Expand Down Expand Up @@ -227,6 +230,9 @@ export class AgentSessionStoreTransactions {
adopt: () => {
if (writes) {
freezeRows(draft, writes)
if (changesAgentSenderIdentity(published, draft, writes)) {
this.senderIdentityRevision++
}
this.published = draft
}
}
Expand Down
78 changes: 78 additions & 0 deletions src/main/runtime/construction/runtime-agent-projections.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { RuntimeAgentSenderAssociations } from '../runtime-agent-sender-associations'
import { fingerprintOrchestrationPeer } from '../orchestration/environment-transport'
import {
RuntimeAgentOrchestrationProjection,
type RuntimeAgentOrchestrationDependencies
} from '../runtime-agent-orchestration-projection'
import type { RuntimeConstructionServices } from './runtime-construction-services'
import { environmentStoreWriteCount } from '../../../shared/runtime-environment-store-file'
import type { AgentSenderPrincipal } from '../runtime-agent-sender-history'

type SenderHost = Pick<
RuntimeConstructionServices,
'getExistingOrchestrationDb' | 'resolveOrchestrationWorkerServer'
>

export function createRuntimeAgentProjections(
host: SenderHost,
dependencies: RuntimeAgentOrchestrationDependencies
) {
let historyChecked = false
let peerKey: () => string | null = () => null
// Pairings change only by registry writes; resolving reads several files, so not per Dispatch change.
const principals = new Map<string, AgentSenderPrincipal | undefined>()
let pairing = environmentStoreWriteCount()
const senders = new RuntimeAgentSenderAssociations({
...dependencies,
getDb: () => {
const db = dependencies.getDb()
if (db || historyChecked) {
return db
}
historyChecked = true
try {
return host.getExistingOrchestrationDb()
} catch (error) {
// Display bookkeeping must not surface an open failure; orchestration's own use reports it.
console.warn('[runtime] Sender identity history unavailable', error)
return null
}
},
peerFingerprint: () => {
const key = peerKey()
return key ? fingerprintOrchestrationPeer(key) : undefined
},
pairingGeneration: environmentStoreWriteCount,
principal: (environmentId) => {
if (pairing !== environmentStoreWriteCount()) {
pairing = environmentStoreWriteCount()
principals.clear()
}
if (!principals.has(environmentId)) {
principals.set(environmentId, resolvePrincipal(host, environmentId))
}
return principals.get(environmentId)
}
})
return {
orchestration: new RuntimeAgentOrchestrationProjection(dependencies),
senders,
/** The RPC server owns the pairing key clients authenticate this host by. */
setPeerKey: (read: () => string | null) => {
peerKey = read
}
}
}

function resolvePrincipal(
host: SenderHost,
environmentId: string
): AgentSenderPrincipal | undefined {
try {
const { peerFingerprint, homePeerFingerprint } =
host.resolveOrchestrationWorkerServer(environmentId)
return homePeerFingerprint ? { peerFingerprint, homePeerFingerprint } : undefined
} catch {
return undefined
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import type { PtyPane, PtyPaneSource } from '../terminal/surface/pty-pane-query'

export abstract class RuntimeConstructionServices {
abstract getOrchestrationDb(): OrchestrationDb
abstract getExistingOrchestrationDb(): OrchestrationDb | null
abstract listRepos(): Repo[]
abstract invalidateResolvedWorktreeCache(): void
abstract invalidateWorktreeScanCacheForRepo(repoId: string): void
Expand Down
10 changes: 6 additions & 4 deletions src/main/runtime/construction/runtime-service-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import type { BrowserBackend } from '../../browser/browser-backend'
import type { EmulatorBridge } from '../../emulator/emulator-bridge'
import { RuntimeResolvedWorktreeCache } from '../runtime-resolved-worktree-cache'
import { RuntimeWorktreeLineageController } from '../runtime-worktree-lineage-controller'
import { RuntimeAgentOrchestrationProjection } from '../runtime-agent-orchestration-projection'
import { createRuntimeAgentProjections } from './runtime-agent-projections'
import { RuntimeTerminalList } from '../runtime-terminal-list'
import { RuntimeManagedWorktreeQueries } from '../runtime-managed-worktree-queries'
import { RuntimePtyForegroundAgent } from '../runtime-pty-foreground-agent'
Expand Down Expand Up @@ -116,7 +116,7 @@ export abstract class OrcaRuntimeWithStopRequestedPtyIds extends OrcaRuntimeWith
showTerminal: (handle) => this.showTerminal(handle)
})

protected readonly agentOrchestrationProjection = new RuntimeAgentOrchestrationProjection({
protected readonly agentProjections = createRuntimeAgentProjections(this, {
getDb: () => this.getOrchestrationDbIfAvailable(),
getLeaves: () => this.leaves.values(),
getPtys: () => this.ptysById.values(),
Expand All @@ -136,6 +136,8 @@ export abstract class OrcaRuntimeWithStopRequestedPtyIds extends OrcaRuntimeWith
}
})

protected readonly agentOrchestrationProjection = this.agentProjections.orchestration

protected readonly terminalList = new RuntimeTerminalList({
getGraphEpoch: () => (this.graphStatus === 'ready' ? this.rendererGraphEpoch : null),
assertGraphEpoch: (epoch) => this.assertStableReadyGraph(epoch),
Expand Down Expand Up @@ -285,8 +287,8 @@ export abstract class OrcaRuntimeWithStopRequestedPtyIds extends OrcaRuntimeWith
resolveStructuredTarget: (mailboxHandle) =>
this.resolveStructuredMailboxTarget(mailboxHandle),
getCliCommand: localOrchestrationCliCommand,
senderName: (party, reportedDispatchId) =>
this.orchestrationSenderNames.nameOf(party, reportedDispatchId),
senderSnapshot: (party, reportedDispatchId) =>
this.orchestrationSenderNames.snapshotOf(party, reportedDispatchId),
host: createStructuredMailboxPointerHost()
})

Expand Down
21 changes: 11 additions & 10 deletions src/main/runtime/orchestration/agent-facing-parity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,17 @@ function runtime(prompts: string[]): OrcaRuntimeService {
const fake: Pick<
OrcaRuntimeService,
'getNestedWorkerMaxDepth' | 'getTerminalOrchestrationCliCommand' | 'sendTerminalAgentPrompt'
> & { orchestrationSenderNames: Pick<OrcaRuntimeService['orchestrationSenderNames'], 'nameOf'> } =
{
orchestrationSenderNames: { nameOf: () => null },
getNestedWorkerMaxDepth: () => 2,
getTerminalOrchestrationCliCommand: () => 'orca',
sendTerminalAgentPrompt: async (handle, text) => {
prompts.push(text)
return { handle, accepted: true, bytesWritten: text.length }
}
> & {
orchestrationSenderNames: Pick<OrcaRuntimeService['orchestrationSenderNames'], 'snapshotOf'>
} = {
orchestrationSenderNames: { snapshotOf: () => ({ name: null, agent: null }) },
getNestedWorkerMaxDepth: () => 2,
getTerminalOrchestrationCliCommand: () => 'orca',
sendTerminalAgentPrompt: async (handle, text) => {
prompts.push(text)
return { handle, accepted: true, bytesWritten: text.length }
}
}
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: preamble delivery reads only the members the fake implements.
return fake as OrcaRuntimeService
}
Expand Down Expand Up @@ -116,7 +117,7 @@ async function renderChatPointer(mailbox: string): Promise<string> {
getMessageWaiters: () => undefined,
resolveStructuredTarget: () => ({ sessionId: CHAT_SESSION, dispatchId: null }),
getCliCommand: localOrchestrationCliCommand,
senderName: () => null,
senderSnapshot: () => ({ name: null, agent: null }),
host: {
readSessionFacts: async () => ({ submissions: [] }),
hasActionablePromptNow: () => false,
Expand Down
31 changes: 20 additions & 11 deletions src/main/runtime/orchestration/agent-message-sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,33 @@ import {
agentMessageSenderName,
type AgentMessageSender
} from '../../../shared/agent-session/agent-session-message-source'
import type { AgentType } from '../../../shared/agent-status-types'
import type { OrchestrationDb } from './db'
import { resolveOrchestrationParty } from './orchestration-party'

/** Use recorded names, never agent-painted titles; reportedDispatchId comes from worker_done. */
export type SenderNameResolver = (
/** What a sender is now: its recorded name, never an agent-painted title, and its agent. */
export type SenderSnapshot = { name: string | null; agent: AgentType | null }

/** reportedDispatchId comes from worker_done. */
export type SenderSnapshotResolver = (
party: AgentMessageSender['party'],
reportedDispatchId?: string
) => string | null
) => SenderSnapshot

/** Snapshot the sender name before its party disappears. */
/** Snapshot the sender's name and agent before its party disappears. */
export function agentMessageSender(
address: string,
db: OrchestrationDb | null,
senderName: SenderNameResolver,
senderSnapshot: SenderSnapshotResolver,
reportedDispatchId?: string
): AgentMessageSender {
const party = senderParty(address, db)
return { party, name: snapshotName(senderName, party, reportedDispatchId) }
const snapshot = snapshotSender(senderSnapshot, party, reportedDispatchId)
return {
party,
name: agentMessageSenderName(snapshot.name),
...(snapshot.agent ? { agent: snapshot.agent } : {})
}
}

function senderParty(address: string, db: OrchestrationDb | null): AgentMessageSender['party'] {
Expand All @@ -33,15 +42,15 @@ function senderParty(address: string, db: OrchestrationDb | null): AgentMessageS
}
}

function snapshotName(
senderName: SenderNameResolver,
function snapshotSender(
senderSnapshot: SenderSnapshotResolver,
party: AgentMessageSender['party'],
reportedDispatchId: string | undefined
): string | null {
): SenderSnapshot {
try {
return agentMessageSenderName(senderName(party, reportedDispatchId))
return senderSnapshot(party, reportedDispatchId)
} catch {
// Failure to resolve a label must not block delivery.
return null
return { name: null, agent: null }
}
}
Loading
Loading