Compaction can promote partial output from interrupted commands into falsely confirmed task state
What issue are you seeing?
Codex appears vulnerable to a broader failure class in which ephemeral observations from an interrupted command can be promoted into confirmed task state, then inherited by later turns or sessions without re-verification against durable artifacts.
This is related to, but more specific than:
- #14341 — false completion / reporting unperformed actions as completed
- #14589 — compaction discarding tool outputs and preserving only an LLM-generated summary
- #22219 — stale task-state hallucinations overriding the latest external state
The specific failure mode is:
- A long-running command produces partial stdout.
- The process is terminated before its intended side effect completes (for example, before writing a JSON file).
- The session is compacted or resumed.
- The partial stdout is summarized as if the corresponding operation completed successfully.
- A later model/turn inherits that summary and treats the result as confirmed.
- Inspection of the actual output file shows that the claimed result was never persisted.
This is an observation–persistence conflation: “output appeared in the terminal” is treated as equivalent to “the operation completed and its result was durably written.”
A documented instance and mechanism analysis are available here:
- arXiv: https://arxiv.org/abs/2607.13071
- Reproduction and original report: https://github.com/anthropics/claude-code/issues/76584
Although the documented instance occurred in Claude Code, the constituent mechanisms have already been independently reported in Codex through #14341, #14589, and #22219. The concern is that Codex may exhibit the same class of integrity failure under long-session, high-context, interrupted-process conditions.
What steps can reproduce the bug?
The following protocol should test the failure deterministically or near-deterministically.
Test script
Use a script that:
- Emits a result to stdout immediately.
- Delays the durable write.
- Is guaranteed to be interrupted before the write occurs.
Example:
import json
import time
from pathlib import Path
output_path = Path("result.json")
print(json.dumps({"case": "A1", "status": "success", "value": 42}), flush=True)
# Ensure partial stdout is visible long before persistence.
time.sleep(120)
output_path.write_text(
json.dumps([{"case": "A1", "status": "success", "value": 42}], indent=2),
encoding="utf-8",
)
print("persisted", flush=True)
Reproduction sequence
- Start a long-running Codex session with enough prior activity to approach or trigger context compaction.
- Ask Codex to run the script and report the completed result from
result.json. - Terminate the command after the JSON line appears in stdout but before
result.jsonis written.
- On Unix-like systems, send
SIGTERM; expected exit status is 143. - On Windows, use the closest available termination path and record the process status.
- Continue until compaction occurs, or resume/fork the task if the product surface supports it.
- Ask Codex which cases completed successfully.
- Observe whether it reports
A1as completed based on the earlier stdout or compacted summary. - Inspect durable state:
ls -l result.json
cat result.json
Expected durable state: result.json does not exist, is empty, or lacks A1.
Stronger multi-item variant
Use a loop where each item prints a success record, sleeps, and only appends to a cumulative file after the sleep. Kill the process after two stdout records but before the first file append. Then verify whether the compacted/resumed session reports those two items as completed.
Evidence to capture
- Full command invocation
- stdout and stderr
- process exit status / signal
- timestamp of process termination
- compaction or resume boundary
- inherited summary or later status report
- hash and contents of the expected output artifact
- latest filesystem state before the final assistant response
What is the expected behavior?
Codex must not describe an interrupted operation as completed unless the intended external side effect is independently verified.
At minimum:
- Partial stdout from a non-zero-exit command must be labeled observed, unconfirmed.
- Exit status must remain attached to the command output through compaction and session inheritance.
- A later turn must verify the target file/database/repository state before reporting completion.
- If verification is unavailable, the assistant should say that the result was observed in partial output but was not confirmed as persisted.
Example expected response:
The process emitted an A1 success record, but it exited with status 143 before result.json was written. A1 is therefore unconfirmed and should be rerun.
Proposed mitigation
1. Preserve execution provenance through compaction
Every summarized operational claim should retain:
- command ID
- exit code / terminating signal
- stdout/stderr provenance
- intended side effects
- verification state
- artifact path or external resource identifier
A summary should not flatten all of these into plain natural-language assertions.
2. Introduce explicit epistemic states
Operational claims should use states such as:
plannedstartedobserved_partial_outputprocess_exited_nonzeropersisted_unverifiedverified_persisted
Only verified_persisted should be eligible for “completed” language.
3. Exit-code-aware summarization
If a command exits non-zero or is terminated by signal:
- mark all derived outputs as unconfirmed;
- prohibit the compaction summary from stating that the task completed;
- require explicit verification of intended artifacts before promotion to confirmed state.
4. Artifact-first completion checks
Before reporting completion, Codex should re-read the authoritative external state:
- files: existence, content, mtime, and optionally hash
- Git: latest
git status/ commit state - databases: committed row/query result
- APIs: persisted response record or transaction identifier
- tests: final test runner exit status and saved report
5. Inherited-state skepticism
After compaction, resume, fork, or model handoff, claims about external state should be treated as assertions requiring verification, not as ground truth. The downstream model should distinguish:
- user-provided statements
- prior assistant claims
- raw tool observations
- independently verified external state
6. User-visible integrity warning
When a session contains interrupted commands whose side effects were not verified, show a persistent warning such as:
One or more prior commands ended abnormally. Their partial outputs are not confirmed as persisted results.
Why this matters
This can silently corrupt:
- scientific and benchmark results
- batch API experiments
- migration and synchronization tasks
- test reports
- repository state summaries
- security research evidence
- any multi-step workflow that relies on session continuity
The core risk is not ordinary factual hallucination. It is fabricated confirmation of external state, which can propagate across compaction boundaries and become increasingly difficult for later models or users to detect.
5 Comments
Cross-vendor linkage and severity assessment
This issue is not an isolated model-behavior complaint. It is part of a reproducible cross-vendor integrity-failure cluster involving false completion, lossy compaction, stale inherited state, and self-verification failure.
Primary source report
Related integrity failures
Research record
The paper formalizes the core failure as Observation–Persistence Conflation: an ephemeral observation inside the model/tool context is promoted into a durable fact even though the authoritative external state does not support it.
Why this should be treated as critical
The impact is broader than ordinary hallucination:
This is therefore best classified as a workflow-integrity / provenance-integrity defect, not only a model-quality issue.
Minimum remediation expectation
A fix should enforce the following invariant:
For interrupted or non-zero-exit commands, all derived results should remain
observed_partial_outputorunconfirmed, and that state must survive compaction and session inheritance.Additional comparison evidence has been identified and is being recorded for reference.
In
openai/codex-security#20, the samescan-manifest.jsonsave-failure pattern has also been independently reported with Codex Security version0.1.1.The following independent Codex Security reports each describe one or more discrepancies among the artifacts actually generated or modified, the validation performed on those artifacts, the execution status recorded by the system, the final result presented to the user, and the processing stage at which the discrepancy occurred:
openai/codex-security#30openai/codex-security#34openai/codex-security#48openai/codex-security#49openai/codex-security#50openai/codex-security#51openai/codex-security#53These reports are relevant to the broader failure class described here because they provide concrete comparison cases for distinguishing observed or generated output from validated, durably recorded, and user-reported state.
At this time, I am not asserting that these reports share the same root cause as this issue. I am also not treating them collectively as one bug, one security vulnerability, or one bounty-eligible finding.
They are linked only as independent comparison cases for evaluating artifact integrity, validation order, completion-state transitions, final-report accuracy, and failure-stage behavior. Until a common cause is established, each report should be treated independently.
Three additional high-signal comparison cases are relevant to the completion-state boundary described here:
openai/codex#35613provides a reduced reproduction in which Code Mode reportsScript completedwhile nested exec processes remain live and their model-visible control handles have been discarded. This is a direct completed-versus-effective-runtime-state discrepancy.openai/codex-security#37provides a deterministic injected-event reproduction in which certain unexpectedturn.failedpayload shapes fall through to CLI exit code0andcomplete-scan. Whether those payload shapes are reachable in a normal production scan remains unconfirmed.openai/codex#35810reports the opposite-direction discrepancy: across ten tool-enabled App Server runs, the final assistant output and a valid task artifact were produced, butturn/completedwas never emitted and the client waited until timeout.Together, these cases show that generated output, live runtime state, terminal failure events, validated artifacts, and protocol completion signals can diverge in more than one direction. I am not asserting a shared root cause, formal duplication, or security impact across these reports. They are linked as independent comparison evidence for defining when an agentic operation may safely be represented as completed.
Additional real-world occurrence: checkpoint prose was inherited as verified project state
I observed a closely related failure during a long-running Windows project handoff for
C:\GenAI-Evidence-Workbench.A later assistant inherited prior completion/checkpoint summaries and reported the following as established project facts:
A separate read-only local verification then found:
The
17 / 34value existed only as a repeated assertion inside checkpoint records. No authoritative file defining the 34 steps was found, so neither the denominator nor “Step 18” could be reconciled against a durable tracker definition.The UI claim also failed artifact inspection. The browser entry point was:
It was explicitly labeled:
and only switched between pre-rendered 1920×1080 PNG screens. It was not connected to a file selector, backend, API, Evidence Core, or pipeline. The package itself had not been created.
This occurrence shows a second path into the same integrity failure described in this issue:
The problem is not merely an inaccurate summary. A repeated self-reported value became progressively more authoritative because it appeared in multiple checkpoint files, even though the underlying definition artifact did not exist. Likewise, a static visual checkpoint was promoted into a functional product UI.
Expected behavior after compaction, resume, model handoff, or cross-session continuation:
>
17 / 34is repeated in checkpoint records, but no standalone 34-step definition was located; Step 18 is therefore undefined from the available artifacts.Related: #31177 (completion over-reporting despite explicit state distinctions), #27974 (generated/static images presented as real UI evidence), and #36718 (evidence-backed completion reports).
This is already a major completion-integrity defect at the human-review boundary
This is not a hypothetical future risk and does not depend on the bug becoming more severe.
The observed behavior already breaks a core operational assumption of Codex: that work presented to the user for human review accurately represents the state of the underlying artifacts.
In the documented occurrence, Codex inherited prior checkpoint prose and presented materially false project state as established fact:
17 / 34was presented as verified project progress even though the denominator could not be reconciled to an authoritative artifact;Independent human inspection of the filesystem was required to discover these discrepancies.
The failure path was:
This directly compromises the human-review boundary.
Codex is designed to perform repository work, execute tools and tests, and return the resulting work to the user for review. That review boundary is only meaningful if the state being presented for review is itself evidence-backed.
In this occurrence, it was not.
The user could not determine from the completion report that material parts of the claimed work had never been completed. Verification required an independent second inspection of the actual project tree.
Therefore, human review is currently not merely a final quality check in this failure mode. It becomes the only mechanism preventing an incomplete or nonexistent implementation from being accepted as completed.
For autonomous or long-running Codex workflows, that is already a major workflow-integrity defect.
The required invariant should be:
Completion state must preserve at least the distinction between:
claimedobservedpersistedverifiedNatural-language checkpoint summaries, prior assistant statements, screenshots, UI mockups, intermediate manifests, and repeated progress counters must not be promoted into authoritative completion state merely because they were inherited from an earlier turn or checkpoint.