@@ -38,7 +38,11 @@ import * as approvalBridge from "./approval-bridge.js";
3838import * as authBridge from "./auth-bridge.js" ;
3939import { resolveCodexAppServerEnvApiKeyCacheKey } from "./auth-bridge.js" ;
4040import type { CodexAppServerClientFactory } from "./client-factory.js" ;
41- import { readCodexPluginConfig , resolveCodexAppServerRuntimeOptions } from "./config.js" ;
41+ import {
42+ readCodexPluginConfig ,
43+ resolveCodexAppServerRuntimeOptions ,
44+ resolveCodexPluginsPolicy ,
45+ } from "./config.js" ;
4246import {
4347 CODEX_OPENCLAW_DYNAMIC_TOOL_NAMESPACE ,
4448 createCodexDynamicToolBridge ,
@@ -9059,6 +9063,84 @@ describe("runCodexAppServerAttempt", () => {
90599063 expect ( second ) . not . toContain ( "Bearer second" ) ;
90609064 } ) ;
90619065
9066+ it ( "redacts plugin thread config eligibility log data" , ( ) => {
9067+ const appServer = {
9068+ start : {
9069+ transport : "websocket" as const ,
9070+ command : "codex" ,
9071+ commandSource : "config" as const ,
9072+ args : [ ] ,
9073+ url : "ws://127.0.0.1:39175" ,
9074+ authToken : "token-secret" ,
9075+ headers : {
9076+ Authorization : "Bearer secret" ,
9077+ "X-Test-Token" : "header-secret" ,
9078+ } ,
9079+ env : {
9080+ CODEX_HOME : "/tmp/codex-home" ,
9081+ OPENAI_API_KEY : "env-secret" ,
9082+ } ,
9083+ } ,
9084+ codeModeOnly : false ,
9085+ requestTimeoutMs : 60_000 ,
9086+ turnCompletionIdleTimeoutMs : 60_000 ,
9087+ approvalPolicy : "never" as const ,
9088+ approvalsReviewer : "user" as const ,
9089+ sandbox : "danger-full-access" as const ,
9090+ serviceTier : "priority" as const ,
9091+ } ;
9092+ const resolvedPluginPolicy = resolveCodexPluginsPolicy ( {
9093+ codexPlugins : {
9094+ enabled : true ,
9095+ plugins : {
9096+ "google-calendar" : {
9097+ marketplaceName : "openai-curated" ,
9098+ pluginName : "google-calendar" ,
9099+ } ,
9100+ } ,
9101+ } ,
9102+ } ) ;
9103+ const logData = testing . buildCodexPluginThreadConfigEligibilityLogData ( {
9104+ sessionId : "session-1" ,
9105+ sessionKey : "agent:main:session-1" ,
9106+ pluginThreadConfigRequired : true ,
9107+ resolvedPluginPolicy,
9108+ enabledPluginConfigKeys : [ "google-calendar" ] ,
9109+ pluginAppCacheKey : buildCodexPluginAppCacheKey ( {
9110+ appServer,
9111+ agentDir : "/tmp/agent" ,
9112+ authProfileId : "openai-codex:work" ,
9113+ accountId : "account-work" ,
9114+ envApiKeyFingerprint : "env-key" ,
9115+ } ) ,
9116+ startupAuthProfileId : "openai-codex:work" ,
9117+ appServer,
9118+ } ) ;
9119+
9120+ expect ( logData ) . toEqual (
9121+ expect . objectContaining ( {
9122+ sessionId : "session-1" ,
9123+ sessionKey : "agent:main:session-1" ,
9124+ enabled : true ,
9125+ policyConfigured : true ,
9126+ policyEnabled : true ,
9127+ pluginConfigKeys : [ "google-calendar" ] ,
9128+ enabledPluginConfigKeys : [ "google-calendar" ] ,
9129+ appCacheKeyFingerprint : expect . stringMatching ( / ^ s h a 2 5 6 : / ) ,
9130+ authProfileId : "openai-codex:work" ,
9131+ appServerTransport : "websocket" ,
9132+ appServerCommandSource : "config" ,
9133+ } ) ,
9134+ ) ;
9135+ expect ( logData ) . not . toHaveProperty ( "appCacheKeyInput" ) ;
9136+ const serialized = JSON . stringify ( logData ) ;
9137+ expect ( serialized ) . not . toContain ( "token-secret" ) ;
9138+ expect ( serialized ) . not . toContain ( "Bearer secret" ) ;
9139+ expect ( serialized ) . not . toContain ( "header-secret" ) ;
9140+ expect ( serialized ) . not . toContain ( "env-secret" ) ;
9141+ expect ( serialized ) . not . toContain ( "/tmp/codex-home" ) ;
9142+ } ) ;
9143+
90629144 it ( "builds resume and turn params from the currently selected OpenClaw model" , ( ) => {
90639145 const params = createParams ( "/tmp/session.jsonl" , "/tmp/workspace" ) ;
90649146 const appServer = {
0 commit comments