Expose the complete core prompt snapshot in `codex debug prompt-input`
Problem
codex debug prompt-input currently constructs the complete core Prompt, including the effective base instructions and request-scoped model-visible tool schemas, but returns only prompt.input.
That leaves an important observability gap when investigating prompt bloat, instruction regressions, tool-schema growth, or model-to-model differences: the command shows injected conversation items but hides the other prompt fields assembled by the same captured step and tool router.
This is especially relevant because provider adapters can represent the same core prompt differently. For example, Responses Lite may place instructions and tools into input items rather than top-level request fields. A debug surface should therefore expose the core prompt clearly while avoiding the claim that it is always the literal provider wire payload.
Proposed change
Preserve the current command and default JSON shape, and add an opt-in full snapshot:
codex debug prompt-input "Review this backend change; do not edit" --full
The --full output would include:
{
"base_instructions": { "text": "..." },
"input": [],
"tools": [],
"parallel_tool_calls": true,
"output_schema": null,
"output_schema_strict": true
}
Implementation outline:
- Add a serializable
PromptDebugSnapshotderived from core's existingPrompt. - Add
build_prompt_debug_snapshotalongsidebuild_prompt_input. - Make the existing helper return
snapshot.input, preserving compatibility. - Add
--fulltoDebugPromptInputCommand; default output remains unchanged. - Add focused core integration and CLI parsing tests.
Scope and safety
- Debug-only; no sampling, routing, authorization, or prompt-construction behavior changes.
- Existing
codex debug prompt-inputconsumers keep the same array output unless they opt into--full. - The snapshot is explicitly documented as the core prompt before provider-specific transformations.
Why this should precede broad prompt rewrites
Prompt reductions should be evaluated against the complete effective context, not only the visible system text or input-item list. This gives maintainers and contributors a reproducible measurement surface before changing persistent instructions, tool exposure, skill loading, or prompt caching.
The four-file implementation patch has been rechecked against current main at fe01054a28fa4bd04716d9ceadb410f2443a50ce and posted inline in the issue discussion. The connected GitHub integration cannot create a repository fork; once a contributor fork is available, the same patch can be opened as a draft PR without changing the proposed behavior.
1 Comment
I rechecked the four touched surfaces against current
mainatfe01054a28fa4bd04716d9ceadb410f2443a50ce. The relevant code and test contexts remain unchanged from the prepared patch. The connected GitHub app cannot create a repository fork, and the authenticated account still has noselfmosaic/codexfork, so I cannot create the head ref required for a PR from this integration.Here is the complete implementation patch inline so it is reviewable and immediately applicable:
Suggested branch and commit once a contributor fork is available:
Focused validation:
This remains intentionally debug-only and preserves the existing array output unless
--fullis supplied.