Skip to content

feat(mcp): add bounded paginated session discovery - #396

Merged
abruption merged 3 commits into
mainfrom
feat/393-bounded-mcp-list
Nov 15, 2026
Merged

abruption merged 3 commits into
mainfrom
feat/393-bounded-mcp-list

Conversation

@abruption

@abruption abruption commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Large session inventories can overwhelm MCP tool results. Add list_sessions_page for one explicit, operator-approved destination and agent, while preserving the six existing tools and ordinary CLI discovery.

  • Bound collection, concurrent admission, snapshots/cursors, optional labels and encoded tool results. Reuse the existing owned-process cleanup. Authorized continuation renews a 30-second idle deadline within a fixed 10-minute snapshot lifetime; it never recollects after expiry, eviction, restart or policy change.
  • Validate original JSON arguments before SDK coercion, using the public SDK dispatch boundary. Reject unknown selectors and strict-type violations before collection; retain the existing list grant and independent host approvals.
  • Separate valid partial pages (ok=true, complete=false, isError=false) from sanitized refusals. Keep exact identities, including decimal Claude PID normalization, without claiming readiness, caller identity, target generation, consumption or ACK.
  • Package the optional helper in wheel/sdist and document the unreleased source candidate in English, Korean, Japanese and Simplified Chinese. Existing CLI local/multi-home/SSH/device discovery and available native tools remain separate paths.

Refs #393

Dependency integrated: support-fix PR #395 merged into main at 0fc38ee0f3af7e34d86316902008d927c6f9f76b. This Draft now targets main; that base was merged into the feature branch without rewriting history. The Claude permission fixture retains the exact merged main version, including the readable-mode000 probe and its control regression.

Type

  • feat
  • docs
  • test

Validation

Check Result
macOS arm64, Python 3.13.7, MCP 1.30.0 / 2.3.0 143 tests run per SDK: 141 passed, two skipped (existing external-volume secure-store positive case; actual-Windows-only refusal). Opposite-major clients ran. Final paged module after test-layout cleanup: 32 run, 31 passed, Windows-only skip per SDK.
KR Linux aarch64, Python 3.12.3, MCP 1.30.0 / 2.3.0 Exact final source: 143 MCP tests run per SDK, 142 passed, only the Windows-specific test skipped; normal-filesystem secure-store positive and opposite-major clients ran. Five #394 tests also passed per environment.
Documentation / packaging 95 documentation tests passed; generator and diff checks passed. Wheel/sdist built with the new helper and four exact-content tests passed. Candidate package installation into both isolated SDK environments and installed stdio/schema/refusal checks passed. These private candidate artifacts were not published or substituted for immutable assets.
Compatibility Six prescribed legacy responses were byte-compared against the actual main 8339657 server/standalone source, separately per SDK, in addition to the bare-SDK dispatch fixture. This does not claim all possible native outputs are byte-identical; #394 intentionally corrects the unreadable-record false-success case.
Actual discovery / route smoke The actual local CLI paged a nonempty selected-home Codex metadata inventory completely on both SDKs, with no IDs/titles retained in evidence. Actual authorized SSH used source-streamed CLI against an owned KR SQLite fixture on both branches; no private route fields were returned. No native agent/model was started or messaged.
Processing observation Synthetic 20,000-row post-collection projection measured 0.1517s (SDK 1) / 0.1568s (SDK 2) on this Mac. This is one observation, not a general timing limit.

Coverage includes strict raw JSON/unknown arguments, Unicode identity/labels, single-row and full-envelope byte boundaries, partial/empty/error/nonzero evidence, unknown nested fields, all cursor/filter/policy/expiry/restart/eviction cases, 28-page delayed continuation with absolute lifetime, admission/cancellation cleanup and source-shaped Claude/Codex/Antigravity data. Actual Windows end-to-end runtime remains untested locally; its refusal test is left for CI.

Independent review

Fresh non-interactive read-only CLI reviews ran in parallel per round, with Claude tools disabled/plan/no persistence and Antigravity plan+sandbox/medium/600s timeout. Requested models matched response metadata; every call returned a substantive successful result and input hashes stayed unchanged. No model fallback occurred. These were supplied-source reviews, not independent execution of our tests.

  • First technical round: Claude Code 2.1.325 / claude-opus-5-5 (216.979s), Antigravity 1.5.9 / gemini-4-argon-medium (44.845s); same 135,231-byte input SHA-256 461f6bbc93d9cd528fd5f4bb3e671f8c6ea97676fe6ff7c8dd0910acb06ab769. Input included the complete MCP adapter/helper/new tests/fixtures, supporting cleanup/discovery excerpts and English docs. Codex source-checked the differing findings: fixed TTL usability, optional invalid-label handling, single-row admission, schema limits and conservative unknown-evidence handling. The actual upstream unreadable-Claude-record reproduction became separate support issue fix(discovery): report unreadable Claude records as incomplete #394 and its Draft.
  • Follow-up technical round, including the exact fix(discovery): report unreadable Claude records as incomplete #394 adapter/generated/test changes: the same Claude model/CLI (226.331s) and Antigravity model/CLI (54.691s); same 161,293-byte input SHA-256 220ebee96deea60d519b34d6b0158dcabe62dd00a999fb268d1ba2a8be22dc04. Neither found a confirmed Draft blocker. Codex checked conditional findings: supported MCP deployment is the complete wheel/sdist/source checkout (plugin invokes the package entry point; standalone installer/self-update copies only the core CLI/skill), so an unsupported hand-copy of only the server module does not establish a supported-path regression. Post-processing timing, duplicate-ID semantics, the fix(discovery): report unreadable Claude records as incomplete #394 call graph and host-conditional native-tool wording were checked/documented.
  • Translation: Antigravity 1.5.9 / gemini-3.8-flash-medium, actual model confirmed, EN/KO/JA/ZH guide diffs. First packet 40,230 bytes / SHA-256 03663136fa55c082fb0ad32191a944c498b2e0cc79a1b39a183aaa3cb9c9ab68 (114.543s); updated packet 43,312 bytes / SHA-256 72befecdb3a1bfc10735c5b099a0e65c186efb86a774ac47bea44b423385947d (96.471s). Numeric, permission, platform and unpublished-status boundaries matched. Codex restored explicit inspection/requirement wording and source-checked suggested terminology; literal jargon and ungrounded claims were not adopted.

After these reviews, production code stayed unchanged. An actual-Windows-only no-platform-patch refusal regression was added (not run on Mac/Linux), and small final documentation clarifications cover synchronous post-processing, field-level omission, conditional native-tool availability and the translation instructions. These final test/copy refinements passed local checks but did not receive a third model review. The source reviews do not certify arbitrary native/remote environments or a machine-wide sandbox boundary.

Scope and remaining gates

This Draft prepares the optional MCP feature for review. The source keeps the v1.5.0 base version until separate release preparation; this source candidate is not the immutable published v1.5.0 package. No merge, release, deployment, global installation or host-permission change is included.

The new collection path is macOS/Linux only; Windows refuses before collection. Captured-byte and execution limits do not bound all upstream SQLite/filesystem work, escaped remote processes, RSS or OS scheduling; cleanup has its existing separate budget. TTL eviction is lazy, and cache accounting is serialized charge rather than a process-memory guarantee. Existing operator SSH configuration and CLI advisories can run; no new native version/model/send/wake probe is added. A snapshot does not reserve a route or later send.

Paired aggregation remains separately tracked in #367. Its isolated candidate reproduced sidecar recreation during a concurrent last-SQLite-owner close, so it is excluded from this change and the planned release scope. Its failing regression is preserved; the #393 source does not include that implementation.

Main synchronization — 2026-11-15

Merge commit 91fad6935cdcacb8b0c8f6113548bc981504a1ea resolves the add/add conflict in tests/adapters/test_claude_read_errors.py after #395 was squash-merged. The resolved file is byte-identical to main. MCP production files remain byte-identical to the preceding feature HEAD; the feature-only diff against main still has the same 18 files. Each supported SDK ran 38 relevant tests: 37 passed and the actual-Windows-only test was skipped on Mac. Generator and whitespace checks passed. Current-head hosted checks must complete again.

@abruption abruption added this to the MCP discovery hardening milestone Nov 15, 2026
@abruption abruption added enhancement New feature or request priority:P2 Planned reliability, acceptance or feature work; priority does not authorize implementation. labels Nov 15, 2026
@abruption abruption self-assigned this Nov 15, 2026
Base automatically changed from fix/394-claude-list-read-errors to main November 15, 2026 02:09
@abruption
abruption marked this pull request as ready for review November 15, 2026 04:35
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T04:37:03.952144Z 91fad69 Draft marked ready
🔒 Security Review ✅ Completed 2026-11-15T04:38:59.633166Z 91fad69 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@abruption
abruption merged commit 0c5bd42 into main Nov 15, 2026
57 checks passed
@abruption
abruption deleted the feat/393-bounded-mcp-list branch November 15, 2026 04:39
@abruption abruption mentioned this pull request Nov 15, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority:P2 Planned reliability, acceptance or feature work; priority does not authorize implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant