Skip to content

mcpx: Phase 2 of #1414 — resumed-session expiry fallback (404/401) and record hygiene #1416

Closed

Description

@dezren39

Phase 2 of design #1414 (cold-restart upstream HTTP session resume). Depends on Phase 1 (persist + resume). Design doc: files/designs/code-mcpx-cold-restart-session-resume.md in the keep-the-four-repos-healthy goal workspace.

Scope

Make a resumed session that turns out to be dead indistinguishable from a fresh start, and keep the persisted records honest as config changes:

  • Expiry fallback: if the first request sent on a resumed session is answered 404 (upstream forgot the session — the streamable HTTP spec's session-expiry signal; mcpx already treats a 404 DELETE as "already forgotten" in closeSession, internal/mcpclient/http.go), the client drops the persisted record, performs a fresh initialize, and retries the call once, transparently to the caller. A second failure surfaces exactly as failures surface today.
  • Credential rotation: the same drop-and-reinitialise-once path on 401/403 to the first request of a resumed session (headers are re-derived from live config at restore, so a refusal means the session/credential pairing is stale, not that the new credentials are wrong — one fresh initialize with the current credentials is the correct test).
  • Only the first request of a resumed session gets this treatment; a 404 mid-session keeps today's behaviour.
  • Record hygiene on config change: when a server leaves the config, its persisted record is deleted at reload. A best-effort upstream DELETE is attempted with a transient transport built from the last live config when one is still available (the TerminateHTTPSession shape, headers re-derived — never from the record, which holds none); when no live config remains, the removal is logged as left-to-expire — the mcpx: takeover orphans a removed server's upstream HTTP session — never DELETEd, left to expire upstream #260 degradation, made explicit instead of silent.
  • Coordinate with the roadmap's "Legacy client robustness" row (planning/roadmaps/mcpx.md; nix#200, nix#201, nix#203): this issue is only the resumed-session slice of session-404 handling, not a second general 404 project. If triage finds the general fix landing elsewhere, narrow this issue to wiring the persisted-record drop into it.

Out of scope (Phase 3 of #1414, undecided): graceful-shutdown DELETE semantics, record TTL, dashboard resumed-vs-fresh visibility.

Acceptance

  • Test: upstream that forgets sessions on demand → a call on a resumed-but-forgotten session succeeds; exactly one extra initialize observed upstream; caller sees no error.
  • Test: resumed session answered 401 on first request → one fresh initialize with current credentials → call succeeds (or surfaces the second refusal unchanged).
  • Test: a 404 on a non-first request of a resumed session is NOT retried (today's behaviour preserved).
  • Test: server removed from config → its record is gone after reload; DELETE attempted when a live config was available; left-to-expire logged when not.
  • Full suite passes: cd pkgs/mcpx && go test ./....

agent-note:v1 — filed by the repo design architect (dedicated code job, pass 2, 2026-10-27) as a sub-issue of design #1414; depends on Phase 1. Filed as task/triage: triage confirms scope against current main (and against the state of the legacy-client-robustness work) and enqueues the implementation packet; do not implement in the triage task.

Activity

  1. added
    kind/featureNew feature or capability request
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Oct 27, 2026
  2. developing-today commented on Oct 27, 2026

    @developing-today
    Contributor
  3. added
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued task in the Supabase agent queue
    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)
    effort/mMedium: expected under 1 day of work
    on Oct 27, 2026
  4. added
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Oct 27, 2026
  5. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    Intake review

    Fleet-monitor intake pass (2026-10-27). Phase 2 of design #1414; depends on Phase 1 (#1415). Related: #1415, #1414, and the legacy-client-robustness roadmap row (nix#200, nix#201, nix#203) — the issue itself flags the coordination risk of becoming a second general 404 project. The body already carries a full ## Acceptance section, so no body edit; labels were already normalized — I added only meta/enriched.

    Notes / risks: the first-request-only boundary is the load-bearing detail (a mid-session 404 must keep today's behavior), and the 401/403 path must re-derive headers from live config, never from the persisted record. Suggested approach: triage should first confirm whether the general session-404 work landed elsewhere, and narrow this issue to the persisted-record drop if so, exactly as the issue instructs.

  6. dezren39 commented on Oct 27, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  7. 316 remaining items

  8. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked\n- Agent: queue worker (repo-worker-code), OpenChamber scheduled lane 8ac61616-3815-4e7b-b33d-840a3829154a\n- Session / ID: queue task 1484\n- Task: Fixed the Codex P2 reload-cleanup race in cc0df5c, pushed to PR #5658, and resolved the review thread. Repeated regression and affected package tests pass. PR remains OPEN; CodeRabbit completed as SKIPPING/NEUTRAL, and no policy-required PR-tier CI checks ran because the mcpx test/fix-test-guard/conformance workflow triggers are workflow_dispatch-only.\n- Expectation: parked 20 minutes; resume by verifying PR-tier checks actually run and are green on cc0df5c, then merge only if all standing criteria pass.\n- Links: #1416 · https://github.com/developing-today/code/pull/5658\n

  9. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 4, 2026
  10. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: picked_up
    task: 1484
    worker: repo-worker-code
    lane: 335a5d1f-bfc1-4831-99ea-850c8939a727
    execution_lane: openchamber-scheduled-lane
    found_via: queue claim
    verified: issue #1416 OPEN with status/parked removed for this claim and no hard-stop labels; PR #5658 OPEN at cc0df5c; dependency #1415 CLOSED and Phase 1 PR #5455 MERGED. PR currently shows only CodeRabbit NEUTRAL, no required PR-tier checks.
    next: inspect fresh check/workflow state and resume evidence; do not merge without required checks green.

  11. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 4, 2026
  12. dezren39 commented on Nov 4, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: parked
    task: 1484
    worker: repo-worker-code
    lane: 335a5d1f-bfc1-4831-99ea-850c8939a727
    parked_until: 2026-11-04T23:02:23Z
    reason: PR #5658 remains OPEN at cc0df5c. Fresh gh pr checks reports only CodeRabbit SKIPPING; no required basic PR-tier checks ran. The policy-required mcpx test, fix-test-guard and conformance workflows are currently workflow_dispatch-only. No merge without required green PR checks.
    resume: re-check #5658 and its current head/checks fresh after the park delay; merge only once policy-required checks pass. Worktree /home/user/git/fleet/task-1484 and branch queue/1484-1416-mcpx-resumed-expiry-fallback are preserved; worktree was clean. Existing checkpoint records passing targeted tests; no new code changes this run.
    labels: queue/parked + status/parked; work/assigned retained.
    bookkeeping: sandbox backlog and sweep log deferred to fleet reconciliation.

  13. added a commit that references this issue on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)effort/mMedium: expected under 1 day of workkind/featureNew feature or capability requestmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)queue/parkedQueue task is parked (waiting on CI, time, or an event)source/design-architectFiled by the repo design architect jobstatus/parkedDeliberately paused with a recorded resume conditionstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted testswork/assignedQueue worker lifecycle state

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions