Repository navigation
Description
Problem
The current MCP list_sessions returns the legacy CLI result without a page cursor, caller-selected page size or a dedicated bounded projection. The 64 KiB guard used by the newer metadata tools deliberately does not cap successful legacy list/send results. Large inventories can therefore consume excessive tool-output/context space. Source baseline: main 8339657.
Proposed scope
Develop an additive bounded listing operation for one operator-approved destination, initially with explicitly selected agent scope. The API name and schema remain design candidates. Preserve existing list_sessions, send, policy defaults and successful legacy result contracts. Paired-device aggregation remains #367. This is a supplementary session-peer MCP operation, not a replacement of cross-agent, multi-home, SSH or paired-device discovery with codex_tui.list_threads. Selecting an already available native tool remains a separate client/skill decision. Do not discover private native endpoints or silently switch discovery routes.
Use a finite snapshot with opaque continuation cursors bound to the exact selected route/home, agent/filter choices, snapshot and effective policy revision. A page is discovery evidence; it does not reserve a target or grant send/host approval.
Acceptance criteria
- Authorize destination/agent/action before discovery, cache lookup or cursor processing; revalidate policy after collection and on continuation. Reject model-supplied hosts, homes, executable paths and unsupported selectors. Define preset and multi-agent behavior explicitly; omit unsupported combinations with typed refusal rather than silently changing routes.
- Enforce strict types on the wire, including Boolean filters and integer page size. Select and document finite page, input/output, row, execution/cleanup, per-destination/server concurrency, snapshot/count/cache and TTL budgets. Charge serialized tool-result bytes including duplicate text/structured representations, escaping and SDK metadata; distinguish this from an RSS guarantee and JSON-RPC transport overhead.
- Bound captured stdout/stderr and discovery work where the existing CLI permits it. Describe unbounded upstream filesystem/SQLite work accurately; transport-side limits alone do not bound that work. Specify admission and cancellation before spawning further children.
- Retain only an allowlisted projection. Preserve exact target identity and scope; truncate optional labels only with an explicit marker. Define duplicate-ID handling using actual discovery evidence. Never merge targets merely by title or UUID across routes/homes.
- Preserve partial results, nonzero collection exits, missing/malformed/truncated evidence and per-agent failures. Define
isErrorseparately from discovery completeness, and test that supported clients can continue partial pages. Missing evidence must not become an empty successful inventory. - Bound cache entries, rows and cursors; specify eviction and concurrent-reader behavior. Invalid, expired, evicted, scope-mismatched, policy-changed or restarted cursors fail without silently recollecting. A cursor establishes neither session generation nor caller identity.
- Sanitize spawn, I/O, parsing, cleanup and timeout failures before SDK error formatting; never reflect argv, private paths or native errors. Ensure reader/FD/child cleanup still runs when signaling or reaping fails. Reuse reviewed process cleanup rather than shipping the experimental collector unchanged; document escaped/uninterruptible process limits.
- Add real stdio tests for both supported SDK branches, local/SSH routing, partial failures, exact byte boundaries, strict types, authorization order, policy mutation, concurrency, cancellation and legacy compatibility. Establish platform support explicitly before advertising it. Keep generation/storage/ACK gates in fix(identity): pin list-to-send targets to a session generation and fail closed when stale #180/investigate(codex): align selected home inspection with native SQLite storage configuration #268/feat(handoff): expose explicit ACK, deadline, and unknown outcome for unanswered requests #181 separate.
- Update the existing four-language MCP/CLI guidance and companion skill coordination after the final contract is implemented and reviewed. Keep ordinary listing free of new version probes, model activation, send/wake or automatic retry.
Validation and design review (2026-11-14)
Private value-validation prototypes were exercised against the baseline, without modifying tracked runtime files:
- macOS arm64, Python 3.13.7, MCP 2.3.0: 20 listing tests passed, independently rerun by the parent. Actual MCP stdio recovered 1,000 synthetic IDs across 20 pages without duplicates, including unchanged legacy envelopes, Unicode/byte limits, cursor invalidation, partial evidence and owned synthetic-process timeout/cancellation.
- KR Linux aarch64, Python 3.12.3: the same 20 listing tests passed with MCP 1.30.0 and 2.3.0. The SDK 1 harness initially used SDK 2 Python attributes; reading canonical JSON aliases fixed the harness without changing runtime/wire expectations. Dedicated temporary-path mapping and corrections to the transplant runner's quoting/import setup were also required. Existing policy/metadata baseline tests: 16 passed on Mac and 16 per Linux SDK branch.
- Three adversarial probes reproduced outstanding prototype gaps: concurrent collection admission is absent, collection exceptions can escape unsanitized, and a lax Boolean wire filter coerces strings. These passing counterexample tests confirm gaps; they are not fixes or production acceptance.
Claude Code 2.1.325 / claude-opus-5-5 and Antigravity CLI 1.5.9 / gemini-4-argon-medium (medium) independently reviewed the same frozen 91,430-byte packet, SHA-256 c50725c6f96b16874694d740a79a80792d687eb077f78b215ca6816bd14ef8a4. Both completed successfully with actual models confirmed (142.904s / 107.111s). They supported a listing-development issue while identifying the acceptance gates above. The Linux follow-up and test-harness adaptations occurred after that review and are recorded separately. A focused follow-up reviewed the final triage drafts, positive startup-path source excerpts and Linux evidence (input SHA-256 bf52afa15c1cf7da87b72a80defd8787c4e7e20416c57be63728f9c5753226d5; Claude 64.277s / Argon 67.307s, both successful with requested models confirmed). Codex incorporated the evidence-boundary corrections and the owner's subsequent clarification that native tools supplement existing discovery.
These are real protocol/process tests with synthetic discovery providers. No actual native session discovery, SSH agent routing, message delivery, model turn, receipt/ACK, Windows qualification, secure ledger integration or service change was performed. The private prototype is not proposed for direct merge.
Codex TUI reference
The native tool is codex_tui.list_threads; list_sessions is session-peer's tool name. Release/source history places initial task-tool inclusion at Codex 0.150.0 (PR40308), with embedded App Server task-tools enabled later in 0.167.0 (PR58240). The reviewed 0.150–0.167 source paths are conditional on topology, namespace, managed MCP policy, cloud mode and protocol compatibility; newer installations require their own current tool-presence checks. This is source/tag evidence, not old-binary live qualification or a session-peer transport/support floor.
Planning
Priority P2; assignee abruption; milestone MCP discovery hardening. No release version or due date is committed. This issue tracks stable-feature development value and the remaining implementation gates; it does not mark the feature production-ready or authorize merge, release, installation or operations. Scoped handoff observation stays in #360 / Long-term.
Tracking: MCP-FEASIBILITY-20261114.
Activity
abruption commentedon Nov 15, 2026
Implementation checkpoint — 2026-11-15
Draft PR #396, head
38cc55a52f1aa975a1cca5e789c4af3fd865eac9, implements the additive bounded page API. It is stacked on support-fix PR #395 for #394; merge that correction first, then retarget #396 to main and require fresh current-head checks.Independent Claude Opus 5.5 / Gemini Argon technical reviews and Gemini Flash translation reviews completed before Draft creation. Source-checked fixes include renewable 30-second idle cursors with a 600-second absolute cap, invalid optional-label omission, single-row budget admission and conservative unknown evidence. Exact models, inputs/hashes, scope and post-review test/copy refinements are in the PR body.
Mac and KR Linux each ran 143 MCP tests per supported SDK branch (1.30.0 and 2.3.0); documented platform/filesystem skips are retained. Documentation: 95 tests, artifact contents: 4 tests, installed wheel/sdist stdio, actual local metadata paging and actual SSH against owned remote SQLite fixtures also passed. No native model turn or message was invoked. Hosted CI/Windows refusal and the eventual retargeted-main checks are still separate gates; this issue remains OPEN for Draft review and release acceptance. #367 is deferred by its reproduced state-preservation failure.
Tracking:
MCP-NEXT-RELEASE-DRAFTS-20261115.abruption commentedon Nov 20, 2026
Closed as completed for the bounded listing scope. PR #396 shipped
list_sessions_pagein v1.6.0. The MCP guide at the release tag records the shipped contract, and the v0.6.0 companion skill covers its use. The v1.6.0 release source was8a45803748baf371dd31bb33db5db68373cd45f5and includes the #396 merge. Paired-device aggregation remains in #367. Storage and generation guarantees and ACK observation remain in their respective issues.