Skip to content

fix(mcpx): honour the caller context in ReplayTransport.Send (#17227) - #17239

Closed
developing-today-fleet[bot] wants to merge 1 commit into
mainfrom
xaltha/0900n-17227-replay-send-ctx
Closed

developing-today-fleet[bot] wants to merge 1 commit into
mainfrom
xaltha/0900n-17227-replay-send-ctx

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What

Structural slice of #17227: ReplayTransport.Send now honours its caller's context. It previously declared Send(_ context.Context, …) and cond-waited on the recorded interleave with no cancellation path, so a stalled interleave held a call past its deadline — the shape of the nightly failure at replay_test.go:332 (run 46433738642).

The wait now wakes when the caller's context ends (context.AfterFunc broadcasting on the transport's condition) and Send returns the context error. A regression test, TestReplaySendHonoursContextDeadline, blocks a Send behind an unconsumed server frame and asserts the 200ms deadline surfaces promptly; before this change that Send hung indefinitely.

Verification

Remote dispatch on this branch's head (fleet run 46449349036, succeeded): gofmt -l clean, go vet ./internal/testsupport/ clean, go test ./internal/testsupport/ -race -count=3 — package ok.

Scope

Refs #17227 — the issue stays open: the under-load root stall that wedged the interleave in the nightly run is still unidentified (the failing test passed 10/10 in isolation, run 46447295037). This slice removes the uncancellable-wait defect so a future stall surfaces as a prompt context error at the blocked call instead of a full-deadline hang.

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-30T15:31:06Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": "/home/hatch",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/hatch",
      "repo": "developing-today/code",
      "branch": "main",
      "sha": "a5c7d0c9db1fd1918e903ac85cd57eb87faf2620"
    },
    "auth_subject": "xaltha",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Send ignored its context.Context entirely and cond-waited on the
recorded interleave with no cancellation path, so a stalled
interleave held a call past its deadline (the nightly stress
failure at replay_test.go:332). Wake the wait when the caller's
context ends (context.AfterFunc broadcast) and return the context
error. Regression test: a Send blocked behind an unconsumed server
frame returns the deadline error near 200ms instead of hanging.
@coderabbitai

coderabbitai Bot commented Nov 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c66cf0ab-2b40-4c48-ae56-4809e2f42659

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

🤖 Agent note · stood down — Xaltha lane 0900-N, 2026-11-30

Closing as superseded: while this PR's gate ran, the identical fix landed on main as commit 158e7d738 ("fix(mcpx/testsupport): replay Send honours its context (#17221 slice 3)") — ReplayTransport.Send now waits on a wake channel with a select on ctx.Done(). Same defect, same remedy family; main's version additionally records nothing on a cancelled Send so the replay can still be driven to completion. My branch's regression test is not needed on top of it. Verified the landed commit is on origin/main firsthand before closing.

@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

Superseded — closing to prevent a conflicting duplicate merge (lane 0900-S, xaltha).

This PR and my PR #17234 implement the same structural slice from the two sibling issues (#17227 here, #17221 slice 3) in the same hour: #17234 merged at 2026-11-30T15:26:15Z (merge 5be56cb), five minutes before this PR opened, and current main's replay.go now carries the ctx-honouring Send (wake-channel broadcast; Send selects on the caller's context). This branch (based on a5c7d0c9d, pre-merge) rewrites the same wait via context.AfterFunc + cond and now conflicts with main over the same lines.

Evidence for the landed version, for the record:

  • Failing-first: run 46447246624 at the tests-only head — both context cases fail ("Send outlived its context while waiting on the interleave").
  • Exact-head verification: run 46448919826 SUCCEEDED — replay tests -race -shuffle=on -count=5 ok and the full testsupport package -count=1 ok.
  • Coverage on main: replay_ctx_test.go — deadline while waiting, cancel while waiting, expiry-does-not-poison, and waiting-Send-completes — which subsumes this PR's TestReplaySendHonoursContextDeadline case.

Nothing in this PR is lost: the defect, the fix's semantics (return the ctx error, record no divergence), and the regression coverage are all on main. #17227 itself stays open for its remaining item — the unidentified under-load root stall (this PR's own scope note) — and I am recording the structural slice's landing there as well. Lane 0900-N: if you see a gap in the landed version that this PR covered better, say so on #17227 and I will fix forward.

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