Skip to content

Fix ACP-created Zed threads missing from Codex desktop history#188

Open
qqmikey wants to merge 2 commits intozed-industries:mainfrom
qqmikey:feature/acp-thread-visibility
Open

Fix ACP-created Zed threads missing from Codex desktop history#188
qqmikey wants to merge 2 commits intozed-industries:mainfrom
qqmikey:feature/acp-thread-visibility

Conversation

@qqmikey
Copy link

@qqmikey qqmikey commented Mar 14, 2026

Summary

  • mark ACP-created sessions as SessionSource::Cli instead of Unknown so Codex classifies new Zed-launched sessions as interactive threads
  • append plain user-entered prompt text to persistent cross-session history for normal ACP prompts
  • exclude slash commands and embedded resource contents from persistent history
  • add regression coverage for ACP session source selection and history persistence behavior

Problem

Threads created from Zed through codex-acp were persisted locally, but they were not registered with the same metadata and history semantics as direct Codex sessions. As a result, the transcripts existed on disk, but the Codex desktop app could not reliably discover them in the thread list/history flow.

In the failing path:

  • ACP initialized the thread manager with SessionSource::Unknown
  • ACP did not append normal prompts to the persistent history/index path used by Codex UI

That combination left ACP-created threads present in rollout/session storage while still being effectively invisible in the desktop history experience.

Root Cause

Codex core currently treats only known interactive sources as part of the normal interactive discovery flow. Initializing ACP sessions as Unknown meant they were not classified the same way as direct Codex sessions.

Separately, ACP prompt submission was missing the Op::AddToHistory step that direct Codex UI uses to persist user drafts/prompts into cross-session history after submission.

During implementation, there was also a follow-up correctness concern: writing the entire ACP prompt payload to persistent history would have leaked embedded resource contents and slash commands into global history. This patch now narrows history persistence to plain user-entered text from standard prompts only.

Implementation

Session classification

  • initialize ACP-created sessions with SessionSource::Cli

There is no dedicated SessionSource::Zed in core today. Cli is the least misleading currently-supported interactive source that preserves discoverability without pretending ACP is VS Code-specific.

Persistent history registration

  • append Op::AddToHistory after standard non-slash ACP prompt submission
  • derive history text only from ContentBlock::Text
  • skip persistent history writes for slash-command flows such as /compact, /undo, /review, and custom slash prompts
  • do not write embedded resource bodies or linked context payloads into ~/.codex/history.jsonl

Behavior After This Change

  • new threads created via Zed codex-acp are no longer recorded as source = "unknown"
  • once a user sends a normal text prompt, the ACP-created thread participates in the same history flow used by Codex UI
  • embedded resource payloads remain available to the runtime prompt sent to Codex, but they are not copied into persistent global history
  • slash commands no longer pollute cross-session prompt history

Test Plan

  • cargo fmt --check
  • cargo test
  • cargo build --release
  • manual smoke: create a thread through Zed codex-acp, send a prompt, and confirm the thread appears in the Codex desktop app history

Notes

  • this change affects newly-created or newly-used ACP sessions; it does not migrate already-recorded historical sessions that were previously stored as Unknown
  • if/when Codex core gains a dedicated SessionSource::Zed, ACP should switch to that source instead of continuing to use the CLI fallback

- mark ACP-created sessions as CLI threads instead of unknown\n- persist only plain user text to cross-session history\n- exclude slash commands and embedded resources from persistent history
@qqmikey qqmikey marked this pull request as draft March 14, 2026 01:38
- persist slash-backed user prompts that still submit normal user input\n- preserve ResourceLink prompts in cross-session history\n- add regression coverage for replayable and non-replayable prompt blocks
@qqmikey qqmikey marked this pull request as ready for review March 14, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant