Repository navigation
feat(pm-stack): pm-dispatch — launch/track OpenCode sessions from GitHub Actions - #2650
Conversation
…Hub Actions New pm-stack service (port 4879, loopback + tailnet) mirroring the aggregator pattern: Bun + TypeScript, install.sh + user systemd unit. - POST /v1/sessions: creates the tracking issue, enqueues a repo-task/v1 queue task, launches an OpenCode session on the laptop server with the prompt, and PATCHes the task to claimed immediately (worker dispatch-opencode, session id in progress). wait=false answers 202 after the enqueue and finishes the launch async. - POST /v1/tasks: enqueue-only, optional issue, caller-supplied or canonical/dispatch dedupe keys. - Auth: GitHub Actions OIDC (RS256 vs GitHub JWKS, aud pm-dispatch, repository claim must equal the request repo) or a constant-time static bearer secret. Caller identity recorded in the task payload. - Issue creation via the pm-stack GitHub App (code/opencode/ openchamber), gh CLI fallback; dezren39/nix skipped with a warning (app not installed there). 28 bun tests (auth incl. stubbed-JWKS OIDC + repo binding, priority mapping, model parsing, validation, packets); issue-backed packets validate clean under repo-queue.py; the no-issue dispatch packet shape was probe-verified against the enqueue RPC. Fixes #2648
|
Warning Review limit reachedYou'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 53 minutes. View limit details
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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
What
New pm-stack service pm-dispatch (
pm-stack/dispatch/), per Drew's 2026-10-30 request: an authenticated HTTP service on the laptop that ferries prompts to the laptop's OpenCode server and/or into the Supabase repo-health queues — always tracked, never fire-and-forget.POST /v1/sessions— launch now. Creates the tracking GitHub issue (default on), enqueues a repo-task/v1 queue task, creates an OpenCode session on the standing laptop server (127.0.0.1:13420) in the repo's primary directory with the requested model, sends the prompt (prefixed with the task/issue/repo ids), and marks the task claimed immediately (worker_id: dispatch-opencode, session id inprogress) so no queue worker double-books it.wait:falseanswers202after the enqueue and finishes the launch asynchronously; a failed launch cancels the task and notes the issue.POST /v1/tasks— enqueue only. Same packet machinery (kind, priority incl. name mapping, model hint, optional issue, canonical or caller-supplied dedupe keys) without launching a session.GET /health— unauthenticated{ok, version}, aggregator-style.Auth
aud: pm-dispatch; the token'srepositoryclaim must be allowlisted and equal the request body's repo — a workflow can only dispatch for its own repo.DISPATCH_API_TOKEN), constant-time compared — the shape a repo stores as an Actions secret.Caller identity is recorded in every task payload.
examples/dispatch-workflow.ymlshows both styles (marked as an example; not installed anywhere).Tracking / queue notes
repo-queue.py: issue-backed packets validate clean underrepo-queue.py validate; enqueue uses the same RPC selection it does (enqueue_repo_taskfor code,enqueue_repo_task_fleetfor the fleet).claim_repo_taskclaims the next task in a queue, not a specific one. Rationale documented in the README.ghCLI as fallback. dezren39/nix is not app-installed: issue creation is skipped there with awarningsentry; the task is the tracking record.…:triage:<repo>:dispatch:<rand8>) was probe-verified against the live enqueue RPC (created + cancelled a probe task).Deploy
Aggregator pattern:
install.shcopies to~/pm-stack/dispatch, renders.envfrom~/secrets/pm-stack.sops.yaml(GitHub App keys by name), ensures~/secrets/dispatch.env(mode 600:SUPABASE_SERVICE_ROLE_KEY, generatedDISPATCH_API_TOKEN), installspm-stack/systemd/pm-dispatch.service, restarts only on change, and fails unless/healthreports the deployed commit. Port 4879, loopback + tailnet only.Remaining (Drew's step, documented in the README): add
dispatch.security.cab → http://localhost:4879to the remotely-managed Cloudflare tunnelamd-6-pm-stackso GitHub Actions runners can reach it. Until then, tailnet callers can use it with either auth form.Tests
28 bun tests pass on the laptop (auth incl. stubbed-JWKS OIDC signing + repo-binding, priority mapping, model parsing, request validation, packet building);
tsc --noEmitclean. Post-merge: deploy + live smoke tests (tasks enqueue, session launch with issue, 401 negative).Fixes #2648
Need help on this PR? Tag
@codesmith-botwith what you need.