Skip to content

[Critical workflow bug] Auto-compaction silently abandons active delegated tasks; Responses repair destroys handover semantics #6764

Closed

Description

@robin-bially

Client or integration

Codex App; independently investigated with isolated HTTP protocol tests.

Area

Proxy and routing / Responses adapter / automatic compaction.

Summary

Critical autonomous-workflow failure: after automatic compaction, an agent can silently abandon its active, human-authorized delegated task, answer an already-completed initial request again, and end the turn with unfinished work outstanding. There is no transport failure or explicit failed-task signal: the requests succeed. The failure occurs in task ownership and continuation semantics.

The observed Codex App conversation first completed a small browser check, then accepted an explicitly authorized task handover from another chat and worked on it for roughly 32 minutes. Immediately after auto-compaction, it repeated the original browser check and ended its answer, leaving the active task and a pending review unfinished.

This breaks a central promise of long-running agent workflows: compaction must preserve what the agent is currently supposed to finish. A clean API completion can conceal abandonment of the real job. Please prioritize this as a serious workflow-integrity bug, rather than a cosmetic repeated answer.

Confirmed OpenCodex defect

Two code paths interpret the same valid Codex external-task input differently:

{
  "type": "function_call_output",
  "id": "fco_synthetic",
  "name": "send_message_to_thread",
  "namespace": "codex_app",
  "output": "<codex_delegation>Human-authorized task B</codex_delegation>"
}

There is deliberately no call_id: this is externally submitted task input, not the result of a call made by the destination agent.

  • externalTaskInputContent() recognizes it as external task input; the common parser converts it to a user-role message.
  • repairUnidentifiedToolOutputItems() instead converts it to a user message prefixed [tool output for unknown call], discarding the protocol fields that distinguish an authorized handover from an ordinary orphaned result.
  • The Responses passthrough runs that repair after constructing the routed-compaction request. Thus the summarizer sees the external task misclassified as unidentified tool output.

I reproduced this inconsistency by executing the installed 2.80.0 functions directly. The repair function still has this behavior on current main (250f17afd8ff44c93c620d87c1f346ef56f64fb4).

Relevant sources:

Related earlier contract fixes: #3732, #3735, #3807. This report concerns semantic degradation and silent abandonment, rather than their explicit missing-call_id rejection.

Reproduction

Run this TypeScript fixture against the repository, or adapt the import paths to the installed package:

import { externalTaskInputContent } from './src/responses/task-input';
import { repairUnidentifiedToolOutputItems } from './src/adapters/openai-responses/tool-output-recovery';

const seed = {
  type: 'function_call_output',
  id: 'fco_synthetic',
  name: 'send_message_to_thread',
  namespace: 'codex_app',
  output: '<codex_delegation>Human-authorized task B</codex_delegation>',
};

console.log(externalTaskInputContent(seed));
// Correctly recognized as external task input.

console.log(JSON.stringify(repairUnidentifiedToolOutputItems({ input: [seed] })));
// Incorrectly labelled "[tool output for unknown call]".

Behavioral reproduction and controls

The isolated fixture contains:

  1. User task A: inspect example.txt.
  2. Recorded successful tool result and assistant confirmation: A is completed.
  3. A valid external-task envelope: human-authorized task B, synthetic ticket 1731, with reviewer pass 2 pending.
  4. Assistant acknowledgement that B is active.
  5. A real remote-compaction request through /v1/responses using compaction_trigger.
  6. Continuation with the retained original user message and returned compaction item, mirroring the observed replacement-history shape.

The fixture explicitly tells the model what Codex's external-task protocol means. Both native GPT and routed Claude choose B with the full history, establishing a valid pre-compaction baseline. Tool calls only record the selected next action; no real files, tickets, browser actions, or reviews are changed by these tests.

Route / condition Observed continuation
Native OpenAI/GPT compaction, no proxy B continued in both tested runs
OpenAI/GPT through OpenCodex B continued
Claude through OpenCodex → Meridian Both tested runs abandoned B and answered completed A
Handover normalized to user input before Claude summarization, but only original A retained afterward Both tested runs selected A again, despite a correct summary identifying B as active
Direct user message naming B retained after compaction Claude continued B
Explicit new user instruction: A is done; do not repeat A; continue B Claude continued only B in both tested runs

These are small controlled tests, not statistical reliability estimates. Preliminary fixtures that lacked valid handover semantics were excluded from this comparison.

Switching the compaction model to GPT does not suffice

I tested a portable GPT-generated prose checkpoint followed by Claude continuation, using OpenCodex's COMPACT_PROMPT and an ocx1: envelope. This emulates the cross-provider portable-summary path; I did not change the live compactionRouting setting.

Two results:

  1. With the unchanged external-task item, GPT sees [tool output for unknown call] and questions whether B was authorized. Changing the summarizer cannot restore protocol information already removed upstream.
  2. With the handover normalized before GPT summarization, GPT correctly identifies B as active and A as completed. Claude nevertheless selects A again after replay. So there is also a continuation/task-selection issue beyond summary accuracy.

Limits of attribution

The inconsistent external-task handling above is a concrete OpenCodex defect. The additional failure after replay of a correct summary is reproduced in the Claude/Meridian route, but is not fully isolated between message framing, Meridian and Claude behavior.

In the original App failure, the complete summary was preserved word-for-word in the actual Claude input and correctly named the active task. Codex continued the same turn. This rules out simple summary truncation or a new user turn as the explanation for that incident. The retained old request and decoded summary arrived as one user message after Meridian translation.

Native OpenAI's successful controlled compaction is a useful control, not proof that native Codex can never have a similar failure.

Expected behavior / suggested investigation

  • Reuse external-task recognition in the Responses passthrough before generic orphan-output repair; preserve authorized-task provenance. Do not promote arbitrary tool output based only on delegation text or XML.
  • Preserve the active authorized task through both summarization and replay, including a clear distinction between completed requests and the current job.
  • Add a regression fixture with completed A → authorized external B → compaction → continuation. Assert that B remains active and A is not repeated. Cover both correct-summary replay and cross-provider compaction.

Version

2.80.0

Operating system

macOS 27.0.1, build 26A434

Provider and model

meridian/claude-opus-5-5 through OpenCodex → Meridian 1.79.0. Native/control model: gpt-6.1-sol.

Logs or error output

externalTaskInputContent(seed): external user task recognized
repairUnidentifiedToolOutputItems({input:[seed]}): [tool output for unknown call]
Before compaction: continue_review({ticket:1731})
After routed compaction: answers already-completed task A; B remains unfinished
Transport: successful completion, no explicit failure signal

Screenshots and supporting files

The deterministic TypeScript reproduction, source permalinks, behavioral controls and test matrix are included above. No private conversation logs are attached.

Additional environment details

  • OpenCodex: 2.80.0.
  • Codex App bundled CLI reported by the affected rollout: 0.160.1.
  • Meridian: 1.79.0.
  • OS: macOS 27.0.1, build 26A434.
  • Routed selector: meridian/claude-opus-5-5; Meridian telemetry reports opus[1m].
  • Native/control selector: gpt-6.1-sol.
  • Auto-compaction token limit in the observed App configuration: 350000.
  • No compaction-routing override configured during the original incident.

Redacted configuration shape

{
  "providers": {
    "meridian": {
      "adapter": "openai-responses",
      "baseUrl": "http://127.0.0.1:3456/v1"
    }
  }
}

Codex's OpenAI base URL points to the OpenCodex loopback listener. All reproduction content above is synthetic or anonymized; no account identifiers, credentials, customer data, private repository URLs, or private chat logs are included.

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. github-actions commented on Oct 8, 2026

    @github-actions
    Contributor

    Issue reopened

    The report now contains the information required by the automated check. Thanks for updating it.

  2. added
    bug
    on Oct 8, 2026
  3. lidge-jun commented on Oct 9, 2026

    @lidge-jun
    Owner

    Fixed by #6795 (merged 2026-10-09) on dev. Please reopen if it still reproduces on a build that includes it.

  4. robin-bially commented on Oct 12, 2026

    @robin-bially
    ContributorAuthor

    Attribution correction (2026-10-12): The bypass observations below remain valid, but they reused OpenCodex's generated checkpoint representation. They therefore do not exonerate that representation or establish that the remaining investigation belongs exclusively downstream. Direct Anthropic HTTP controls now isolate the continuation framing at OpenCodex's typed-checkpoint-to-user-text boundary. See the causal follow-up and corrected ownership analysis. The simple prefix candidate is not a comprehensive fix.

    Retest on 2.83.0: the wire-contract fix works; the user-visible continuation problem remains, but is not isolated to OpenCodex

    Thank you for merging #6795 / carrying #6769. I retested the running OpenCodex 2.83.0 → Meridian 1.80.0 → Claude stack on 2026-10-12, then performed bypass tests to avoid attributing a downstream problem to OpenCodex.

    The scoped source fix is correct. Both repairUnidentifiedToolOutputItems() and repairOrphanedInputItems() now preserve a recognized, unpaired Codex external-task envelope as user content. I executed the installed functions directly and verified this, including the control that ordinary orphaned output retains its marker. The former [tool output for unknown call] degradation is fixed.

    The original user-visible symptom is not fully resolved: after compaction, Claude can still abandon the active authorized task and answer/repeat the completed original request. This does not mean #6795 is an incorrect fix. Its description explicitly says that task selection after replay is outside its scope.

    End-to-end protocol retest

    Same synthetic scenario as before:

    1. User requests A: check whether example.txt is readable.
    2. Recorded successful action and assistant confirmation: A is completed.
    3. Human-authorized external task B arrives: continue pending reviewer pass 2 for synthetic ticket 1731.
    4. Assistant accepts B as active.
    5. Submit a real /responses request with compaction_trigger.
    6. Replay the returned checkpoint alongside the retained original user request.

    The mock action tools only record which task the model selects; no real document, ticket or review is modified. There is no configured compaction-routing override.

    Four post-compaction continuations per model: three with explicit explanation of Codex's external-task protocol, one without that additional explanation.

    Model Continue only active B Continue B but also repeat completed A Abandon B / return to A
    Claude Opus 5.5 1 1 2
    Claude Sonnet 5.5 0 0 4
    Claude Haiku 5.5 0 0 4

    All 12 compaction requests and all 12 post-compaction continuation streams completed successfully. Some separate pre-compaction baselines emitted the expected continue_review action but ended as response.incomplete/max_output_tokens; those partial terminal statuses are retained in the evidence and are not presented as fully successful transport runs. Baseline action selection was B for all three models.

    A particularly useful counterexample is Opus run 2: its generated checkpoint explicitly marks the document check completed and labels ticket 1731 as the active task, with reviewer pass 2 next. The continuation nevertheless chooses check_document(example.txt) and says it will check it again. Sonnet run 1 also receives a checkpoint correctly naming B as active and selects A. Thus this cannot be explained solely by a bad or missing summary.

    Attribution: bypassing OpenCodex

    I selected the same correct Opus-run-2 checkpoint and kept it fixed across routes. For the OpenCodex route I replayed its ocx1: item. For direct Meridian calls I decoded that item using the actual installed compactionItemToText() function and sent the resulting ordinary message directly, with the same old request, system instructions and action-tool meanings. No OpenCodex HTTP request was involved in those direct runs.

    Route, same fixed checkpoint, Opus 5.5 Two observed results
    OpenCodex → Meridian /responses One return to A; one continuation of B
    Direct Meridian /responses, OpenCodex bypassed Both abandon B: one repeats A, one answers completed A and declines B
    Direct Meridian /messages, OpenCodex bypassed Both select check_document(example.txt) again

    This is strong evidence that OpenCodex is not required for the remaining failure. Simply retaining or reverting its external-task repair is not the explanation.

    I also inspected the actual Claude SDK input generated by Meridian for this fixture. The complete checkpoint is present. On the Responses route, Meridian's translateResponsesToAnthropic() / pushBlock() combines the adjacent user messages into one turn. On the Messages route, the old request is framed as conversation history and the checkpoint is placed after the replay boundary. The failure occurs in both tested forms. Message coalescing is therefore a relevant difference, not a proven sole cause.

    Further boundary check: bypassing Meridian too

    I ran native Claude Code 2.1.281 / Opus 5.5 directly, using the same checkpoint text and old request, with both OpenCodex and Meridian bypassed. Real tools and MCP were disabled; the model returned a JSON decision between the next actions.

    • Run 1: continue_review (B).
    • Runs 2 and 3: answer_completed_A (active B is not continued).

    Important limitation: this native CLI control is a JSON decision test, not the identical Responses action-tool fixture. It demonstrates that the old-request/checkpoint ambiguity can reproduce without either bridge, but does not prove that Claude alone explains every original Desktop failure or exonerate all Meridian framing.

    What is and is not established

    • Established: the specific OpenCodex task-envelope misclassification is fixed.
    • Established: the user-visible continuation failure remains in the tested Claude chain, including cases with correct checkpoint content.
    • Established: it reproduces with OpenCodex bypassed; related wrong task selection also occurs in the native Claude CLI control with Meridian bypassed.
    • Not established: an additional OpenCodex implementation defect that should receive another OpenCodex patch.
    • Not established: a Meridian-only root cause. Its framing may contribute, but the native CLI control prevents assigning exclusive blame to Meridian.

    The best-supported remaining investigation is Claude's task/authorization interpretation across checkpoint replay, including Meridian's presentation of that replay. This belongs downstream for further isolation. A provider-specific mitigation in OpenCodex might eventually be possible, but a mitigation is not evidence that OpenCodex owns the root cause.

    I am not asking to undo #6795 or to add a speculative second OpenCodex fix. Please distinguish closure of the demonstrated wire-contract defect from resolution of the broader workflow symptom. Before implementing another fix here, require evidence that identifies an additional OpenCodex-owned invariant. If a Meridian-owned defect is isolated instead, it should be fixed and tracked there.

    These are small controlled protocol/decision tests, not statistical failure-rate estimates or a new 350k-token full Desktop session. No production chats or configuration were modified. All published task content is synthetic/anonymized.

  5. robin-bially commented on Oct 12, 2026

    @robin-bially
    ContributorAuthor

    Correction to attribution: the portable checkpoint representation is causally involved; bypassing its creator did not exonerate it

    I need to correct the attribution in my previous retest comment. The external-task-envelope repair in #6795 is correct and remains fixed. However, my conclusion that the remaining investigation belonged downstream was too strong: those bypass tests retained the input representation that OpenCodex had already created. A defect in that representation can travel through a bypass.

    I have now isolated the continuation decision using the actual Anthropic request emitted by the installed Claude SDK, followed by direct HTTP replay to Anthropic. Neither the OpenCodex server, the Meridian server, nor SDK request transformations participate in these direct replays. Versions under test: OpenCodex 2.83.0, Meridian 1.80.0, Claude Code 2.1.281.

    The concrete boundary

    The retained original user request A remains an imperative user instruction after compaction. A is already completed. The subsequently authorized active task B survives in the checkpoint as a description of prior authorization and unfinished work.

    OpenCodex's routed replay converts a typed compaction item into ordinary user text:

    The generic prefix describes another model's summary and says to build on previous work. It does not explicitly mark the retained earlier commands as historical or make clear that this is automatic continuation of the checkpoint's active, already authorized task. Claude can consequently select A as the live request or treat B as a claim about another session requiring renewed authorization.

    This is a continuation-semantics compatibility problem at the typed-checkpoint-to-plain-text boundary. It is not missing checkpoint bytes, and the evidence does not identify a Meridian-only corruption.

    Controlled intervention: identical messages and tools, only system continuation framing changed

    The fixture is held fixed: A checks example.txt and is recorded complete; human-authorized B continues pending reviewer pass 2 for synthetic ticket 1731. The selected checkpoint explicitly marks A complete and B active. Both tools are mock action recorders; no real work is executed.

    For each model, the original and intervention requests use the same messages, complete checkpoint, tools, model, thinking configuration and effort. Only a generic system instruction identifying automatic continuation and the priority of the active unfinished task is added. It contains no ticket number or task-specific answer.

    Direct Anthropic HTTP Original representation Explicit system continuation framing
    Claude Opus 5.5 3/3 repeat only completed A 3/3 continue only B
    Claude Sonnet 5.5 1/1 repeat only completed A 1/1 continue only B
    Claude Haiku 5.5 1/1 repeat only completed A 1/1 continue only B

    All of these direct requests return HTTP 200 and stop_reason: tool_use. These are small controlled observations, not estimated failure rates.

    For the decisive Opus comparison, the unchanged fields have these SHA-256 hashes over their JSON serialization:

    messages:      b91daca1cdfe9069a26d424e74d4a5ad7d7146cd24885b88fb0cc517bba63ac2
    tools:         f28f59378bb24a5ce20b6ef6f396b05765421f79b79e3cece3c3e8d82736045e
    thinking:      88a008df16e0b675a96db696c9e79d87810137e49e725ab3911030b32940d526
    output_config: fdc807694f8674cf32b7e7b8352366b1651feed4f85f8e80ee7a07032273cb4b
    

    Additional controls:

    • Remove only Meridian's system notes, keeping the original task/checkpoint input: Opus still selects A in 2/2 runs. Those notes are not necessary for this failure.
    • Remove only the old imperative A, keeping the checkpoint: direct SDK Opus selects B in 3/3 runs; direct HTTP Haiku selects B in 1/1 run.
    • Change only the user-text checkpoint prefix to identify automatic continuation: Opus 2/2 and Sonnet 1/1 select only B; Haiku 1/1 selects both A and B. A simple prefix replacement is therefore not a demonstrated complete fix.
    • Append a genuinely new user request after the improved checkpoint: Opus correctly checks other.txt and pauses B, both through direct Anthropic HTTP and through the existing OpenCodex/Meridian services.
    • The improved prefix also produces the correct B action through both existing OpenCodex → Meridian and direct Meridian Responses routes. Those two streams end response.incomplete/max_output_tokens after that action, so I count their task selection only, not fully successful transport completion.

    What this means for ownership and the existing PR

    #6795 fixes the external task's classification before compaction. It does not change how the active task is presented after compaction, so it can be correct while the reported workflow symptom remains.

    Meridian preserves the complete checkpoint. Its adjacent-user coalescing is not necessary for reproduction, and neither its server runtime nor its system notes are necessary in the direct controlled case. There is no basis here to call this a Meridian-only bug or move the issue there exclusively.

    OpenCodex owns the portable ocx1 representation and its lowering to ordinary text. The new controls therefore justify investigating/fixing preservation of continuation semantics at that OpenCodex boundary, rather than claiming that any OpenCodex change would be an unrelated downstream workaround. Claude's interpretation remains part of the interaction; this is not proof of an intrinsic defect in every model or native OpenAI compaction.

    Please do not ship an unscoped replacement of the shared SUMMARY_PREFIX based only on these results: V1 retention/recovery paths recognize it exactly, and the Haiku control shows that a text-prefix change alone is insufficient. A scoped implementation should preserve the active task and existing authorization at the recognized compaction boundary, obey later real user input, and test pause/cancellation and all supported Claude models.

    The original failing chat's actual Claude input still verifies that the complete active-task summary arrived alongside the old example.com request; the new causal fixture strengthens that observation by explicitly marking the old task completed. No live user configuration or production chat history was modified, and no new 380k-token Desktop session was run. Initial capture transport errors and one invalid HTTP message ordering were excluded from the results. This is an identified mechanism and a tested mitigation direction, not a delivered comprehensive fix.

  6. Ingwannu commented on Oct 12, 2026

    @Ingwannu
    Owner

    The corrected attribution in comment 6126458740 is materially new evidence and should not be collapsed into the earlier downstream-only conclusion. Current dev 3e58c2ce3e still lowers a recognized portable compaction item through scrubOcxCompactionItems to a user-role message using compactionItemToText and the shared SUMMARY_PREFIX. A bypass that retains those generated bytes cannot exonerate that lowering. #6795's external-task classification fix can be correct while this separate continuation-framing problem remains.

    I independently checked that source boundary and the prefix consumers, not the live model trials. The reported small A/B samples are causal fixture evidence, not a reliability estimate; the Haiku prefix-only control and incomplete bridge terminals must stay visible. Please preserve the exact synthetic messages/tools/checkpoint and intervention as an offline fixture artifact (hashes alone cannot reproduce it), including a later genuine user request, pause/cancel, no active unfinished task and ordinary quoted-summary controls.

    @lidge-jun please reassess/reopen the continuation-semantics portion or track a scoped follow-up separately from the already-fixed envelope defect. I have not overridden your completed closure. Do not globally replace SUMMARY_PREFIX: Cursor recovery and V1 history generation/recognition share it. A patch must recognize the compaction boundary, preserve later real user intent and must not promote arbitrary checkpoint/tool prose into new system authority or new authorization. No live provider/SDK trial, model spend, security scan or production-history change was performed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions