Skip to content

fix(codex): strip intermediary updates from prompts#4131

Draft
fichas wants to merge 1 commit into
router-for-me:devfrom
fichas:agent/codex-strip-intermediary-updates
Draft

fix(codex): strip intermediary updates from prompts#4131
fichas wants to merge 1 commit into
router-for-me:devfrom
fichas:agent/codex-strip-intermediary-updates

Conversation

@fichas

@fichas fichas commented Jul 7, 2026

Copy link
Copy Markdown

Summary

  • Strip the Codex-specific ## Intermediary updates section from request payload strings before forwarding upstream.
  • Preserve surrounding instruction sections such as ## Final answer instructions.
  • Apply the sanitizer recursively so nested input text is covered as well as top-level instructions.

Why

Some Codex Desktop prompts can include intermediary-update instructions that are useful for local UX but can affect high-stakes upstream requests. Removing that section before forwarding keeps the prompt focused on the task and final-answer contract.

Validation

  • go test ./internal/runtime/executor -run 'TestStripCodexIntermediaryUpdates|TestCodex'\n

@github-actions github-actions Bot changed the base branch from main to dev July 7, 2026 07:52
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

This pull request targeted main.

The base branch has been automatically changed to dev.

@fichas fichas changed the base branch from dev to main July 7, 2026 07:53
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

This pull request targeted main.

The base branch has been automatically changed to dev.

@github-actions github-actions Bot changed the base branch from main to dev July 7, 2026 07:53

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces logic to strip "## Intermediary updates" sections from Codex payloads, recursively processing nested strings within JSON structures, and includes comprehensive unit tests. Feedback on the changes highlights a potential issue in isCodexIntermediaryUpdatesStopHeading where other Markdown heading levels (such as H3 to H6) are not recognized as stop headings, and duplicate intermediary headings could prematurely stop the skipping process. A code suggestion is provided to handle all standard Markdown heading levels robustly.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +107 to +109
func isCodexIntermediaryUpdatesStopHeading(trimmedLine string) bool {
return strings.HasPrefix(trimmedLine, "# ") || strings.HasPrefix(trimmedLine, "## ")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current implementation of isCodexIntermediaryUpdatesStopHeading only stops skipping when it encounters # or ## headings. If the prompt contains subheadings of other levels (such as ### , #### , etc.) after the ## Intermediary updates section, they will be skipped and incorrectly stripped from the payload.\n\nAdditionally, if another ## Intermediary updates heading is encountered while skipping, it will be treated as a stop heading and stop the skipping process, which is also unintended.\n\nWe should update this function to:\n1. Avoid stopping if the heading is exactly ## Intermediary updates.\n2. Support all standard Markdown heading levels (H1 to H6, i.e., 1 to 6 # characters followed by a space).

func isCodexIntermediaryUpdatesStopHeading(trimmedLine string) bool {\n\tif trimmedLine == codexIntermediaryUpdatesHeading {\n\t\treturn false\n\t}\n\tfor i := 1; i <= 6; i++ {\n\t\tif strings.HasPrefix(trimmedLine, strings.Repeat(\"#\", i)+\" \") {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}

@fichas fichas force-pushed the agent/codex-strip-intermediary-updates branch from 5bf97af to 270c4b3 Compare July 7, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant