From 26e4dec8c9d027fb2b92191b2dca6339ead837fa Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 23 Jul 2026 01:02:12 -0400 Subject: [PATCH] fix(ios): native Talk respects session thinking level (#112901) * fix(ios): inherit thinking in native Talk * test(ios): verify native Talk thinking inheritance * test(ios): keep Talk regression i18n-neutral * test(ios): import Talk request builder module * test(secrets): secure plugin preset fixture --------- Co-authored-by: RECOVERI --- apps/ios/Sources/Voice/TalkModeManager.swift | 6 +++++- .../Tests/TalkModeConfigParsingTests.swift | 21 +++++++++++++++++++ src/secrets/provider-integrations.test.ts | 5 ++--- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/apps/ios/Sources/Voice/TalkModeManager.swift b/apps/ios/Sources/Voice/TalkModeManager.swift index 7d81a680eb73..8098816abdfc 100644 --- a/apps/ios/Sources/Voice/TalkModeManager.swift +++ b/apps/ios/Sources/Voice/TalkModeManager.swift @@ -2781,7 +2781,7 @@ final class TalkModeManager: NSObject { agentID: nil, expectedSessionRoutingContract: nil, message: message, - thinking: "low", + thinking: Self.chatThinkingOverride, idempotencyKey: idempotencyKey, attachments: [], runTimeoutMs: 30000) @@ -5168,6 +5168,10 @@ extension TalkModeManager { } #endif +extension TalkModeManager { + static let chatThinkingOverride: String? = nil +} + private struct IncrementalSpeechContext: Equatable { let apiKey: String? let voiceId: String? diff --git a/apps/ios/Tests/TalkModeConfigParsingTests.swift b/apps/ios/Tests/TalkModeConfigParsingTests.swift index f98842d04453..5f463f6d4268 100644 --- a/apps/ios/Tests/TalkModeConfigParsingTests.swift +++ b/apps/ios/Tests/TalkModeConfigParsingTests.swift @@ -1,5 +1,6 @@ import AVFoundation import Foundation +import OpenClawChatUI import OpenClawKit import Testing @testable import OpenClaw @@ -1064,6 +1065,26 @@ struct TalkModeManagerTests { runId: "missing-run") == nil) } + @Test func `native Talk chat request inherits thinking policy`() { + let request = OpenClawChatGatewayRequests.sendMessage( + sessionKey: "agent:main:main", + agentID: nil, + expectedSessionRoutingContract: nil, + message: "hello", + thinking: TalkModeManager.chatThinkingOverride, + idempotencyKey: "talk-1", + attachments: [], + runTimeoutMs: 30000) + + #expect(TalkModeManager.chatThinkingOverride == nil) + #expect(request.method == "chat.send") + #expect(request.params["message"]?.value as? String == "hello") + #expect(request.params["sessionKey"]?.value as? String == "agent:main:main") + #expect(request.params["idempotencyKey"]?.value as? String == "talk-1") + #expect(request.params["thinking"] == nil) + #expect(request.params["timeoutMs"]?.value as? Int == 30000) + } + @Test func `subscribes before sending chat completion request`() throws { let testsURL = URL(fileURLWithPath: #filePath).deletingLastPathComponent() let sourceURL = testsURL diff --git a/src/secrets/provider-integrations.test.ts b/src/secrets/provider-integrations.test.ts index fa50661e58f5..458020d3faf0 100644 --- a/src/secrets/provider-integrations.test.ts +++ b/src/secrets/provider-integrations.test.ts @@ -551,8 +551,8 @@ describe("secret provider integration presets", () => { const rootDir = makeTempDir(); const resolverPath = path.join(rootDir, "bin", "resolve.mjs"); fs.writeFileSync(path.join(rootDir, "index.ts"), "export default {};\n", "utf8"); - fs.mkdirSync(path.dirname(resolverPath)); - fs.writeFileSync( + makeSecureDir(path.dirname(resolverPath)); + writeSecureFile( resolverPath, [ "let input = '';", @@ -564,7 +564,6 @@ describe("secret provider integration presets", () => { " process.stdout.write(JSON.stringify({ protocolVersion: 1, values }));", "});", ].join("\n"), - "utf8", ); fs.writeFileSync( path.join(rootDir, "openclaw.plugin.json"),