Skip to content

Codex Desktop list_threads needs project-scoped cursor pagination for safe automations #39849

Open

Description

@TharpTravis

Environment

  • ChatGPT/Codex Desktop: 26.818.21641 (build 6849)
  • macOS 26.6.2 (build 25G83)
  • Process architecture: x86_64
  • Naturally scheduled local automation
  • Observed: 2026-08-20

Private project IDs, conversation IDs, account details, and local paths are intentionally omitted.

Summary

The app-facing list_threads tool cannot support correctness-sensitive project reconciliation because its surfaced schema exposes only a fixed result limit:

declare const tools: {
  codex_app__list_threads(args: {
    limit?: number;
  }): Promise<unknown>;
};

It has no exact-project filter, page cursor, terminal completeness signal, or durable incremental checkpoint.

This is independently blocked by the scheduled-run hang in #35030, but even after that hang is fixed, a successful fixed-limit response cannot establish that all conversations in one ChatGPT Project were enumerated.

Reproduction

  1. Create a naturally scheduled automation that needs to inspect conversations belonging to one ChatGPT Project.
  2. Inspect the exposed list_threads schema. Only limit is available.
  3. Attempt a bounded call. In the latest run, list_threads({limit: 50}) remained pending through four bounded waits and had to be terminated.
  4. Reduce the limit or run interactively. A returned recent-task window still cannot be paged, filtered server-side to the exact project, or proven complete.
  5. Try to resume later from a durable cursor. No cursor or changed-since checkpoint is exposed.

Expected behavior

Provide a bounded, project-scoped enumeration contract suitable for scheduled automation. One possible shape is:

list_threads({
  projectId?: string,
  limit?: number,
  cursor?: string,
  changedSinceCursor?: string
}) => {
  threads: ThreadSummary[],
  nextCursor?: string,
  complete: boolean,
  checkpointCursor?: string
}

Required semantics:

  • Prefer server-side filtering by exact ChatGPT Project ID.
  • Support small bounded pages with an opaque continuation cursor.
  • Return an explicit terminal/completeness indicator.
  • Preserve stable conversation IDs, exact project ID, kind, and update timestamp.
  • After a complete bootstrap, expose a durable cursor/checkpoint that returns only new or changed conversations.
  • On timeout or partial failure, return a structured error without implying an empty or complete result.

Names are illustrative; equivalent semantics would solve the problem.

Actual behavior

Impact

A safety-conscious automation must fail closed:

  • It cannot infer “no new conversations” from a timeout or partial recent window.
  • It cannot advance a source checkpoint.
  • It cannot claim source parity or completeness.
  • It must remain paused even when repository identity and read/write capability are independently verified.

This blocks reliable, low-noise scheduled reconciliation of ChatGPT Project conversations without resorting to unsupported local database access or UI scraping.

Related issues

Activity

  1. added
    enhancement
    app
    app-server
    on Aug 21, 2026
  2. FaxanFM commented on Aug 30, 2026

    @FaxanFM

    +1 — this contract gap is currently a hard release blocker for a published Codex plugin, and I want to add a concrete second use case plus a note on how small the code change appears to be.

    Use case

    I maintain Chronos, an open-source supervision plugin for Codex. Its Governor is one host-managed recurring task that reconciles the liveness of every local Codex task: it must account for itself exactly once, close tasks that no longer exist, and prove topology convergence before it enables its own recurrence. All of that depends on one primitive the host does not currently provide: a provably complete enumeration of local tasks.

    The current in-conversation list_threads tool cannot supply it:

    • Results are capped at 50 (MAX_LIST_LIMIT), default 10.
    • A cursor argument is explicitly rejected: "list_threads does not accept a cursor". Only list_archived_threads accepts one.
    • The non-archived response shape is {schemaVersion, untrustedDataNotice, pinnedThreads, threads, unavailableHosts, unavailableSources} — no nextCursor, no complete flag, no total count, no snapshot identity.
    • No server-side filters are exposed (search_term, cwd, project_id, and source_kinds are fixed by the wrapper), so the space cannot be partitioned into provably covered sub-queries either.

    A response of fewer than limit items still proves nothing, because there is no documented completeness semantic to rely on. Repeated calls return the same recency window. Lifecycle hooks cannot close the gap — they are optional hints and cannot establish absence.

    Consequence

    Because no sequence of list_threads calls can distinguish "these are all the tasks" from "these are the 50 most recently updated tasks," a safety-conscious automation has to fail closed. Chronos v0.9.2 now detects this contract and returns an explicit capability blocker (host_inventory_completeness_unsupported), refuses to claim a Governor, refuses partial reconciliation, and leaves zero recurrences. The supervision feature is therefore fully disabled on current Codex hosts — not because enumeration is expensive, but because completeness cannot be proven. Observed on Windows 11; the same wrapper code applies on all platforms.

    We deliberately rejected the available workarounds as non-authoritative:

    • Reading CODEX_HOME (sessions / state database) directly — internal, unversioned schema.
    • Partial-window polling, hook observation, or manual task registration — none can prove absence.

    The fix appears to be very shallow

    Looking at codex-rs/tui/src/dynamic_tools.rs on current main, the plumbing already exists end to end:

    • The wrapper already forwards arguments.cursor into ThreadListParams { cursor: arguments.cursor.clone(), ... } for both tools; only an explicit guard blocks it for the non-archived case.
    • The backend thread/list path (thread store + app-server) fully supports anchor cursors (timestamp|thread_id) with terminal next_cursor: None semantics today, and list_archived_threads already exposes exactly this through the same wrapper.
    • The non-archived branch receives response.next_cursor and drops it when building the response JSON.

    So the minimal change is: remove the cursor-rejection guard for list_threads and include nextCursor in the non-archived response — mirroring what list_archived_threads already does.

    What automations need (minimal ask)

    1. cursor accepted on list_threads, with nextCursor returned and a documented guarantee that a null/absent nextCursor is terminal.
    2. Documented enumeration stability — e.g. CreatedAt-ascending anchor-cursor pagination, so items created before enumeration began cannot be skipped. A response-level complete: boolean or a stable snapshot ID would be even better, but terminal cursor semantics under a documented sort would already be sufficient.
    3. On timeout or partial failure, a structured error rather than a response that is indistinguishable from a complete empty result (relates to Scheduled Codex Desktop runs hang on list_threads while interactive calls succeed #35030).

    The complete/checkpointCursor shape proposed in the issue description would cover all of this and more; I'd happily take the two-line version first.

    Happy to run a Windows canary against a build with the expanded contract — Chronos already has a capability preflight (complete_flag / cursor_snapshot / total_count_snapshot) wired to detect and use exactly these semantics, so we can validate end to end quickly.

  3. TA-matrix-coder commented on Sep 2, 2026

    @TA-matrix-coder

    There is now a useful distinction between the upstream App Server capability and the installed Desktop wrapper surface.

    At upstream HEAD eb10d91e48ccbd0930427461fb392337addb1ac0, the experimental App Server thread/list path already supports projectId, and that filter is applied before cursor handling and LIMIT. This ordering is necessary, but it is not sufficient for a deterministic project-scoped observer when threads can be created concurrently.

    However, the installed Codex Desktop codex_app.list_threads surface inspected locally exposes only limit. In a bounded observation, list_threads(limit=50) omitted an existing project task, while read_thread retrieved the same task when its ID was already known. Consequently, the current wrapper cannot discover and bind such a task deterministically within a project-scoped observation.

    Please expose enough of the App Server contract through the Desktop wrapper to make discovery deterministic:

    • projectId plus host identity, or an equivalently canonical cwd scope;
    • cursor and an explicit completeness/exhaustion signal;
    • a server snapshot/as-of watermark, or a cursor bound to an immutable snapshot, so concurrent project creation cannot introduce skips or duplicates while a result set is enumerated;
    • sourceKinds;
    • sort key/direction, including createdAt ordering;
    • returned createdAt;
    • useStateDbOnly where supported.

    title/searchTerm is useful only as a confirmation predicate, not as the primary identity or completeness mechanism, because title hydration may occur after initial allocation.

    A focused regression test would interleave threads from two projects, request the target project with limit=1, create additional target-project threads while walking the result set, and prove against one declared snapshot/as-of watermark that: (a) no other-project thread is returned, (b) every target-project thread in that snapshot is returned exactly once, without skips or duplicates, (c) createdAt ordering is stable, and (d) the terminal response explicitly proves exhaustion of that snapshot. The same test should run through the Desktop wrapper, not only against the raw App Server method.

  4. KaliGi commented on Sep 7, 2026

    @KaliGi

    Additional interactive macOS reproduction on 2026-09-07:

    • codex_app__list_threads({limit: 200}) is rejected with limit: Too big: expected number to be <=50.
    • The exposed operation still has no cursor, terminal completeness flag, or exact-title lookup.
    • A 50-result page contained two idle tasks with the same exact display title. This makes the identity problem concrete: seeing one apparently suitable recipient is not evidence of uniqueness, and a correctness-sensitive sender must leave the message unsent.

    For cross-task messaging, either cursor pagination with explicit terminal completeness or an exact-title lookup returning every accessible match plus completeScope: true and unavailable-host/source state would solve the identity half. An atomic exact-title send/enqueue operation with the same fail-closed zero/duplicate/unavailable-scope semantics would also work. No thread IDs, task titles, account details, or local paths are included here.

  5. nexus-ai-2045 commented on Sep 23, 2026

    @nexus-ai-2045

    We reproduced this limitation during an interactive Codex Desktop session on Windows, outside a scheduled automation.

    Observed behavior

    • The sidebar showed 11 conversations under one local project, including the current conversation.
    • The agent-facing list_threads tool exposed only a limit argument (maximum 50), with no project filter or pagination cursor.
    • Several conversations visible in the project sidebar were absent from the returned global recent-thread list.
    • After the user supplied IDs for the 10 existing conversations, read_thread returned metadata for all 10.

    This is a discoverability gap: conversations accessible by ID cannot be reliably enumerated through the agent-facing project workflow. We are not reporting data loss.

    Expected behavior

    Please expose:

    1. Filtering by actual project membership, including associated worktree conversations.
    2. Cursor-based pagination.
    3. An explicit completeness signal so agents can distinguish a partial result from a complete project inventory.

    Increasing the fixed limit alone would not guarantee completeness.

    Related reports

    These reports appear related, but we have not established that they share the same underlying cause.

    This was observed while using Codex Desktop for project coordination at Nexus. Private conversation IDs, titles, paths, and screenshots are intentionally omitted.

    If the Desktop-facing list_threads implementation is available in this repository, we would be interested in contributing a focused PR for pagination and project-membership filtering. Could you point us to the relevant implementation or confirm whether external contributions are possible?

  6. mickitty0511 commented on Oct 26, 2026

    @mickitty0511

    Adding a Codex task-management use case to this request rather than opening a duplicate.

    Please allow the agent-facing list_threads tool to:

    1. Exclude ordinary Chat-mode conversations, retaining the selected non-Chat task/thread types, including Codex tasks, through an explicit type/source filter.
    2. Retrieve every unarchived matching thread, including older threads and pinned threads, across projects and projectless threads within the selected accessible scope.

    The result limit should apply after the type and archive filters, so unrelated recent chats cannot displace matching tasks. Cursor pagination with a documented completion signal is fine; raising a fixed recent-result limit does not guarantee full enumeration. Pinned threads should be included exactly once, and unavailable hosts/sources should be reported so a partial result cannot be mistaken for a complete inventory.

    The schema currently exposed to this Codex session still accepts only limit?: number. A useful acceptance case is a profile with ordinary chats, archived tasks, and more unarchived tasks than fit on one page: walking all pages must return every matching unarchived non-Chat task exactly once, with no ordinary chats or archived tasks.

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

    appapp-serverautomationsenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions