





















@@ -484,8 +484,21 @@ export async function runCodexAppServerAttempt(
484484(await readMirroredSessionHistoryMessages(params.sessionFile)) ?? historyMessages;
485485}
486486const baseDeveloperInstructions = buildDeveloperInstructions(params);
487+// Build the workspace bootstrap block before finalizing developer
488+// instructions so persona files (SOUL.md, IDENTITY.md, ...) reach Codex
489+// through the explicit `developerInstructions` field.
490+const workspaceBootstrapInstructions = await buildCodexWorkspaceBootstrapInstructions({
491+ params,
492+ resolvedWorkspace,
493+ effectiveWorkspace,
494+sessionKey: sandboxSessionKey,
495+ sessionAgentId,
496+});
487497let promptText = params.prompt;
488-let developerInstructions = baseDeveloperInstructions;
498+let developerInstructions = joinPresentSections(
499+baseDeveloperInstructions,
500+workspaceBootstrapInstructions,
501+);
489502let prePromptMessageCount = historyMessages.length;
490503if (activeContextEngine) {
491504try {
@@ -512,6 +525,7 @@ export async function runCodexAppServerAttempt(
512525promptText = projection.promptText;
513526developerInstructions = joinPresentSections(
514527baseDeveloperInstructions,
528+workspaceBootstrapInstructions,
515529projection.developerInstructionAddition,
516530);
517531prePromptMessageCount = projection.prePromptMessageCount;
@@ -541,13 +555,6 @@ export async function runCodexAppServerAttempt(
541555messages: historyMessages,
542556ctx: hookContext,
543557});
544-const workspaceBootstrapInstructions = await buildCodexWorkspaceBootstrapInstructions({
545- params,
546- resolvedWorkspace,
547- effectiveWorkspace,
548-sessionKey: sandboxSessionKey,
549- sessionAgentId,
550-});
551558const trajectoryRecorder = createCodexTrajectoryRecorder({
552559attempt: params,
553560cwd: effectiveWorkspace,
@@ -583,10 +590,7 @@ export async function runCodexAppServerAttempt(
583590 : options.nativeHookRelay?.enabled === false
584591 ? buildCodexNativeHookRelayDisabledConfig()
585592 : undefined;
586-const threadConfig = mergeCodexConfigInstructions(
587-nativeHookRelayConfig,
588-workspaceBootstrapInstructions,
589-);
593+const threadConfig = nativeHookRelayConfig;
590594({ client, thread } = await withCodexStartupTimeout({
591595timeoutMs: params.timeoutMs,
592596timeoutFloorMs: options.startupTimeoutFloorMs,
@@ -1871,20 +1875,6 @@ function renderCodexWorkspaceBootstrapInstructions(
18711875return lines.join("\n").trim();
18721876}
187318771874-function mergeCodexConfigInstructions(
1875-config: JsonObject | undefined,
1876-instructions: string | undefined,
1877-): JsonObject | undefined {
1878-if (!instructions?.trim()) {
1879-return config;
1880-}
1881-const merged: JsonObject = { ...config };
1882-const existingInstructions =
1883-typeof merged.instructions === "string" ? merged.instructions.trim() : undefined;
1884-merged.instructions = joinPresentSections(existingInstructions, instructions);
1885-return merged;
1886-}
1887-18881878function remapCodexContextFilePath(params: {
18891879file: EmbeddedContextFile;
18901880sourceWorkspaceDir: string;
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。