GeezerVison is showing github.com — fix(pm-dispatch): bound the gh subprocess, log launch legs, probe sessions at the server cap by dezren39 · Pull Request #13377 · developing-today/code
Conversation
dezren39
commented
Nov 23, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
What this lands
Lane PG's prepared scope for #6992 (root-cause record on the issue) plus the companion one-line defect #13149, adopted by Lane YJ under Drew's 2026-11-23 batch approval of the former flag holds. PG's worktree was verified pristine at the hold record's base SHA before any work — the scope was prepared, no code had been written under the hold.
#6992 — the 502 is pm-dispatch's own launch pipeline
PG's root cause (recorded on #6992, acceptance criterion 1): POST /v1/sessions with wait: true runs the whole launch synchronously, and the GitHub leg's gh-CLI fallback was an unbounded Bun.spawn — a gh call parked on API rate-limit retries held the handler open indefinitely, while pm-dispatch logged nothing per request, so the stall read as a tunnel outage for 19 days.
- Bound the gh subprocess (
src/github.ts): the fallback now kills the subprocess at GH_SUBPROCESS_TIMEOUT_MS — the same 15 s discipline the fetch routes carry (fix(dispatch): non-JWKS outbound fetches have no timeout — a hung Supabase/opencode/GitHub stalls the handler forever #10825) — and surfaces the timeout as a GitHubError. GitHubClient gains an optional ghBinary constructor seam (default "gh") so tests can point the fallback at a fake gh.
- Launch-path logging (
src/server.ts): a LaunchLog per request records per-leg elapsed-ms (issue / enqueue / worktree / session / claim / annotate for sessions; issue / verify / enqueue / annotate for tasks) and emits one completion line per request — method, path, status, total ms, leg split, task/session ids — for POST /v1/sessions and POST /v1/tasks, including the wait:false async launch outcome.
#13149 — session-list probe over the server cap
listSessions() probed with limit=1000/10000/100000, but the OpenCode server caps limit at 200 and rejects larger probes with HTTP 400 — so it threw on every call and the worktree cleanup sweep retained every dispatch worktree forever. SESSION_LIST_LIMITS is now [200]: a below-cap response is the completeness proof; an at-cap response still fails closed, naming the cap.
Verification
- Laptop run (the verifying route; remote dispatch was placed first — see below): full dispatch suite 264 pass / 2 fail,
bunx tsc --noEmit clean. The 2 failures are the pm-dispatch(github): GitHub API response bodies are shape-trusted — a token-less access-token reply is sent as Bearer undefined, a wrong-shape create reply is returned as a successful issue, and a null create body falls back to a duplicate gh create #7101 lookup tests timing out at 5000 ms against the real-gh fallback; they fail identically on pristine main (389be6a6e7bf, verified in a throwaway worktree) — the laptop's gh shim resolves slowly under load, unrelated to this change.
- New/changed coverage: opencode
listSessions tests rewritten to pin the single 200 probe and the at-cap throw against a stub that mirrors the server's cap (including its 400 shape); gh-fallback bound pinned with a fake gh (sleeper killed at the bound; echo control returns stdout); LaunchLog format pinned plus both handlers' 502 completion lines end-to-end.
- A first cut of the gh tests mutated
PATH, which Bun.spawn does not re-read — the timeout test passed for the wrong reason (real gh is slower than the bound). Caught on the control test, replaced with the ghBinary seam in the second commit; the re-run exercises the fake.
Remote dispatch: placed via fleet queue dispatch (Blacksmith surface). The first session (fp_19ed744f2ff751b6bc6fea2c33d43d3e, at the first commit) had not registered a run when last read; a second dispatch at the final head covers the four touched test files plus typecheck.
Issue disposition
{
"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-23T14:27:58Z",
"session_id": null,
"lane": null,
"host": "htch-runtime",
"worktree": null,
"model": null,
"lane_start_issues": [],
"workspace_ref": null,
"auth_subject": "archer",
"stamped_by": "fleet 0.1.0 (native)"
}
}

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
chatgpt-codex-connector[bot] reacted with thumbs up emoji
…sions at the server cap
#6992: pm-dispatch answered 502 from its own launch pipeline while
logging nothing per request, so stalls read as tunnel outages. The gh
CLI fallback in github.ts was the one unbounded leg — a gh call parked
on API rate-limit retries held the handler open indefinitely. It now
kills the subprocess at the same 15 s bound the fetch routes carry
(#10825) and surfaces the timeout as a GitHubError. server.ts gains
per-leg launch logging (issue/enqueue/worktree/session/claim/annotate
elapsed-ms plus a completion line with method, path, status, total and
task/session ids) for POST /v1/sessions and POST /v1/tasks.
#13149: the session-list completeness probe asked for limit=1000+,
which the OpenCode server rejects (limit capped at 200), so
listSessions always threw and the worktree cleanup sweep retained
every dispatch worktree forever. Probe at the cap: [200]; a below-cap
response is complete, an at-cap response still fails closed.
Tests: opencode listSessions coverage rewritten to pin the 200 probe
and the at-cap throw against a stub mirroring the server cap; github
gh-fallback bound pinned with a fake gh on PATH; server LaunchLog
format and both handlers' 502 completion lines pinned.
…uctor seam
Bun.spawn does not re-read a mutated process.env.PATH, so the first
cut of the #6992 gh-bound tests silently exercised the real gh (the
timeout test passed only because the real shim is slower than the
150 ms bound). GitHubClient gains an optional ghBinary constructor
parameter (default "gh") used for the fallback spawn; the tests now
pass a fake gh script path directly — a sleeper for the timeout case,
an echo for the control — so both exercise the bound itself.
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 37 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
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:
c20bfcc6-252a-40a3-962c-5843d7cecdfe
Commits
-
Reviewing files that changed from the base of the PR and between 3721eef and 011db99.
Files selected for processing: 6
-
pm-stack/dispatch/src/github.ts
pm-stack/dispatch/src/opencode.ts
pm-stack/dispatch/src/server.ts
pm-stack/dispatch/test/github.test.ts
pm-stack/dispatch/test/opencode.test.ts
pm-stack/dispatch/test/server.test.ts
- 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
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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-23T14:29:51.574162Z |
011db99 |
PR opened |
ℹ️ 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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 23, 2026
This was referenced Nov 27, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|