Skip to content

Commit 2137dcd

Browse files
authored
Merge branch 'main' into fix/issue-118621
2 parents 2148a38 + e99f6dc commit 2137dcd

175 files changed

Lines changed: 5944 additions & 1516 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Docs: https://docs.openclaw.ai
5757
- **Gateway TTS playback:** add an operator-scoped `tts.speak` RPC that returns configured-provider speech as inline whole-clip audio for remote clients. (#100708, #100770)
5858
- **Workboard dispatch cap:** add a request-scoped `--max-starts` override while preserving the default cap, sequential starts, and one-card-per-owner guard. (#100174) Thanks @souvikDevloper.
5959
- **Plugin install provenance warnings:** require explicit `--force` acknowledgement for arbitrary executable plugin sources in CLI and chat installs, keep trusted ClawHub, bundled, official-catalog, and tracked-update flows frictionless, and restrict Crestodian installs to trusted sources. (#102197) Thanks @jesse-merhi.
60+
- **Custodian rich setup controls:** render the Gateway's sanitized wizard steps as native selects, multiselects, text fields, and masked secret inputs while preserving text-only chat compatibility. (#114631) Thanks @jesse-merhi.
6061

6162
### Fixes
6263

‎apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9297,6 +9297,7 @@ public struct ConfigSchemaLookupResult: Codable, Sendable {
92979297
public struct SystemAgentChatParams: Codable, Sendable {
92989298
public let sessionid: String
92999299
public let message: String?
9300+
public let wizardanswer: [String: AnyCodable]?
93009301
public let welcomevariant: AnyCodable?
93019302
public let reset: Bool?
93029303
public let context: [String: AnyCodable]?
@@ -9305,13 +9306,15 @@ public struct SystemAgentChatParams: Codable, Sendable {
93059306
public init(
93069307
sessionid: String,
93079308
message: String? = nil,
9309+
wizardanswer: [String: AnyCodable]? = nil,
93089310
welcomevariant: AnyCodable? = nil,
93099311
reset: Bool? = nil,
93109312
context: [String: AnyCodable]? = nil,
93119313
delegation: [String: AnyCodable]? = nil)
93129314
{
93139315
self.sessionid = sessionid
93149316
self.message = message
9317+
self.wizardanswer = wizardanswer
93159318
self.welcomevariant = welcomevariant
93169319
self.reset = reset
93179320
self.context = context
@@ -9321,6 +9324,7 @@ public struct SystemAgentChatParams: Codable, Sendable {
93219324
private enum CodingKeys: String, CodingKey {
93229325
case sessionid = "sessionId"
93239326
case message
9327+
case wizardanswer = "wizardAnswer"
93249328
case welcomevariant = "welcomeVariant"
93259329
case reset
93269330
case context
@@ -9339,6 +9343,7 @@ public struct SystemAgentChatResult: Codable, Sendable {
93399343
public let needsapproval: Bool?
93409344
public let proposalid: String?
93419345
public let question: [String: AnyCodable]?
9346+
public let step: WizardStep?
93429347

93439348
public init(
93449349
sessionid: String,
@@ -9350,7 +9355,8 @@ public struct SystemAgentChatResult: Codable, Sendable {
93509355
agentid: String? = nil,
93519356
needsapproval: Bool? = nil,
93529357
proposalid: String? = nil,
9353-
question: [String: AnyCodable]? = nil)
9358+
question: [String: AnyCodable]? = nil,
9359+
step: WizardStep? = nil)
93549360
{
93559361
self.sessionid = sessionid
93569362
self.reply = reply
@@ -9362,6 +9368,7 @@ public struct SystemAgentChatResult: Codable, Sendable {
93629368
self.needsapproval = needsapproval
93639369
self.proposalid = proposalid
93649370
self.question = question
9371+
self.step = step
93659372
}
93669373

93679374
private enum CodingKeys: String, CodingKey {
@@ -9375,6 +9382,7 @@ public struct SystemAgentChatResult: Codable, Sendable {
93759382
case needsapproval = "needsApproval"
93769383
case proposalid = "proposalId"
93779384
case question
9385+
case step
93789386
}
93799387
}
93809388

‎extensions/codex/src/app-server/dynamic-tools.test.ts‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,51 @@ describe("createCodexDynamicToolBridge", () => {
444444
expect(onAgentToolResult).toHaveBeenCalledWith(
445445
expect.objectContaining({ toolName: "sessions_spawn", isError: false }),
446446
);
447+
expect(bridge.telemetry.acceptedSessionSpawns).toEqual([
448+
{ runId: "run_5f3a9c", childSessionKey: "child-7b21" },
449+
]);
450+
});
451+
452+
it("preserves an accepted sessions_spawn after result middleware strips its details", async () => {
453+
const registry = createEmptyPluginRegistry();
454+
const handler = vi.fn(async (event: { result: AgentToolResult<unknown> }) => ({
455+
result: {
456+
...event.result,
457+
content: [{ type: "text" as const, text: "Child launch recorded." }],
458+
details: {},
459+
},
460+
}));
461+
registry.agentToolResultMiddlewares.push({
462+
pluginId: "result-compactor",
463+
pluginName: "Result Compactor",
464+
rawHandler: handler,
465+
handler,
466+
runtimes: ["codex"],
467+
source: "test",
468+
});
469+
setActivePluginRegistry(registry);
470+
const bridge = createBridgeWithToolResult(
471+
"sessions_spawn",
472+
textToolResult("Accepted: launching child session.", {
473+
status: "accepted",
474+
runId: "run_compacted",
475+
childSessionKey: "child-compacted",
476+
}),
477+
);
478+
479+
const result = await bridge.handleToolCall({
480+
threadId: "thread-1",
481+
turnId: "turn-1",
482+
callId: "call-compacted",
483+
namespace: null,
484+
tool: "sessions_spawn",
485+
arguments: { task: "scan logs" },
486+
});
487+
488+
expect(result).toEqual(expectInputText("Child launch recorded."));
489+
expect(bridge.telemetry.acceptedSessionSpawns).toEqual([
490+
{ runId: "run_compacted", childSessionKey: "child-compacted" },
491+
]);
447492
});
448493

449494
it("retains only MCP App preview details for OpenClaw transcript projection", async () => {
@@ -500,6 +545,7 @@ describe("createCodexDynamicToolBridge", () => {
500545
});
501546

502547
expect(result.success).toBe(false);
548+
expect(bridge.telemetry.acceptedSessionSpawns).toEqual([]);
503549
});
504550

505551
it("treats accepted goal tool statuses (created / updated) as successful dynamic tool calls", async () => {

‎extensions/codex/src/app-server/dynamic-tools.ts‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runti
4545
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
4646
import type { ImageContent, TextContent } from "openclaw/plugin-sdk/llm";
4747
import { normalizeOpenAIToolSchemas } from "openclaw/plugin-sdk/provider-tools";
48-
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
48+
import {
49+
asOptionalRecord,
50+
isRecord,
51+
normalizeOptionalString,
52+
} from "openclaw/plugin-sdk/string-coerce-runtime";
4953
import {
5054
DEFAULT_MAX_LIVE_TOOL_RESULT_CHARS,
5155
estimateToolResultTextChars,
@@ -381,10 +385,24 @@ export type CodexDynamicToolBridge = {
381385
toolMediaUrls: string[];
382386
toolAudioAsVoice: boolean;
383387
successfulCronAdds?: number;
388+
acceptedSessionSpawns: Array<{ runId: string; childSessionKey: string }>;
384389
quarantinedTools: CodexDynamicToolSchemaQuarantine[];
385390
};
386391
};
387392

393+
function normalizeAcceptedSessionSpawn(result: unknown): {
394+
runId: string;
395+
childSessionKey: string;
396+
} | null {
397+
const details = asOptionalRecord(asOptionalRecord(result)?.details);
398+
if (!details || details.status !== "accepted") {
399+
return null;
400+
}
401+
const runId = normalizeOptionalString(details.runId);
402+
const childSessionKey = normalizeOptionalString(details.childSessionKey);
403+
return runId && childSessionKey ? { runId, childSessionKey } : null;
404+
}
405+
388406
/** Namespace attached to OpenClaw-owned dynamic tools exposed to Codex. */
389407
const CODEX_OPENCLAW_DYNAMIC_TOOL_NAMESPACE = "openclaw";
390408

@@ -490,6 +508,7 @@ export function createCodexDynamicToolBridge(params: {
490508
messagingToolSourceReplyPayloads: [],
491509
toolMediaUrls: [],
492510
toolAudioAsVoice: false,
511+
acceptedSessionSpawns: [],
493512
quarantinedTools,
494513
};
495514
const middlewareRunner = createAgentToolResultMiddlewareRunner({
@@ -654,6 +673,14 @@ export function createCodexDynamicToolBridge(params: {
654673
result: middlewareResult,
655674
});
656675
const resultIsError = rawIsError || isToolResultError(result);
676+
// A successful spawn is durable before presentation middleware can rewrite details.
677+
const acceptedSessionSpawn =
678+
toolName === "sessions_spawn" && !rawIsError
679+
? normalizeAcceptedSessionSpawn(telemetryRawResult)
680+
: null;
681+
if (acceptedSessionSpawn) {
682+
telemetry.acceptedSessionSpawns.push(acceptedSessionSpawn);
683+
}
657684
const finalResultFailureKind = resolveToolResultFailureKind(result);
658685
const resultFailureKind = rawResultFailureKind ?? finalResultFailureKind;
659686
const observerResult =

‎extensions/codex/src/app-server/event-projector.commentary.test.ts‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ describe("CodexAppServerEventProjector commentary projection", () => {
647647
expect(result.lastAssistant).toBeUndefined();
648648
});
649649

650-
it("preserves sessions_yield detection in attempt results", () => {
650+
it("preserves accepted session spawns as yield continuation evidence", () => {
651651
const projector = new CodexAppServerEventProjector(
652652
{
653653
prompt: "hello",
@@ -664,8 +664,20 @@ describe("CodexAppServerEventProjector commentary projection", () => {
664664
TURN_ID,
665665
);
666666

667-
const result = projector.buildResult(buildEmptyToolTelemetry(), { yieldDetected: true });
667+
const result = projector.buildResult(
668+
{
669+
...buildEmptyToolTelemetry(),
670+
acceptedSessionSpawns: [
671+
{ runId: "child-run", childSessionKey: "agent:main:subagent:child" },
672+
],
673+
},
674+
{ yieldDetected: true },
675+
);
668676

669677
expect(result.yieldDetected).toBe(true);
678+
expect(result.acceptedSessionSpawns).toEqual([
679+
{ runId: "child-run", childSessionKey: "agent:main:subagent:child" },
680+
]);
681+
expect(result.replayMetadata).toEqual({ hadPotentialSideEffects: true, replaySafe: false });
670682
});
671683
});

‎extensions/codex/src/app-server/event-projector.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ type CodexAppServerToolTelemetry = {
7373
toolMediaUrls?: string[];
7474
toolAudioAsVoice?: boolean;
7575
successfulCronAdds?: number;
76-
};
76+
} & Pick<EmbeddedRunAttemptResult, "acceptedSessionSpawns">;
7777

7878
export class CodexAppServerEventProjector {
7979
private readonly assistantProjection: CodexAssistantProjection;
@@ -403,7 +403,7 @@ export class CodexAppServerEventProjector {
403403
const toolMetas = this.toolProgressProjection.toolMetas;
404404
const hadPotentialSideEffects =
405405
toolTelemetry.didSendViaMessagingTool ||
406-
(toolTelemetry.successfulCronAdds ?? 0) > 0 ||
406+
Boolean(toolTelemetry.successfulCronAdds || toolTelemetry.acceptedSessionSpawns?.length) ||
407407
this.generatedMediaProjection.hasGeneratedMedia() ||
408408
this.toolProgressProjection.hasPotentialSideEffects;
409409
return {
@@ -439,6 +439,7 @@ export class CodexAppServerEventProjector {
439439
hostOwnedToolMediaUrls: this.generatedMediaProjection.buildHostOwnedMediaUrls(toolTelemetry),
440440
toolAudioAsVoice: toolTelemetry.toolAudioAsVoice,
441441
successfulCronAdds: toolTelemetry.successfulCronAdds,
442+
acceptedSessionSpawns: toolTelemetry.acceptedSessionSpawns,
442443
cloudCodeAssistFormatError: false,
443444
attemptUsage: projectedUsage,
444445
...(this.completedCompactionCount > 0

‎extensions/diagnostics-otel/src/service-exporter.ts‎

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
import type {
1111
OtelHttpAgentFactory,
1212
OtelHttpAgentOptions,
13-
OtelLogger,
1413
OtelSignalIdentifier,
1514
} from "./service-types.js";
1615

@@ -75,8 +74,7 @@ function readOtelEnvFile(params: {
7574
signalIdentifier: OtelSignalIdentifier;
7675
signalSuffix: "CERTIFICATE" | "CLIENT_CERTIFICATE" | "CLIENT_KEY";
7776
sharedEnvName: string;
78-
logger: OtelLogger;
79-
warning: string;
77+
label: string;
8078
}): Buffer | undefined {
8179
const signalEnvName = `OTEL_EXPORTER_OTLP_${params.signalIdentifier}_${params.signalSuffix}`;
8280
const filePath =
@@ -86,48 +84,53 @@ function readOtelEnvFile(params: {
8684
return undefined;
8785
}
8886
try {
89-
return readFileSync(nodePath.resolve(process.cwd(), filePath));
87+
const material = readFileSync(nodePath.resolve(process.cwd(), filePath));
88+
if (material.length > 0) {
89+
return material;
90+
}
9091
} catch {
91-
params.logger.warn(`diagnostics-otel: ${params.warning}`);
92-
return undefined;
92+
// Never expose certificate paths or silently downgrade to system trust.
9393
}
94+
throw new Error(
95+
`Configured OpenTelemetry ${params.label} file is missing, empty, or unreadable; refusing insecure export`,
96+
);
9497
}
9598

9699
function normalizeOtelEnvValue(value: string | undefined): string | undefined {
97-
const trimmed = value?.trim();
98-
return trimmed ? trimmed : undefined;
100+
return value?.trim() ? value : undefined;
99101
}
100102

101103
export function resolveOtelHttpAgentOptions(params: {
102104
url: string | undefined;
103105
signalIdentifier: OtelSignalIdentifier;
104-
logger: OtelLogger;
105-
}): OtelHttpAgentFactory | undefined {
106-
const { url, signalIdentifier, logger } = params;
107-
if (!url) {
108-
return undefined;
109-
}
106+
}): OtelHttpAgentFactory | OtelHttpAgentOptions | undefined {
107+
const { url, signalIdentifier } = params;
110108
const ca = readOtelEnvFile({
111109
signalIdentifier,
112110
signalSuffix: "CERTIFICATE",
113111
sharedEnvName: OTEL_EXPORTER_OTLP_CERTIFICATE_ENV,
114-
logger,
115-
warning: "failed to read root certificate file",
112+
label: "TLS root certificate",
116113
});
117114
const cert = readOtelEnvFile({
118115
signalIdentifier,
119116
signalSuffix: "CLIENT_CERTIFICATE",
120117
sharedEnvName: OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE_ENV,
121-
logger,
122-
warning: "failed to read client certificate chain file",
118+
label: "mTLS client certificate",
123119
});
124120
const key = readOtelEnvFile({
125121
signalIdentifier,
126122
signalSuffix: "CLIENT_KEY",
127123
sharedEnvName: OTEL_EXPORTER_OTLP_CLIENT_KEY_ENV,
128-
logger,
129-
warning: "failed to read client certificate private key file",
124+
label: "mTLS client private key",
130125
});
126+
if ((cert === undefined) !== (key === undefined)) {
127+
throw new Error(
128+
"Configured OpenTelemetry mTLS requires both a client certificate and private key; refusing insecure export",
129+
);
130+
}
131+
if (!url) {
132+
return undefined;
133+
}
131134
const agentOptions: OtelHttpAgentOptions = {
132135
keepAlive: true,
133136
...(ca !== undefined ? { ca } : {}),
@@ -136,10 +139,13 @@ export function resolveOtelHttpAgentOptions(params: {
136139
};
137140
try {
138141
const agent = createNodeProxyAgent({ mode: "env", targetUrl: url, agentOptions });
139-
return agent ? () => agent : undefined;
142+
if (agent) {
143+
return () => agent;
144+
}
140145
} catch {
141146
throw new Error("Configured telemetry proxy is invalid or unsupported; refusing direct export");
142147
}
148+
return (ca || cert || key) && new URL(url).protocol === "https:" ? agentOptions : undefined;
143149
}
144150

145151
export function resolveSampleRate(value: number | undefined): number | undefined {

0 commit comments

Comments
 (0)