Summary
Close out the concurrency/robustness hardening deferred from #4660 (master-chat receive loop review). The substantive correctness + security findings were fixed in that PR; these are the lower-risk hardening items tracked here as a follow-up.
Problem / Context
CodeRabbit + Codex flagged several defensive improvements on the orchestration receive/reply path. They are safe today under the current single-user desktop model and serialized master-chat wakes, but they narrow real edges (concurrent A2A activity, races on seq allocation, mismatched session ids, and remote key-bundle staleness). Grouping them so they can be knocked out together rather than blocking #4660.
See the resolution comment on #4660 for the rationale on each deferral.
Scope
Orchestration + tinyplace only. No behavior change intended beyond hardening; keep the master-chat happy path unchanged.
Acceptance criteria
Related
Summary
Close out the concurrency/robustness hardening deferred from #4660 (master-chat receive loop review). The substantive correctness + security findings were fixed in that PR; these are the lower-risk hardening items tracked here as a follow-up.
Problem / Context
CodeRabbit + Codex flagged several defensive improvements on the orchestration receive/reply path. They are safe today under the current single-user desktop model and serialized master-chat wakes, but they narrow real edges (concurrent A2A activity, races on seq allocation, mismatched session ids, and remote key-bundle staleness). Grouping them so they can be knocked out together rather than blocking #4660.
See the resolution comment on #4660 for the rationale on each deferral.
Scope
Orchestration + tinyplace only. No behavior change intended beyond hardening; keep the master-chat happy path unchanged.
Acceptance criteria
src/openhuman/orchestration/tools.rs—MASTER_ORIGIN/current_master_origin) — eliminate, don't just document, the window where a concurrent A2Asend_to_agentduring a local-master turn reads the master origin and mis-threads a peer reply into master. Options: scope the beacon to the master turn's own sends, or carry an origin token that only master sends honor.pending_askbefore the outbound send (tools.rssend_to_agent) — arm the correlation before the DM leaves, clearing it on send failure, so a fast reply can't race the post-send arm.src/openhuman/orchestration/schemas.rshandle_send_master_message;tools.rssend_to_agent) — wrapnext_session_seq+insert_message/upsert_sessioninin_immediate_txnso concurrent writers can't allocate a duplicate seq.sessionId(tools.rssend_to_agent) — when a caller passes an explicitsessionIdthat doesn't belong to the recipient, error instead of silently falling back to latest/mint.src/openhuman/tinyplace/manifest.rs—signal_key_status/ensure_signal_keys_published) — gateencryptionKeyPublishedon the remote prekey bundle actually being serveable, not just the directory card being present.Related