Skip to content

Commit 5db7e1c

Browse files
authored
fix(talk): preserve owner authorization in realtime consults (#114163)
* feat(talk): forward realtime consult sender auth * docs(talk): clarify realtime sender auth contract * ci: constrain oxlint on hosted runners * ci: split oxlint core on hosted runners --------- Co-authored-by: Omar Shahine <[email protected]>
1 parent 2737f2c commit 5db7e1c

6 files changed

Lines changed: 47 additions & 7 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,11 +2278,18 @@ jobs:
22782278
# The i18n verify covers keys extracted from every ui/ source,
22792279
# not just ui/src/i18n; any ui-touching diff (run_ui_tests) or
22802280
# i18n-tooling diff must run it. oxlint always runs.
2281+
lint_args=(--threads=8)
2282+
if [ "$(nproc)" -lt 8 ]; then
2283+
# Fork PRs run on 4-core hosted runners with 16GB. Bound both
2284+
# the core process size and its threads so type-aware oxlint
2285+
# does not intermittently lose the runner under memory pressure.
2286+
lint_args=(--split-core --threads=1)
2287+
fi
22812288
if [ "$RUN_CONTROL_UI_I18N" = "true" ] || [ "$RUN_UI_TESTS" = "true" ]; then
2282-
pnpm lint --threads=8
2289+
pnpm lint "${lint_args[@]}"
22832290
else
22842291
echo "[skip] changed scope cannot affect control-UI i18n catalogs"
2285-
node scripts/run-oxlint-shards.mjs --threads=8
2292+
node scripts/run-oxlint-shards.mjs "${lint_args[@]}"
22862293
fi
22872294
if [ "$FORMAT_CHECK" = "true" ]; then
22882295
pnpm format:check

‎docs/plugins/sdk-subpaths.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ Use `isLoopbackHost(host)` when a plugin must accept only the local machine. It
337337
| `plugin-sdk/speech-settings` | Lightweight TTS config resolution and normalization primitives without provider registries or synthesis runtime |
338338
| `plugin-sdk/realtime-transcription` | Private-local after July 2026; Realtime transcription provider types, registry helpers, and shared WebSocket session helper |
339339
| `plugin-sdk/realtime-bootstrap-context` | Private-local after July 2026; Realtime profile bootstrap helper for bounded `IDENTITY.md`, `USER.md`, and `SOUL.md` context injection |
340-
| `plugin-sdk/realtime-voice` | Private-local after July 2026; Realtime voice provider types, registry helpers, shared audio-energy/speech-onset gates, and realtime voice behavior helpers, including the transport-independent session harness and output activity tracking |
340+
| `plugin-sdk/realtime-voice` | Private-local after July 2026; Realtime voice provider types, registry helpers, shared audio-energy/speech-onset gates, and realtime voice behavior helpers, including the transport-independent session harness and output activity tracking. For official runtime consumers, sender-auth contract revision 1 forwards ingress-authenticated `senderId` and `senderIsOwner` unchanged; ingress owns authentication, and consumers requiring the handoff must fail closed on other revisions. |
341341
| `plugin-sdk/meeting-runtime` | Browser-meeting session runtime, realtime audio engines/transports, `MeetingPlatformAdapter`, browser/node control, agent-consult, voice-call delegation, setup checks, and SoX command helpers |
342342
| `plugin-sdk/image-generation` | Private-local after July 2026; Image generation provider types plus image asset/data URL helpers and the OpenAI-compatible image provider builder |
343343
| `plugin-sdk/image-generation-core` | Private-local after July 2026; Shared image-generation types, failover, auth, and registry helpers |

‎src/plugin-sdk/realtime-voice.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
/**
2-
* Public SDK subpath for realtime voice provider types, runtime helpers, and talk events.
3-
*/
1+
/** Production-private runtime seam for bundled and separately published official plugins. */
42
export type { RealtimeVoiceProviderPlugin } from "../plugins/types.js";
53
export type {
64
RealtimeVoiceAudioFormat,
@@ -122,6 +120,7 @@ export {
122120
export {
123121
assertRealtimeVoiceAgentConsultModelSelectionUnlocked,
124122
consultRealtimeVoiceAgent,
123+
REALTIME_VOICE_AGENT_CONSULT_SENDER_AUTH_VERSION,
125124
type RealtimeVoiceAgentConsultResult,
126125
type RealtimeVoiceAgentConsultRuntime,
127126
} from "../talk/agent-consult-runtime.js";

‎src/talk/agent-consult-runtime.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ import {
1717
import { closeOpenClawStateDatabaseForTest } from "../state/openclaw-state-db.js";
1818
import { captureEnv, setTestEnvValue } from "../test-utils/env.js";
1919
import { normalizeSessionDeliveryState } from "../utils/delivery-context.shared.js";
20-
import { consultRealtimeVoiceAgent } from "./agent-consult-runtime.js";
20+
import {
21+
consultRealtimeVoiceAgent,
22+
REALTIME_VOICE_AGENT_CONSULT_SENDER_AUTH_VERSION,
23+
} from "./agent-consult-runtime.js";
2124
import { REALTIME_VOICE_AGENT_CONSULT_TOOL } from "./agent-consult-tool.js";
2225
import {
2326
resolveRealtimeVoiceAgentConsultTools,
@@ -212,6 +215,7 @@ describe("realtime voice agent consult runtime", () => {
212215
});
213216

214217
it("exposes the shared consult tool based on policy", () => {
218+
expect(REALTIME_VOICE_AGENT_CONSULT_SENDER_AUTH_VERSION).toBe(1);
215219
expect(resolveRealtimeVoiceAgentConsultTools("safe-read-only")).toStrictEqual([
216220
REALTIME_VOICE_AGENT_CONSULT_TOOL,
217221
]);
@@ -343,6 +347,8 @@ describe("realtime voice agent consult runtime", () => {
343347
surface: "a live phone call",
344348
userLabel: "Caller",
345349
questionSourceLabel: "caller",
350+
senderId: "+15550001234",
351+
senderIsOwner: true,
346352
toolsAllow: ["read"],
347353
provider: "openai",
348354
model: "gpt-5.4",
@@ -371,6 +377,8 @@ describe("realtime voice agent consult runtime", () => {
371377
expect(call.sessionKey).toBe("voice:15550001234");
372378
expect(call.sandboxSessionKey).toBe("agent:operator:voice:15550001234");
373379
expect(call.agentId).toBe("operator");
380+
expect(call.senderId).toBe("+15550001234");
381+
expect(call.senderIsOwner).toBe(true);
374382
expect(call.messageProvider).toBe("voice");
375383
expect(call.lane).toBe("voice");
376384
expect(call.toolsAllow).toStrictEqual(["read"]);

‎src/talk/agent-consult-runtime.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ export type RealtimeVoiceAgentConsultRuntime = PluginRuntimeCore["agent"];
3434
*/
3535
export type RealtimeVoiceAgentConsultResult = { text: string };
3636

37+
/**
38+
* Sender-auth contract revision for official realtime voice plugins.
39+
*
40+
* Revision 1 forwards ingress-authenticated `senderId` and `senderIsOwner` unchanged. Ingress
41+
* owns authentication; consumers that require this handoff must fail closed on other revisions.
42+
*/
43+
export const REALTIME_VOICE_AGENT_CONSULT_SENDER_AUTH_VERSION = 1;
44+
3745
/**
3846
* Controls whether voice consults run in a fresh session or fork context from the requester.
3947
*/
@@ -258,6 +266,10 @@ export async function consultRealtimeVoiceAgent(params: {
258266
questionSourceLabel?: string;
259267
agentId?: string;
260268
spawnedBy?: string | null;
269+
/** Sender identity established by the caller's ingress authorization boundary. */
270+
senderId?: string | null;
271+
/** Trusted owner bit established by the caller's ingress authorization boundary. */
272+
senderIsOwner?: boolean;
261273
contextMode?: RealtimeVoiceAgentConsultContextMode;
262274
provider?: RunEmbeddedAgentParams["provider"];
263275
model?: RunEmbeddedAgentParams["model"];
@@ -379,6 +391,8 @@ export async function consultRealtimeVoiceAgent(params: {
379391
sandboxSessionKey: resolveRealtimeVoiceAgentSandboxSessionKey(agentId, params.sessionKey),
380392
agentId,
381393
spawnedBy: params.spawnedBy,
394+
senderId: params.senderId,
395+
senderIsOwner: params.senderIsOwner,
382396
messageProvider: consultDeliveryContext?.channel ?? params.messageProvider,
383397
agentAccountId: consultDeliveryContext?.accountId,
384398
messageTo: consultDeliveryContext?.to,

‎test/scripts/ci-workflow-guards.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3936,6 +3936,18 @@ printf '%s\n' "\${CURL_SUCCESS_IP:-203.0.113.7}"
39363936
expect(checkShardRun).not.toContain("check:protocol-coverage");
39373937
});
39383938

3939+
it("keeps type-aware oxlint within hosted fork-runner resources", () => {
3940+
const workflow = readCiWorkflow();
3941+
const checkShardRun = workflow.jobs["check-shard"].steps.find(
3942+
(step: WorkflowStep) => step.name === "Run check shard",
3943+
).run;
3944+
3945+
expect(checkShardRun).toContain('if [ "$(nproc)" -lt 8 ]; then');
3946+
expect(checkShardRun).toContain("lint_args=(--split-core --threads=1)");
3947+
expect(checkShardRun).toContain('pnpm lint "${lint_args[@]}"');
3948+
expect(checkShardRun).toContain('node scripts/run-oxlint-shards.mjs "${lint_args[@]}"');
3949+
});
3950+
39393951
it("runs the suppression-baseline max-lines ratchet against the exact tested tree", () => {
39403952
const workflow = readCiWorkflow();
39413953
const checksFastSteps = workflow.jobs["checks-fast-core"].steps;

0 commit comments

Comments
 (0)