What version of HAPI is running?
0.20.2
What platform is your computer?
Linux x86_64 / WSL2
OS: Linux x86_64 / WSL2
Codex CLI: 0.142.4
What issue are you seeing?
In a HAPI + Codex session, /compact appears to complete, but the conversation becomes unusable immediately afterwards: the next user message fails with Task failed: Codex thread entered systemError; retrying same conversation.
Important detail: new Codex sessions and normal messages work. The failure is specifically tied to the Codex compact control path. If I do not compact, other sessions continue normally.
Observed UI flow:
/compact
Compaction started
Compaction completed
<next user message>
Task failed: Codex thread entered systemError; retrying same conversation (1/3)
Local evidence from Codex rollout/logs shows the compact RPC and completion happened before the thread failure:
app-server request: thread/compact/start
...
type=compacted
payload.type=context_compacted
I also saw log patterns around the failed continuation such as:
incremental request failed, items didn't match
This looks like the HAPI Codex remote /compact path successfully calls thread/compact/start, but after the compaction boundary the next turn resumes/sends against a stale or invalid Codex thread state. Once Codex reports thread-level systemError, HAPI appears to treat the Codex thread as invalid and the current HAPI session loses the usable Codex context.
What steps can reproduce the bug?
- Start a Codex session from HAPI.
- Use the session normally for a while.
- Send
/compact from the HAPI web UI.
- Wait until HAPI shows
Compaction completed.
- Send any follow-up user message.
- HAPI reports
Task failed: Codex thread entered systemError; retrying same conversation, and the session cannot continue reliably.
What is the expected behavior?
After /compact completes, HAPI should refresh/resume the compacted Codex app-server thread state and the next message should continue in the same conversation with the compacted context.
If Codex returns a transient compact/system error, HAPI should either:
- preserve enough state to retry/resume the same Codex thread when possible; or
- surface an explicit recovery action instead of silently starting/invalidating a fresh thread and losing context.
Additional information
Host-specific identifiers and local paths are intentionally omitted/redacted.
Related HAPI issues/code paths:
Related upstream Codex compaction reports:
This may be a compatibility issue between HAPI's /compact handling and newer Codex compaction behavior in codex-cli 0.142.4.
What version of HAPI is running?
0.20.2
What platform is your computer?
Linux x86_64 / WSL2
What issue are you seeing?
In a HAPI + Codex session,
/compactappears to complete, but the conversation becomes unusable immediately afterwards: the next user message fails withTask failed: Codex thread entered systemError; retrying same conversation.Important detail: new Codex sessions and normal messages work. The failure is specifically tied to the Codex compact control path. If I do not compact, other sessions continue normally.
Observed UI flow:
Local evidence from Codex rollout/logs shows the compact RPC and completion happened before the thread failure:
I also saw log patterns around the failed continuation such as:
This looks like the HAPI Codex remote
/compactpath successfully callsthread/compact/start, but after the compaction boundary the next turn resumes/sends against a stale or invalid Codex thread state. Once Codex reports thread-levelsystemError, HAPI appears to treat the Codex thread as invalid and the current HAPI session loses the usable Codex context.What steps can reproduce the bug?
/compactfrom the HAPI web UI.Compaction completed.Task failed: Codex thread entered systemError; retrying same conversation, and the session cannot continue reliably.What is the expected behavior?
After
/compactcompletes, HAPI should refresh/resume the compacted Codex app-server thread state and the next message should continue in the same conversation with the compacted context.If Codex returns a transient compact/system error, HAPI should either:
Additional information
Host-specific identifiers and local paths are intentionally omitted/redacted.
Related HAPI issues/code paths:
Codex thread entered systemError, HAPI can lose the previous Codex thread context on retry.Task failed Codex thread entered systemErrorcontext-loss behavior./compactslash handling via app-serverthread/compact/start, which seems to be the path involved here.Related upstream Codex compaction reports:
This may be a compatibility issue between HAPI's
/compacthandling and newer Codex compaction behavior incodex-cli 0.142.4.