Skip to content

Codex Desktop becomes slow or stuck after context compaction and approval transcript injection #25009

Open

Description

@jc-p

Environment

  • Product: Codex Desktop app
  • OS: macOS
  • Comparison baseline: Codex CLI/TUI
  • Local session logs inspected: user-local ~/.codex/sessions logs

Summary

Codex Desktop feels noticeably slower than Codex CLI/TUI during reasoning, and several sessions appeared stuck enough that I had to interrupt or start a new session.

The issue seems correlated with long-running Desktop sessions, context_compacted events, and injected approval-review transcript blocks such as approval assessment / TRANSCRIPT DELTA.

Observed Behavior

  1. Reasoning in Codex Desktop is noticeably slower than CLI/TUI for similar workflows.
  2. Some Desktop sessions become stuck or unresponsive and need interruption.
  3. The slowdown often appears after long conversation history, context_compacted, approval review transcript injection, or large tool call / tool output histories.

Local Log Evidence

I scanned local ~/.codex/sessions logs.

High-level counts:

Total session files:        156
Total turns:                1695
Total turn_aborted events:  85
Total context_compacted:    70

Codex Desktop:
  files:                    69
  turns:                    72
  turn_aborted:             4
  turns >= 8 minutes:       3

Codex CLI/TUI:
  files:                    117
  turns:                    1547
  turn_aborted:             78
  turns >= 8 minutes:       52

Although CLI/TUI has more total aborts, it also has far more turns. Desktop has a relatively high number of slow/interrupted turns in a much smaller sample, which matches the user-facing perception that Desktop is less responsive.

Representative Examples

Example 1: Desktop turn after context compaction took about 23 minutes

Observed details from one local session log:

originator: Codex Desktop
turn start line: 610
turn end line:   748
duration:        about 23 minutes
events:          context_compacted, then task_complete
tool calls:      about 36
tool outputs:    about 30

Example 2: Approval transcript injection appears repeatedly in Desktop sessions

Observed details from another local Desktop session log:

originator: Codex Desktop
pattern: repeated approval assessment / TRANSCRIPT DELTA messages

These injected blocks include prior tool call arguments, tool outputs, retry reasons, and planned actions. They appear to increase context size and may be contributing to slower Desktop reasoning or UI responsiveness.

Example 3: Desktop session interrupted shortly after starting

Observed details from another local Desktop session log:

originator: Codex Desktop
event:      turn_aborted
reason:     interrupted

From the user side, this corresponds to a session that appeared stuck and had to be interrupted.

Expected Behavior

  • Codex Desktop should not become significantly slower than CLI/TUI after long context, compaction, or approval-review injection.
  • Approval transcript / TRANSCRIPT DELTA data should not cause unbounded context growth or repeated heavy reprocessing.
  • The UI should clearly distinguish model reasoning, tool execution, waiting for approval, and frontend/UI unresponsiveness.
  • If a session becomes stuck, Desktop should provide a reliable recovery path without requiring a new session.

Possible Areas to Investigate

  1. Whether Desktop repeatedly injects or over-injects approval transcript / tool output history.
  2. Whether context_compacted causes later turns to receive unexpectedly large or inefficient context.
  3. Whether Desktop UI rendering of long reasoning/tool output blocks blocks interaction.
  4. Whether turn_aborted represents explicit user interruption only, or also UI hangs where interruption is the only recovery path.
  5. Differences between Desktop and CLI/TUI context assembly for the same workflows.

Notes

I can provide redacted snippets from the session logs if needed, but I would avoid attaching full raw jsonl logs publicly because they may include local paths, commands, repository names, and internal work context.

Activity

  1. added
    bug
    context
    app
    on May 29, 2026
  2. philbritton commented on Aug 26, 2026

    @philbritton

    I have additional aggregate evidence that this is not only a Desktop responsiveness issue; approval transcript injection can materially amplify model-token consumption.

    Environment

    • ChatGPT/Codex Desktop
    • macOS
    • Auto-review / “Approve for me” enabled
    • Long-running, tool-heavy agent sessions
    • Analysis performed from enterprise Compliance API events exported to an internal Langfuse instance

    No user identities, prompts, client names, repository paths, command arguments, or raw transcripts are included below.

    Observed scale

    In a bounded 30-day sample for one high-volume user:

    • 4,649 total model generations
    • 3,181 Auto-review/Guardian generations identified by the exact internal phrase: Codex agent history added since your last approval assessment
    • Auto-review represented approximately 58% of model calls in the original analysis window
    • Auto-review processed 441.7M tokens in the refreshed window
    • 95%+ of the approval-input volume was cached historical context rather than new input

    In an earlier complete distribution pass over 2,690 review calls:

    • Median approval context: approximately 145,688 tokens
    • 90th percentile: approximately 211,917 tokens
    • Maximum: approximately 254,539 tokens
    • 96.4% exceeded 32K tokens
    • 86.2% exceeded 64K tokens

    One representative approval request contained:

    • 40 TRANSCRIPT DELTA START markers
    • 28 prior shell calls
    • 27 prior shell results
    • Five earlier user requests
    • One current Planned action JSON block

    The current planned action appeared once at the end, but the preceding “delta” included multiple earlier approval-review blocks. Observation IDs and source Compliance event IDs were unique, ruling out telemetry/export duplication.

    This seems inconsistent with the current Auto-review documentation, which says the reviewer receives “a compact transcript plus the exact approval request”:
    https://learn.chatgpt.com/docs/sandboxing/auto-review#what-the-reviewer-sees

    Routine-command amplification

    I separately parsed the final Planned action JSON from every review, rather than searching the recursively repeated history.

    For one internal CLI:

    • 334 distinct approval actions
    • 389 CLI invocations
    • 95% of the invocations were read/query/status/inventory operations
    • No deploy, promote, delete, database-execute, secret-change, or credential-output commands were present

    This reinforces that precise allow rules can reduce review count, but it does not address the unexpectedly large cost of each remaining review.

    Suspected failure mode

    The resulting behaviour looks consistent with previous Guardian review messages being retained in the parent transcript and then included again when building the next reviewer transcript.

    Related community analysis on #32588 suggests the parent history may be fully collected on every review and the GuardianTranscriptCursor applied only afterward:
    #32588 (comment)

    That would explain both the repeated delta markers and the rapid context growth across many reviews.

    Requested fixes

    1. Exclude Guardian/Auto-review prompts and responses from subsequent reviewer transcript collection.
    2. Apply the transcript cursor before collecting or serializing the parent history.
    3. Include only history added since the previous review plus the exact current action.
    4. Add a hard byte/token cap with deterministic compaction or truncation.
    5. Deduplicate prior tool calls/results already reviewed.
    6. Expose reviewer input-token counts and truncation/deduplication metrics in diagnostics.
    7. Add a regression test where hundreds of approvals do not cause reviewer context to grow linearly with the full parent transcript.

    I can provide additional sanitized distributions or command-category counts privately if useful, but cannot share the underlying Compliance records publicly.

  3. jakobboss1010-source commented on Sep 1, 2026

    @jakobboss1010-source

    I have a ready-to-cherry-pick patch against current main f4e6cb7 that addresses the Guardian context amplification described here while preserving authorization evidence.

    The patch:

    • keeps root authorization and trusted user answers through the new shared Guardian context composer;
    • retains all transcript-level user/developer messages, but only assistant/tool evidence from the current user turn;
    • scopes the environment-profile policy to the exact destination host in the pending action, while retaining hostless general rules;
    • fails safe to the full policy when the destination cannot be matched exactly;
    • invalidates reviewer-session reuse when the parent turn changes, preventing a prior action envelope from leaking into the next turn.

    Commit: jakobboss1010-source@6128893

    Focused verification against f4e6cb7:

    • current-action envelope retention
    • matching-destination policy selection
    • unmatched-destination full-policy fallback
    • actual review-session config scoping
    • parent-turn reuse-key invalidation

    All five focused tests passed. just fix -p codex-core also completed successfully. The patch is adapted to the recent shared Guardian context-composition refactor rather than bypassing it.

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

    appbugcontextperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions