openai / openai/codex

Old goal-generation instruction resurfaces after context compaction

Open
#42,051 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

app bug context windows-os
Dominant language
Rust
Stars
125k
Forks
19.5k
PR merge metrics
PR metrics pending

Description

What version of the Codex App are you using (From “About Codex” dialog)?

26.825.51511

What subscription do you have?

Pro 20x

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What issue are you seeing?

I noticed a possible issue with how /goal is preserved across context compaction.

For example, before the first context compaction, I may ask Codex something like:

Based on my description, propose a goal for this task.

Codex generates a goal, and I then manually set it using /goal.

At this point, I would expect the goal-setting process to be finished: the selected goal should be preserved, while the earlier instruction to generate/propose a goal should no longer be treated as an active task.

However, after each subsequent context compaction, Codex tends to propose a new goal again.

This makes it look as if the earlier "generate a goal" instruction has unusually high weight in the compacted memory/context. Even explicitly setting a goal with /goal does not seem to suppress or supersede that earlier instruction.

Actual behavior

After context compaction, Codex sometimes behaves as though "generate/propose a goal" is still an outstanding instruction and generates a new goal, despite an existing goal having already been explicitly set with /goal.

Possible cause

My impression is that goal-related messages may receive disproportionately high priority during context summarization/compaction.

In particular, the compaction process may be preserving the original goal-generation instruction instead of, or in addition to, the final goal state.

It may be useful to distinguish between:

Goal state: the currently active goal configured via /goal
Historical goal-related instructions: e.g. "help me come up with a goal", which should become inactive once completed

Explicit /goal updates should probably supersede earlier goal-generation instructions in the compacted context.

What steps can reproduce the bug?

Example flow
I describe a relatively long task.
I ask Codex to propose a goal based on the description.
Codex proposes Goal A.
I manually run /goal and set Goal A.
Context compaction happens.
Codex proposes another Goal B without being asked.
After later compactions, new goal proposals may appear again.

What is the expected behavior?

Once a goal has been explicitly set with /goal:

The selected goal should persist across compactions.
Previous conversational instructions such as "propose a goal" should be considered completed.
Context compaction should preserve the resulting state ("the current goal is X"), rather than repeatedly preserving/replaying the historical action ("generate a goal").
A new goal should only be proposed when the user explicitly asks to modify/reconsider the goal, or when Codex has a strong reason to indicate that the existing goal is no longer applicable.

Additional information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported flow: ask Codex to propose a goal, set it with /goal, and trigger context compaction. Trace how the active goal and completed goal-generation instruction are represented during compaction; done means the selected goal persists and no new goal is proposed unless explicitly requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
ai
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.