Skip to content

Use internal model context fragments for goal steering#24918

Merged
jif-oai merged 3 commits into
mainfrom
jif/use-fragment-for-goals
May 29, 2026
Merged

Use internal model context fragments for goal steering#24918
jif-oai merged 3 commits into
mainfrom
jif/use-fragment-for-goals

Conversation

@jif-oai
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai commented May 28, 2026

Why

Goal steering is one form of runtime-owned model context, but the old <goal_context> wrapper made the contextual-fragment hiding path goal-specific. Using a source-labeled internal context fragment gives core and extensions a shared shape for hidden model steering while keeping those prompts out of visible turn history.

The change also keeps legacy <goal_context> messages recognized as hidden contextual input so existing stored history does not start rendering old goal-steering prompts as user-visible turn items.

What Changed

  • Replaces GoalContext with InternalModelContextFragment plus a validated InternalContextSource.
  • Renders goal steering as <codex_internal_context source="goal">...</codex_internal_context>.
  • Updates core goal steering and ext/goal steering to inject the new internal-context fragment.
  • Updates contextual-fragment, event-mapping, goal, and session tests for the new wrapper.

Test Coverage

  • Adds coverage for detecting the new internal model context fragment.
  • Preserves coverage for hiding legacy <goal_context> fragments.
  • Verifies invalid internal context sources are rejected and arbitrary context tags are not hidden.
  • Updates goal steering/session assertions to expect the new source="goal" wrapper.

@jif-oai jif-oai requested a review from a team as a code owner May 28, 2026 14:17
@jif-oai jif-oai changed the title feat: use fragment for goals Use internal model context fragments for goal steering May 28, 2026
@jif-oai
Copy link
Copy Markdown
Collaborator Author

jif-oai commented May 28, 2026

Windows is a transient failure

Copy link
Copy Markdown
Collaborator

@etraut-openai etraut-openai left a comment

Choose a reason for hiding this comment

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

Code looks good

I also manually tested that the TUI properly renders the goal prompt.

@jif-oai jif-oai merged commit 740d942 into main May 29, 2026
45 of 47 checks passed
@jif-oai jif-oai deleted the jif/use-fragment-for-goals branch May 29, 2026 08:28
@github-actions github-actions Bot locked and limited conversation to collaborators May 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants