Skip to content

feat: support native persistent session queues - #612

Closed
Wolf-L wants to merge 1 commit into
agentclientprotocol:mainfrom
Wolf-L:refresh/20261011-codex-queue
Closed

Wolf-L wants to merge 1 commit into
agentclientprotocol:mainfrom
Wolf-L:refresh/20261011-codex-queue

Conversation

@Wolf-L

@Wolf-L Wolf-L commented Oct 10, 2026 •

Copy link
Copy Markdown

Replaces #598 after withdrawing the earlier submission and refreshing against current main.

Problem and behavior

ACP clients cannot manage Codex's persistent message queue. Queue add and cold
resume can start generation without session/prompt, so forwarding writes alone
leaves output, approvals and cancellation without an owner.

This adds the negotiated _session/queue extension with
list/add/update/delete/reorder/start. Native Codex retains persistence, ordering and
scheduling. The adapter subscribes before dispatch, gives autonomous turns their own
event/permission lifetime, preserves pending entries on interruption, routes child
interactions to their originating turn, and replays history before buffered live output.
Each action requires a nonmutating probe of the running native server; native validation
errors stay parameter errors, and ambiguous writes are never retried automatically.

The change is based on current main at 202e66e (2.2.2), with no rewind feature
dependency. It preserves upstream sessionIndex, custom instructions, session title
selection and app-server recovery. Queue actions re-probe after crashes; stale loaded
sessions require explicit load to reconcile, and lazy prompt recovery does not
auto-dispatch persisted input. Direct index mutations share queue/cancellation locks.
Provider waits stay at the upstream request boundaries so close and local settings
can settle an in-flight prompt or resume. Sixteen new regressions cover these interactions.

Queue timeout recovery includes owned provider cleanup. POSIX process helpers also
support compiled Bun entrypoints. Protocol, examples and limits are documented in
docs/native-queue-controls.md.

Validation

  • Ubuntu 24.04.5 / Node 24.14.0: typecheck/build pass; full suite 1638 passed, 37 skipped.
  • Windows queue/process/token suite: 170 passed, 3 platform skips; typecheck/build pass.
  • Windows recovery/index suite: 114 passed, 5 failed. Untouched current main
    reproduces the identical five subscription-notification failures. No full Windows
    green result is claimed.
  • Real native Codex 0.160.1, isolated home/workspace and loopback Responses
    fixture: 10/10 on both Windows and Ubuntu, including invalid reorder/start and
    cross-session rejections, idle add, automatic successors, cancellation, explicit
    non-head start, durable cold edits and reload. Native child shutdown is verified.
  • All six Bun release targets compile; six compiled POSIX cleanup/entrypoint cases pass.
  • Tests use a single worker with no file parallelism. Source/build/native hashes are
    recorded by the native harness. The 37 Linux skips include opt-in account/model E2E
    tests; no real account/model or global installation was used.

Limits

Add on an idle loaded thread can generate immediately; start can drain subsequent
items. Cancellation racing completion is not atomic whole-queue pause. External native
writers are outside the adapter reservation, and native admission/removal are separate,
so exactly-once execution is not promised. The loopback provider and denying HTTP
proxy are environment isolation, not an OS firewall. Cross-compilation does not prove
runtime behavior on every target. These are local results; hosted CI remains separate.

中文说明

新增 Codex 原生持久队列的查询、新增、编辑、删除、重排和指定条目启动,继续由原生
负责存储与调度。add 和冷恢复可能自动生成,因此适配器在派发前接管事件、审批和取消,
独立管理自动轮次及子代理归属;历史回放后再发布缓冲的实时事件。逐项探测运行中的
原生能力,参数错误保持参数错误,结果不明确的写入不自动重试。

直接基于当前主线 202e66e(2.2.2),不依赖 rewind 功能。保留上游 sessionIndex、
custom instructions、标题选择、空会话 resume 和完整 app-server 恢复语义。崩溃后重探测
能力,旧本地会话显式 load 对账;普通请求的自动恢复不会隐式派发非空队列。索引直接
重命名/归档/取消归档与队列写入及取消互斥;保留原有索引写入顺序。provider 等待放在
对应请求边界,允许 close 和本地设置结束正在等待的 prompt/resume。新增16项交互回归。

验证:Ubuntu 全套1638通过/37跳过;Windows定向170通过/3平台跳过;两平台真实原生
各10/10;六发行目标编译和六项 POSIX 编译产物测试通过。Windows恢复/索引套件114通过、
5失败,未改动当前主线复现完全相同的5项订阅通知失败;未声称 Windows全套通过。

测试使用隔离目录与本地假模型,没有真实账号/模型调用或全局安装。取消不是全队列原子
暂停,不承诺外部写入隔离或 exactly-once;宿主 UI 接入及托管 CI 状态不在本地验证结论内。

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