/goal cannot create a new goal in the same thread after previous goal is complete
What happened?
After completing a /goal in an interactive Codex thread, the CLI/tooling still refuses to create a second goal in the same thread.
The existing goal is already marked as complete, but creating another goal fails with:
cannot create a new goal because this thread already has a goal; use update_goal only when the existing goal is complete
This is confusing because the goal is already complete. Re-entering/resuming the same thread does not release the goal state.
Expected behavior
Once a thread goal is marked as complete, one of these should be possible:
- Creating a new /goal in the same thread, or
- A clear built-in command/action to archive/delete/replace the completed goal, or
- A clearer error explaining that /goal is intentionally one-per-thread forever.
Actual behavior
The completed goal remains associated with the thread and blocks any subsequent /goal creation. The error message suggests using update_goal only when the existing goal is complete, but the existing goal is already complete.
Local diagnostics
Codex version:
codex-cli 0.131.0
Feature flag:
goals experimental true
Local state observations:
~/.codex/state_5.sqlitecontains athread_goalsrecord for the current thread.- The record status is
complete. ~/.codex/goals_1.sqliteexists, but itsthread_goalstable is empty in this environment.- The schema in
state_5.sqlitehasthread_id TEXT PRIMARY KEY, so the thread can only hold one goal record.
Observed schema:
CREATE TABLE thread_goals (
thread_id TEXT PRIMARY KEY NOT NULL,
goal_id TEXT NOT NULL,
objective TEXT NOT NULL,
status TEXT NOT NULL CHECK(status IN ('active','paused','blocked','usage_limited','budget_limited','complete')),
token_budget INTEGER,
tokens_used INTEGER NOT NULL DEFAULT 0,
time_used_seconds INTEGER NOT NULL DEFAULT 0,
created_at_ms INTEGER NOT NULL,
updated_at_ms INTEGER NOT NULL
);
Why this matters
The /goal workflow is useful for phased project work. A common pattern is:
- Goal 1: standardize project structure
- Goal 2: refactor database access layer
- Goal 3: abstract AI providers
Currently, after Goal 1 is complete, Goal 2 cannot be created in the same thread. Opening a new thread loses useful context, and manually deleting local SQLite state is risky and not a reasonable user workflow.
Suggested fix
Support one of the following:
- Allow
create_goalwhen the existing goal status iscompleteby replacing/archiving the old record. - Add a supported command to clear/archive a completed goal from the current thread.
- Improve the error message if one-goal-per-thread is intentional.
Environment
- macOS
- Codex installed via npm package
@openai/codex - Version:
0.131.0
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗