Skip to content

[3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) - #3817

Merged
integry merged 10 commits into
3758-epic-runtime-abstraction-sc0from
3813/claude-opus-5-5-remote-runtimes-reach-pro-20261126-0040-t66
Nov 26, 2026
Merged

integry merged 10 commits into
3758-epic-runtime-abstraction-sc0from
3813/claude-opus-5-5-remote-runtimes-reach-pro-20261126-0040-t66

Conversation

@propr-dev

@propr-dev propr-dev Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

AI Implementation Summary

Closes #3813

Branch: 3813/claude-opus-5-5-remote-runtimes-reach-pro-20261126-0040-t66
Commits: ✅ Changes committed (c4bd958)


AI Processing Completed

Execution Details:

Summary:
I've implemented issue #3813: Sprites runs can now reach ProPR MCP through a per-run SSH reverse forward, so a self-hosted instance with no public URL no longer has its runs refused. The unit and real-sshd tests pass. The live acceptance on a real Sprite (a Claude issue run and an automation run, with task-log evidence) has not been done: this container has no Sprites token. I added a live test for it, described below.

How a run picks its MCP transport (agentRunMcpTransport.ts, new kind ssh-reverse-forward):

  1. PROPR_SPRITES_MCP_URL if set, or a public HTTPS PROPR_AGENT_MCP_URL / API_PUBLIC_URL, is used directly, as before.
  2. Otherwise the run uses the SSH reverse forward. The agent's MCP config points to http://127.0.0.1:39080/api/mcp, and the per-run grant token is still required.
  3. Otherwise the run is refused with what to set. That happens when PROPR_SPRITES_MCP_FORWARD=0 is set, or when PROPR_INTERNAL_API_URL isn't a plain http(s)://host:port[/path] URL.

Behaviour change: a non-public PROPR_AGENT_MCP_URL or API_PUBLIC_URL used to be refused on restricted Sprites (and used as given on open ones). Now such runs get the forward. I updated the two existing tests that expected the old behaviour. An explicit non-public PROPR_SPRITES_MCP_URL is still the operator's choice and is still refused on restricted runs.

The forward (new sprites/spritesMcpForward.ts, using the ssh2 library):

  • Keys: each run generates its own client key and sshd host key in memory. They are never logged or kept, and the worker checks the host key so it can't be fooled by another listener behind the proxy.
  • sshd: it listens on 127.0.0.1:39022 only and accepts just that key for a shell-less propr-mcp user. It allows only the one loopback listener: no passwords, sessions, TTYs or local forwarding. A new root-owned helper, scripts/sprites-mcp-forward.sh, starts and stops it.
  • Proxy and relay: the worker reaches sshd through sprite.proxyPort and relays each forwarded connection only to the internal API host and port. Responses are passed through as they arrive, so streaming and SSE work.
  • Lifecycle: the forward starts before the agent and is torn down on success, failure, cancel or timeout, and when reattaching fails. If it drops, the worker retries up to 5 times with backoff, then fails the run with an MCP_TRANSPORT_LOST error instead of letting tool calls hang.
  • Restricted network: the address is loopback, so a restricted Sprite's network policy gets no MCP host entry.
  • Task log: shows ProPR MCP transport: ssh-reverse-forward.

Provisioning: sprites-agent-setup.sh installs openssh-server if the image lacks it and stops the system sshd from starting. It creates the propr-mcp user and installs the helper, and the Dockerfile copies the new script.

Other changes:

  • Added [email protected] (and @types/ssh2) to packages/core, which changes package-lock.json.
  • Added the new transport value to the admission API, the CLI types, the generated client types and the OpenAPI spec.
  • Updated mcp.md, the Sprites runtime docs (new section "ProPR MCP from Sprites", which also says when a public URL is preferred), execution-safety.md and agent-run-admission.md.

Tests:

  • test/spritesMcpForward.test.ts (17 pass): transport selection, the refused cases, the sshd config, keys unique per run, an impostor host key refused, and JSON plus streamed SSE through the forward. It also covers a reconnect after a drop, a forward that can't reconnect, teardown on success, failure and cancel, and that the private key and grant token stay out of logs. It runs against an in-process SSH server standing in for the Sprite.
  • test/spritesMcpForwardOpenSsh.test.ts (2 pass): runs against a real OpenSSH 9.2 sshd. It checks that sshd is reachable on loopback only, that other keys, passwords, other listen addresses or ports, local forwarding and commands are all refused, and that a full forward works through a proxy, reconnects and tears down. It is skipped unless sshd is installed; point PROPR_TEST_SSHD at one to run it.
  • Live test: I added a case to test/spritesRuntime.live.test.ts that runs on a real Sprite with PROPR_SPRITES_LIVE_TOKEN and checks what sshd and the forward listen on plus a streamed call. It is a direct curl from the Sprite, not an agent tool call, so it doesn't replace the live Claude and automation runs the issue asks for.
  • The existing Sprites, Fly, transport, tool-policy, grant-client and admission/OpenAPI suites pass, as do typecheck and lint on the changed sources and gen:openapi:check.

There is nothing visual to preview.

Review digest

Risk-tiered paths

  • High risk (2 files)
    • package-lock.json (+100/−0): lockfile
    • packages/core/package.json (+2/−0): dependency manifest
  • Normal risk (19 files)
    • docker/Dockerfile.app.prod (+1/−1)
    • packages/api/openapi/schemasAdmission.ts (+1/−1)
    • packages/cli/src/api/admission.ts (+1/−1)
    • packages/client/src/generated/apiTypes.ts (+1/−1)
    • packages/core/src/agents/runtime/agentRunMcpTransport.ts (+32/−1)
    • packages/core/src/agents/runtime/agentRunSpec.ts (+5/−4)
    • packages/core/src/agents/runtime/registry.ts (+4/−1)
    • packages/core/src/agents/runtime/sprites/spritesMcpForward.ts (added, +281/−0)
    • packages/core/src/agents/runtime/sprites/spritesMcpForwardConfig.ts (added, +120/−0)
    • packages/core/src/agents/runtime/sprites/spritesNetwork.ts (+22/−9)
    • packages/core/src/agents/runtime/sprites/spritesProvisioning.ts (+1/−1)
    • packages/core/src/agents/runtime/spritesRuntime.ts (+46/−8)
    • packages/core/src/agents/runtime/types.ts (+11/−3)
    • packages/core/src/agents/types.ts (+6/−0)
    • packages/core/src/extensions/extensionLaunch.ts (+1/−1)
    • scripts/sprites-agent-setup.sh (+46/−0)
    • scripts/sprites-mcp-forward.sh (added, +63/−0)
    • src/jobs/agentRuns/mcpGrantClient.ts (+5/−1)
    • src/jobs/agentRuns/toolPolicy.ts (+5/−1)
  • Low risk (11 files)
    • docs/docs/architecture/agent-run-admission.md (+1/−1)
    • docs/docs/architecture/agent-runtime.md (+19/−1)
    • docs/docs/features/execution-safety.md (+2/−2)
    • docs/docs/features/mcp.md (+4/−0)
    • docs/static/openapi/propr-api.yaml (+1/−0)
    • test/agentRuntimeNetworkCapability.test.ts (+17/−2)
    • test/helpers/fakeSpriteSshd.ts (added, +142/−0)
    • test/spritesMcpForward.test.ts (added, +389/−0)
    • test/spritesMcpForwardOpenSsh.test.ts (added, +187/−0)
    • test/spritesNetworkPolicy.test.ts (+3/−1)
    • test/spritesRuntime.live.test.ts (+63/−0)

New dependencies (2): ssh2 in packages/core/package.json, @types/ssh2 in packages/core/package.json

Diff size: 32 files changed, +1,582/−41 lines

View task for the run's logs and conversation.


This PR was created automatically by ProPR after processing issue #3813.


💡 Need changes?

Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!

Live verification on Fly (real agent and automation)

Run https://github.com/integry/propr/actions/runs/45773807371 on 90bccf5, MCP=true: ✅

  • The control plane was deployed with propr deploy fly (which now generates SYSTEM_TASK_SECRET) and PROPR_SPRITES_MCP_TRANSPORT=forward, so MCP stays private even though the app has a public URL. No smoke-only workarounds: the repository list was seeded at startup from GITHUB_REPOS_TO_MONITOR.
  • Idle stop, then wake via the labeled issue (webhookRecovery.redelivered=1). The issue run on Sprites opened its PR.
  • A propr_mcp automation was created and started through the REST API, and finished completed.
  • Task log: ProPR MCP transport: ssh-reverse-forward (per-run SSH reverse forward through the Sprites proxy).
  • The report's first line is PROPR_MCP_REPOSITORIES: integry/propr-fly-fixture, backed by a successful list_repositories entry in the MCP access log, which the verify step checks.
  • Clean teardown: no apps, branches, PRs or issues left.

Product bugs found by the earlier live runs and fixed here:

  • propr deploy fly didn't generate SYSTEM_TASK_SECRET, so every automation failed on a Fly deploy;
  • the stored repository list wasn't seeded, so automation creation returned a 400.

Re-verified after my review fixes (R1–R7): https://github.com/integry/propr/actions/runs/45787085027 on 758d60c ✅. The automation completed, the task log shows ssh-reverse-forward, the report shows PROPR_MCP_REPOSITORIES: integry/propr-fly-fixture, and teardown was clean.

I've implemented issue #3813: Sprites runs can now reach ProPR MCP through a per-run SSH reverse forward, so a self-hosted instance with no public URL no longer has its runs refused. The unit and real-sshd tests pass. The live acceptance on a real Sprite (a Claude issue run and an automation run, with task-log evidence) has not been done: this container has no Sprites token. I added a live test for it, described below.

How a run picks its MCP transport (`agentRunMcpTransport.ts`, new kind `ssh-reverse-forward`):
1. `PROPR_SPRITES_MCP_URL` if set, or a public HTTPS `PROPR_AGENT_MCP_URL` / `API_PUBLIC_URL`, is used directly, as before.
2. Otherwise the run uses the SSH reverse forward. The agent's MCP config points to `http://127.0.0.1:39080/api/mcp`, and the per-run grant token is still required.
3. Otherwise the run is refused with what to set. That happens when `PROPR_SPRITES_MCP_FORWARD=0` is set, or when `PROPR_INTERNAL_API_URL` isn't a plain `http(s)://host:port[/path]` URL.

Behaviour change: a non-public `PROPR_AGENT_MCP_URL` or `API_PUBLIC_URL` used to be refused on restricted Sprites (and used as given on open ones). Now such runs get the forward. I updated the two existing tests that expected the old behaviour. An explicit non-public `PROPR_SPRITES_MCP_URL` is still the operator's choice and is still refused on restricted runs.

The forward (new `sprites/spritesMcpForward.ts`, using the `ssh2` library):
- Keys: each run generates its own client key and sshd host key in memory. They are never logged or kept, and the worker checks the host key so it can't be fooled by another listener behind the proxy.
- sshd: it listens on `127.0.0.1:39022` only and accepts just that key for a shell-less `propr-mcp` user. It allows only the one loopback listener: no passwords, sessions, TTYs or local forwarding. A new root-owned helper, `scripts/sprites-mcp-forward.sh`, starts and stops it.
- Proxy and relay: the worker reaches sshd through `sprite.proxyPort` and relays each forwarded connection only to the internal API host and port. Responses are passed through as they arrive, so streaming and SSE work.
- Lifecycle: the forward starts before the agent and is torn down on success, failure, cancel or timeout, and when reattaching fails. If it drops, the worker retries up to 5 times with backoff, then fails the run with an `MCP_TRANSPORT_LOST` error instead of letting tool calls hang.
- Restricted network: the address is loopback, so a restricted Sprite's network policy gets no MCP host entry.
- Task log: shows `ProPR MCP transport: ssh-reverse-forward`.

Provisioning: `sprites-agent-setup.sh` installs `openssh-server` if the image lacks it and stops the system sshd from starting. It creates the `propr-mcp` user and installs the helper, and the Dockerfile copies the new script.

Other changes:
- Added `[email protected]` (and `@types/ssh2`) to `packages/core`, which changes `package-lock.json`.
- Added the new transport value to the admission API, the CLI types, the generated client types and the OpenAPI spec.
- Updated `mcp.md`, the Sprites runtime docs (new section "ProPR MCP from Sprites", which also says when a public URL is preferred), `execution-safety.md` and `agent-run-admission.md`.

Tests:
- `test/spritesMcpForward.test.ts` (17 pass): transport selection, the refused cases, the sshd config, keys unique per run, an impostor host key refused, and JSON plus streamed SSE through the forward. It also covers a reconnect after a drop, a forward that can't reconnect, teardown on success, failure and cancel, and that the private key and grant token stay out of logs. It runs against an in-process SSH server standing in for the Sprite.
- `test/spritesMcpForwardOpenSsh.test.ts` (2 pass): runs against a real OpenSSH 9.2 sshd. It checks that sshd is reachable on loopback only, that other keys, passwords, other listen addresses or ports, local forwarding and commands are all refused, and that a full forward works through a proxy, reconnects and tears down. It is skipped unless sshd is installed; point `PROPR_TEST_SSHD` at one to run it.
- Live test: I added a case to `test/spritesRuntime.live.test.ts` that runs on a real Sprite with `PROPR_SPRITES_LIVE_TOKEN` and checks what sshd and the forward listen on plus a streamed call. It is a direct curl from the Sprite, not an agent tool call, so it doesn't replace the live Claude and automation runs the issue asks for.
- The existing Sprites, Fly, transport, tool-policy, grant-client and admission/OpenAPI suites pass, as do typecheck and lint on the changed sources and `gen:openapi:check`.

There is nothing visual to preview.

ProPR-Agent: claude/claude-opus-5-5

integry commented Nov 26, 2026

Copy link
Copy Markdown
Owner

/ultrafix goal=8 max=3

@propr-dev propr-dev Bot added the ultrafix label Nov 26, 2026
@propr-dev

propr-dev Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Ultrafix loop started (goal: 8/10, max cycles: 3)

First action: /review

💡 Tip: Remove the ultrafix label from this PR to stop further ultrafix cycles.

@propr-dev

propr-dev Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@integry

integry commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Live run of the forward test on a real Sprite: transport works ✅; fix the test's assertion

I ran test/spritesRuntime.live.test.ts (case "real Sprite reaches a worker-local ProPR API over the SSH reverse forward, streaming included") on c4bd958 against a real Sprite with a live token. Run time was 86 s, and the Sprite was deleted afterwards.

What passed live:

  • the transport plan was ssh-reverse-forward, with the URL http://127.0.0.1:39080/api/mcp;
  • inside the Sprite, sshd (0100007F:986E) and the forward (0100007F:98A8) listen only on loopback. The script runs under bash -e, so a non-loopback listener would have aborted it before curl;
  • curl -N with the grant token reached the worker-local API (bound to 127.0.0.1 on the worker host, not reachable from the internet), and the SSE stream came through intact: data: first, then data: second 500 ms later.

What failed: only the assertion assert.equal(result.stdout.trim(), 'data: first\n\ndata: second'). On a real Sprite, stdout starts with the agent entrypoint's preamble (Warning: GH_TOKEN environment variable not set, Executing command: …, and so on). Please assert on the tail instead, e.g. assert.match(result.stdout, /data: first\n\ndata: second\s*$/), and keep the other assertions as they are.

The remaining live acceptance is an agent tool call and an automation through a self-hosted instance. I'll run it once the review loop settles.

@propr-dev

propr-dev Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 36bf3bd

Summary of Changes

I changed the assertion as you asked. At test/spritesRuntime.live.test.ts:144 the exact-match check is now:

assert.match(result.stdout, /data: first\n\ndata: second\s*$/);

The exit-code, ssh-reverse-forward diagnostic and no-PRIVATE KEY assertions are unchanged.

I checked the new regex against a sample stdout with the entrypoint preamble (the GH_TOKEN warning and Executing command: …) followed by the two events, and it matches. It still fails if anything comes after data: second. The live case itself hasn't run again: it was skipped here because this container has no Sprites token. So the real-Sprite pass is still yours to confirm on your next run.

There's nothing visual to preview.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk: none
  • Low risk (1 file)
    • test/spritesRuntime.live.test.ts (+1/−1)

Diff size: 1 file changed, +1/−1 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 3m 28s
  • Tokens: 191,796 (191,069 in / 727 out)
  • Cost: $0.23
  • Subscription usage: Weekly +1%

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 7179559262✓

I changed the assertion as you asked. At `test/spritesRuntime.live.test.ts:144` the exact-match check is now:

```ts
assert.match(result.stdout, /data: first\n\ndata: second\s*$/);
```

The exit-code, `ssh-reverse-forward` diagnostic and no-`PRIVATE KEY` assertions are unchanged.

I checked the new regex against a sample stdout with the entrypoint preamble (the `GH_TOKEN` warning and `Executing command: …`) followed by the two events, and it matches. It still fails if anything comes after `data: second`. The live case itself hasn't run again: it was skipped here because this container has no Sprites token. So the real-Sprite pass is still yours to confirm on your next run.

There's nothing visual to preview.

PR: #3817
Comment by: @integry (ID: 7179559262)
Model: Claude Opus 5.5

ProPR-Agent: claude/claude-opus-5-5
@propr-dev

propr-dev Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The PR adds per-run SSH forwarding with consistent transport planning, grant propagation, and runtime integration. No merge-blocking defect is established by the supplied code, but live verification remains a material gap before calling this merge-ready. This review was static; no commands were run.

✅ Pinned SSH identity — Each forward generates separate client and host keys, and verifies the server’s exact public key before authenticating.

✅ Transport propagation — The new transport reaches grant issuance, tool policy, runtime specifications, capability checks, and admission schemas.

✅ Failure coverage — Added tests exercise streamed responses, reconnect exhaustion, cancellation, startup failure, and teardown.

The supplied current-head status reports 31 passed checks, three pending, and no failures.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S1: 🟢 Complete live agent verification

The supplied summary explicitly leaves real Claude and automation runs unverified. The new live test exercises curl against a stand-in API; the OpenSSH tests also substitute the current user for the provisioned propr-mcp account. Actual agent runs would validate provisioning, Sprites proxy behavior, MCP authentication, and task-log evidence together. This is a verification follow-up, not a demonstrated code defect.

S2: 🟢 Track pending upstream sockets

In packages/core/src/agents/runtime/sprites/spritesMcpForward.ts, relay() registers connections for cleanup only after the upstream connection succeeds. Closing the forward during a pending connection therefore leaves that socket waiting for connection completion or an operating-system error. Tracking sockets immediately and adding a connection deadline would improve cleanup under unreachable-target conditions. No resulting run-level failure is demonstrated here.

S3: 🟢 Reconcile transport documentation

The modified MCP networking paragraph in docs/docs/architecture/agent-run-admission.md introduces reverse forwarding but still concludes that absent public URL settings cause grant refusal. Qualify that sentence for runtimes without reverse forwarding so it agrees with the new Sprites behavior. This documentation cleanup does not affect execution.

Score

The implementation has substantial focused coverage and no verified blocker, but the missing real-agent acceptance evidence prevents an unconditional merge-ready assessment. Pending checks alone do not lower this rating.

Score: 7/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 56s
  • Tokens: 82,537 (81,250 in / 1,287 out)
  • Cost: $0.77

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S1 S2 S3

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Ultrafix stopped before reaching its goal. Requested goal: 8/10. Last score: 7/10. Stopped in cycle 1 of 3. The review has no actionable blockers, so no fix was scheduled. Manual review and merge are now required.

@propr-dev propr-dev Bot removed the ultrafix label Nov 26, 2026
@integry

integry commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Please fix S2 and S3, and add what the live agent acceptance (S1) needs

S2: track upstream sockets as soon as they're created, and give connections a deadline (e.g. 10 s), so closing the forward during a pending connection can't leave a socket behind. Add a test with an unreachable target.

S3: qualify the sentence in agent-run-admission.md: a missing public URL refuses the grant only on runtimes without reverse forwarding. Sprites use the forward.

For S1 (live real-agent acceptance), add two things I can run on Fly:

  1. A transport preference: PROPR_SPRITES_MCP_TRANSPORT=auto|forward (default auto = today's order). With forward, Sprites runs use the SSH reverse forward even when a public URL exists. This is also a real operator option: it keeps MCP off the public internet entirely. Document it, and test both values in selection.

  2. An MCP mode for the Fly smoke workflow: a workflow_dispatch input mcp (boolean, default false). When it's on:

    • deploy with PROPR_SPRITES_MCP_TRANSPORT=forward;
    • make the fixture issue require one ProPR MCP tool call from the agent, with a deterministic result written into the file (e.g. a tool that returns the issue's own number or title); pick a tool the agent grant actually exposes;
    • start one automation run that uses ProPR MCP, the simplest one that exercises it, through the API after the wake, and wait for it to succeed;
    • in the verify step, assert the file content, the automation's success, and the task-log line ProPR MCP transport: ssh-reverse-forward for both runs (via the API or flyctl logs).

    The nightly cron keeps mcp off unless a repo variable opts it in.

I'll run it with mcp on and post the evidence.

@propr-dev propr-dev Bot changed the title 🔨 [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) ⚠️❼ [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) Nov 26, 2026
@propr-dev

propr-dev Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 12edf29

Summary of Changes

I've fixed S2 and S3 and added the PROPR_SPRITES_MCP_TRANSPORT preference, plus an mcp mode for the Fly smoke workflow. One part of S1 can't work as you wrote it: plain issue-labeled runs never get ProPR MCP. Only automation (agent) runs do. The issue run starts its agent with no MCP tools (src/jobs/issueJob/agent.ts). So I left the fixture issue unchanged, and the transport line is checked for the automation run only. If you want both runs covered, giving issue runs ProPR MCP is a product change beyond this PR; the alternative is a second automation run.

The unit tests pass. Nothing ran live on Fly. The workflow passes actionlint and bash -n, and I tested its jq and report checks on sample data. The real-sshd suite (spritesMcpForwardOpenSsh.test.ts) was skipped because this container has no sshd; the in-process SSH tests cover the changed relay code.

S2 (pending upstream connections):

  • The upstream socket is now tracked as soon as it is created, so closing the forward destroys a connection that is still being set up.
  • A connection that doesn't complete in 10 s is refused; the agent gets an error instead of a hang.
  • Two new tests use a target that never answers: one hits the deadline, one closes the forward mid-connection. Both fail on the old code.

S3: the sentence in agent-run-admission.md now says a missing public URL refuses the grant only on runtimes without reverse forwarding. Sprites use the forward and are refused only when it is turned off or can't reach the internal API.

Transport preference:

  • auto (the default) keeps today's order.
  • forward uses the SSH reverse forward even when PROPR_SPRITES_MCP_URL, PROPR_AGENT_MCP_URL or API_PUBLIC_URL is set.
  • Under forward, runs are refused rather than falling back to a public URL if PROPR_SPRITES_MCP_FORWARD=0 is also set or PROPR_INTERNAL_API_URL is unusable.
  • Any other value refuses Sprites runs that need MCP, so a typo never quietly picks a public URL.
  • A new selection test covers both values, the conflicts and the typo case, and checks that Docker and Fly Machines ignore the setting.
  • It's documented in the Sprites runtime docs, mcp.md, execution-safety.md and .env.example.
  • The worker's log line for the forward now uses the exact task-log text, ProPR MCP transport: ssh-reverse-forward …, with the task id. That way flyctl logs can show it.

The mcp workflow input (off by default; the nightly run turns it on only if the repo variable FLY_E2E_NIGHTLY_MCP is true):

  • Deploy: sets PROPR_SPRITES_MCP_TRANSPORT=forward and PROPR_INTERNAL_API_URL=http://127.0.0.1:4000, enables MCP (MCP_ENABLED, origin, instance id, a fresh encryption key), and removes any of these from FLY_E2E_APP_ENV first.

  • Owner: the automation runs as the FLY_E2E_GITHUB_TOKEN user, so that user must be in PROPR_ADMIN_USERS; the step fails early if not. Automation runs only get MCP if their owner has signed in to ProPR, which a fresh instance lacks. So after the wake the workflow records that sign-in over SSH, using the token passed as a Fly secret, PROPR_E2E_MCP_OWNER_TOKEN, on the throwaway app.

  • Automation: created through the API as a report-only run with the propr_mcp capability. Its prompt asks the agent to call list_repositories once and start its report with PROPR_MCP_REPOSITORIES: <names>. The workflow then starts one run.

  • Verify (a separate step, up to 30 minutes):

    • the run ends completed.
    • the report line equals the fixture repository.
    • the MCP access log has a successful list_repositories call, so the answer wasn't guessed.
    • the worker log, captured from the wake onwards, has the transport line for the run's report task.

    The step summary records all three.

Unverified on Fly:

  • propr deploy fly doesn't set PROPR_INTERNAL_API_URL, and its default http://api:4000 probably doesn't resolve in the app container. That may already break agent-run grants on Fly. MCP mode sets it explicitly.
  • The ssh-reverse-forward transport is only proven by the worker log line, read via flyctl logs. The same line in the task's live log may be wiped when the agent's output stream starts, so I didn't rely on it.

Review digest

Risk-tiered paths

  • High risk (1 file)
    • .github/workflows/fly-e2e.yml (+138/−1): CI or workflow file
  • Normal risk (5 files)
    • .env.example (+2/−0)
    • packages/core/src/agents/runtime/agentRunMcpTransport.ts (+29/−8)
    • packages/core/src/agents/runtime/sprites/spritesMcpForward.ts (+39/−12)
    • packages/core/src/agents/runtime/sprites/spritesMcpForwardConfig.ts (+16/−0)
    • packages/core/src/agents/runtime/spritesRuntime.ts (+1/−1)
  • Low risk (5 files)
    • docs/docs/architecture/agent-run-admission.md (+1/−1)
    • docs/docs/architecture/agent-runtime.md (+9/−2)
    • docs/docs/features/execution-safety.md (+1/−1)
    • docs/docs/features/mcp.md (+1/−1)
    • test/spritesMcpForward.test.ts (+72/−3)

Diff size: 11 files changed, +309/−30 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 17m 40s
  • Tokens: 14,056,631 (14,055,229 in / 1,402 out)
  • Cost: $3.78

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 7179978906✓

@propr-dev propr-dev Bot changed the title ⚠️❼ [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) 🔨 [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) Nov 26, 2026
I've fixed S2 and S3 and added the `PROPR_SPRITES_MCP_TRANSPORT` preference, plus an `mcp` mode for the Fly smoke workflow. One part of S1 can't work as you wrote it: **plain issue-labeled runs never get ProPR MCP.** Only automation (agent) runs do. The issue run starts its agent with no MCP tools (`src/jobs/issueJob/agent.ts`). So I left the fixture issue unchanged, and the transport line is checked for the automation run only. If you want both runs covered, giving issue runs ProPR MCP is a product change beyond this PR; the alternative is a second automation run.

The unit tests pass. Nothing ran live on Fly. The workflow passes actionlint and `bash -n`, and I tested its jq and report checks on sample data. The real-sshd suite (`spritesMcpForwardOpenSsh.test.ts`) was skipped because this container has no sshd; the in-process SSH tests cover the changed relay code.

**S2 (pending upstream connections):**
- The upstream socket is now tracked as soon as it is created, so closing the forward destroys a connection that is still being set up.
- A connection that doesn't complete in 10 s is refused; the agent gets an error instead of a hang.
- Two new tests use a target that never answers: one hits the deadline, one closes the forward mid-connection. Both fail on the old code.

**S3:** the sentence in `agent-run-admission.md` now says a missing public URL refuses the grant only on runtimes without reverse forwarding. Sprites use the forward and are refused only when it is turned off or can't reach the internal API.

**Transport preference:**
- `auto` (the default) keeps today's order.
- `forward` uses the SSH reverse forward even when `PROPR_SPRITES_MCP_URL`, `PROPR_AGENT_MCP_URL` or `API_PUBLIC_URL` is set.
- Under `forward`, runs are refused rather than falling back to a public URL if `PROPR_SPRITES_MCP_FORWARD=0` is also set or `PROPR_INTERNAL_API_URL` is unusable.
- Any other value refuses Sprites runs that need MCP, so a typo never quietly picks a public URL.
- A new selection test covers both values, the conflicts and the typo case, and checks that Docker and Fly Machines ignore the setting.
- It's documented in the Sprites runtime docs, `mcp.md`, `execution-safety.md` and `.env.example`.
- The worker's log line for the forward now uses the exact task-log text, `ProPR MCP transport: ssh-reverse-forward …`, with the task id. That way `flyctl logs` can show it.

**The `mcp` workflow input** (off by default; the nightly run turns it on only if the repo variable `FLY_E2E_NIGHTLY_MCP` is `true`):
- **Deploy:** sets `PROPR_SPRITES_MCP_TRANSPORT=forward` and `PROPR_INTERNAL_API_URL=http://127.0.0.1:4000`, enables MCP (`MCP_ENABLED`, origin, instance id, a fresh encryption key), and removes any of these from `FLY_E2E_APP_ENV` first.
- **Owner:** the automation runs as the `FLY_E2E_GITHUB_TOKEN` user, so that user must be in `PROPR_ADMIN_USERS`; the step fails early if not. Automation runs only get MCP if their owner has signed in to ProPR, which a fresh instance lacks. So after the wake the workflow records that sign-in over SSH, using the token passed as a Fly secret, `PROPR_E2E_MCP_OWNER_TOKEN`, on the throwaway app.
- **Automation:** created through the API as a report-only run with the `propr_mcp` capability. Its prompt asks the agent to call `list_repositories` once and start its report with `PROPR_MCP_REPOSITORIES: <names>`. The workflow then starts one run.
- **Verify** (a separate step, up to 30 minutes):
  - the run ends `completed`.
  - the report line equals the fixture repository.
  - the MCP access log has a successful `list_repositories` call, so the answer wasn't guessed.
  - the worker log, captured from the wake onwards, has the transport line for the run's report task.

  The step summary records all three.

**Unverified on Fly:**
- `propr deploy fly` doesn't set `PROPR_INTERNAL_API_URL`, and its default `http://api:4000` probably doesn't resolve in the app container. That may already break agent-run grants on Fly. MCP mode sets it explicitly.
- The `ssh-reverse-forward` transport is only proven by the worker log line, read via `flyctl logs`. The same line in the task's live log may be wiped when the agent's output stream starts, so I didn't rely on it.

PR: #3817
Comment by: @integry (ID: 7179978906)
Model: Claude Opus 5.5

ProPR-Agent: claude/claude-opus-5-5
@propr-dev propr-dev Bot changed the title 🔨 [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) ⚠️❼ [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) Nov 26, 2026
propr-dev Bot pushed a commit that referenced this pull request Nov 26, 2026
Package (stdio) MCP servers now run on both Sprites and Fly Machines, and `packageMcp` is `true` for both. Nothing was tested live. Locally, the related suites, the core and root typechecks, and lint on the changed source all pass.

**How the install works (both runtimes)**
- The worker first installs and verifies each package server exactly as it does for Docker: same registry, exact version, integrity value, no lifecycle scripts.
- The worker sends its verified `package.json` and `package-lock.json` to the sandbox. The sandbox replays them as root with `npm ci --ignore-scripts` against the same registry, so npm checks every dependency against the integrity value in the lock file.
- The installer refuses a lock that doesn't pin the package at its stored integrity value, or any dependency not from the registry. It then checks the installed package's name and version and makes the result root-owned and read-only at `/opt/propr/packages/<key>`.
- The servers run next to the agent through the same stdio bridge as on Docker. Plain variables are passed the same way, secrets only by environment name, and output redaction is the same.
- A new test does the full replay locally: real `npm ci` against the fixture registry, then a tool call through the bridge. It also checks that a lock with the wrong integrity value is refused before npm runs.
- **Registry reach:** the Sprite or Machine must reach the npm registry. A private mirror set with `PROPR_EXTENSION_NPM_REGISTRY` has to be reachable from there too.

**Sprites**
- The install runs during provisioning, after the setup script and before the clean checkpoint. A failure fails provisioning with the end of npm's output, and the Sprite is deleted.
- Each pool slot carries a digest of its package-server set. An idle Sprite with a different digest is retired, not reused, and so is a background replacement built for another set.
- Matching is exact, so a run with no package servers won't reuse a Sprite built with some. If runs with different sets alternate, Sprites will be reprovisioned more often. Background replacements are built for the set the latest run asked for.
- The stdio bridge wasn't on Sprites before. It's now uploaded with the setup scripts and installed at `/opt/propr/extension-stdio-bridge.mjs`.
- The install time is recorded as `packageServerInstallMs` in compute usage. A warm Sprite reports none.

**Fly Machines**
- At Machine start the wrapper reports `installing` and runs the installer as root, before the agent and before the start gate opens. The time limit is 10 minutes.
- A failed or timed-out install reports `install-failed`. The run fails with an error naming the servers and digest, followed by the end of npm's output. The Machine is destroyed and the agent never starts.
- A run without package servers gets no installer files and no install step.
- The install time is recorded in compute usage (`packageServerInstallMs`, also counted in `provisioningMs`).

**Interim rule**
- The drop/refuse rule no longer applies to package servers on Sprites and Fly. It still applies to custom runtimes that don't declare `packageMcp`.
- **Decision for you:** I split operator catalog stdio servers into their own class (`catalogMcp`, error capability `catalog_mcp`), and Sprites and Fly keep the drop/refuse rule for them. They run an executable that must already be in the run's image, which neither runtime provides, so turning on `packageMcp` would otherwise have launched them broken with no note. For custom runtimes `catalogMcp` defaults to their `packageMcp` value. Say if you'd rather handle those differently.

**Log lines for your live check**
- Every run that applies library items logs `Extension Library items applied to this run`. It carries the runtime, library revision, `extensionDigest` of the applied items, the counts `skills`, `urlServers`, `packageServers` and `catalogStdioServers`, and `packageServersDigest`.
- The installs log `Installed package MCP servers on Sprite` and `Installed package MCP servers at Fly Machine start`, with the same digest and the install time.

**Gateway reachability:** #3817 isn't merged, so it isn't wired. I left a `TODO(#3817)` in `extensionRuntimeSupport.ts` where URL servers are marked unsupported when there's no reachable URL. That's where the reverse forward's `/api/extensions/mcp` should go.

**Docs:** the tables in `agent-runtime.md`, `agent-extensions.md` and the Fly tutorial now show package servers as supported, list catalog stdio separately, and describe the installs, failures and log lines.

**Merging with #3816:** #3816 is also unmerged and edits the same spots: the Fly wrapper and probe states, Sprite provisioning and the compute usage fields. I used my own file names so the two installs can sit side by side, but whichever lands second will need its conflicts resolved.

Updated tests cover:
- the Sprite install happening before the checkpoint
- warm-pool reuse versus retirement by digest
- a Sprite provisioning failure
- a Fly install that succeeds (with compute usage), fails, or isn't needed
- the wrapper's install states
- the remote launch carrying the install
- catalog stdio refusal on both runtimes

PR: #3818
Comment by: @integry (ID: 7180544030)
Model: Claude Opus 5.5

ProPR-Agent: claude/claude-opus-5-5
propr-dev Bot pushed a commit that referenced this pull request Nov 26, 2026
I added the `extensions` mode to `.github/workflows/fly-e2e.yml`. It hasn't run live yet. Locally, the workflow parses as YAML and every step passes `bash -n`. I also ran the new parts against the repo's real validators and sample data: the skill archive, the library save body, the jq filters and the three-line check all pass. **#3816 isn't merged, so the mode is Sprites-only.** A comment at the `EXTENSIONS` env var says to combine it with `agent_runtime` once #3816 lands.

**How it turns on**
- **Manual runs:** a `workflow_dispatch` boolean input `extensions`, default `false`.
- **Nightly runs:** only when the repo variable `FLY_E2E_NIGHTLY_EXTENSIONS` is `true`.

**One fixture change.** The library API only accepts a stored administrator, and nothing signs in on the fixture. So in extensions mode the deploy step adds the `FLY_E2E_GITHUB_TOKEN` user's login to `PROPR_ADMIN_USERS`. The new step then claims the administrator role through `POST /api/admin/members/claim`.

**1. Setup, before the idle stop (new step)**
- It calls the Settings → Extensions API itself (`/api/instance/extensions/v1/…`), using the fixture GitHub token as a bearer token.
- **Skill bundle:** a ustar archive holding one `SKILL.md` named `fixture-token`. When asked for the fixture skill token, it answers `SKILL-OK-<run id>-<attempt>`. It goes through the same archive upload route as Settings.
- **Package MCP server:** `fixture-echo`, running `@modelcontextprotocol/server-everything` 2.3.1 with the `stdio` argument and the `echo` tool.
  - The integrity value is pinned in the workflow. Settings' "Check" lookup has to return that value, and so does the saved library. Otherwise the step fails.
  - I ran this version locally: `echo` with `MCP-OK-1` returns `Echo: MCP-OK-1`.
- Both items are auto-applied and limited to the fixture repo. The step checks the saved revision afterwards.
- **No URL MCP server.** The step summary says why: the fixture has no reachable URL MCP server of its own, and the gateway route from #3817 isn't merged.
- Only the read requests retry. A repeated save would fail on the library revision check.

**2. The issue** asks for `$APP.txt` with three lines: `$APP`, the skill token, and the `echo` output for `MCP-OK-<run id>-<attempt>`. Without the mode, the issue text is unchanged.

**3. The verify step**
- It checks all three lines, expecting line 3 to be `Echo: MCP-OK-…`, and that the file has exactly three lines.
- It requires an `Extension Library items applied to this run` log line with runtime `sprites`, `skills>=1` and `packageServers>=1`.
- It then requires an `Installed package MCP servers on Sprite` (or `… at Fly Machine start`) line with the same `packageServersDigest`.
- It prints `extensionDigest`, `packageServersDigest`, the item counts and `installMs` to the log and the step summary.
- The step streams app logs in the background from its start. `flyctl logs --no-tail` keeps only recent lines, and the install line could be gone by the time the PR exists.

**Docs**
- In `agent-runtime.md`, the operator catalog stdio row is now labelled `catalogMcp`. For Sprites and Fly it says "dropped with a note when auto-applied, run refused when added explicitly".
- `setup-fly.md` has a new "Extension Library check" section covering the input, the nightly variable, the admin change, the pinned package and what gets verified.

One thing to check before you run it: if the fixture's env sets a GitHub user whitelist, the token user has to be on it, or the API calls get a 403.

There's no visible UI change, so I made no previews.

PR: #3818
Comment by: @integry (ID: 7180949991)
Model: Claude Opus 5.5

ProPR-Agent: claude/claude-opus-5-5
@integry

integry commented Nov 26, 2026

Copy link
Copy Markdown
Owner

MCP-mode smoke run: the automation API call returned HTTP 400 (body hidden)

Run: https://github.com/integry/propr/actions/runs/45739243778 (12edf29 with MCP=true). Deploy, idle stop, wake (redelivered=1) and the sign-in seed ("Recorded the GitHub grant for integry") all worked. Then Start an automation run that uses ProPR MCP failed with curl: (22) The requested URL returned error: 400, exit 4. Teardown was clean: no apps, branches, PRs or issues left.

F1 (blocker): surface API errors. api() uses --fail-with-body, but the body goes into jq and is lost, so I can't tell which call failed or why. Capture the response, and on a non-2xx print the method, path, status and the JSON error/code (never request headers), then exit non-zero. Do the same in the verify step.

F2: find the 400. It's either POST /automation-definitions (validateAutomationDefinitionInput) or POST …/runs, where requireRuntimeValid → validateRuntime returns AGENT_INVALID. Please check, against the real validators:

  • whether agentId: "claude" names an agent the fixture instance actually has: the "Configure the fixture Claude agent" step sets an alias; use exactly that one;
  • whether validateRuntime accepts a report run with propr_mcp on Sprites when PROPR_SPRITES_MCP_TRANSPORT=forward and no public URL is used. Admission may still require a public MCP URL somewhere, outside the transport selection this PR changed. If so, that's a real bug in this PR: make admission use the same transport decision (forward available ⇒ admissible). Add a test that creates and starts a propr_mcp automation through the REST routes under forward.
  • any other field the validator rejects (capabilities, autonomy, repositories).

Pushing the payload through the real route handlers in a unit test would catch this class of error before the next live run. I'll re-run with MCP=true once F1/F2 land.

@propr-dev propr-dev Bot changed the title ⚠️❼ [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) 🔨 [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) Nov 26, 2026
@propr-dev

propr-dev Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 1636a4e

Summary of Changes

I found the 400, and both F1 and F2 are done. I haven't re-run anything on Fly, so the next MCP=true run is the live check.

The 400 came from POST /automation-definitions. validateAgentDefinitionRuntime refuses it with Repositories are not enabled: <repo> (AGENT_INVALID). The fixture sets GITHUB_REPOS_TO_MONITOR=$REPO, which the daemon uses for issue runs, so the issue run worked. But automation admission and the list_repositories tool both read the stored repository list, and a fresh instance has nothing there. The new test reproduces this exact 400 with the real validator. If only the admission check were fixed, the run would have failed later anyway, because list_repositories would have returned nothing.

The fix: the MCP-mode sign-in seed (still over SSH, after the wake) now copies each GITHUB_REPOS_TO_MONITOR repository into the stored list, with GitHub's default branch, and logs Persisted monitored repositories: …. It's limited to MCP mode, so the plain smoke path is unchanged.

Your other F2 questions:

  • Agent: agentId: "claude" matches the alias the configure step saves. A test now fails if the two ever drift apart.
  • Transport: nothing requires a public MCP URL outside the transport selection. The admission report and the worker's grant request both use planAgentRunMcpTransport, which honours forward. Grant issuance only needs MCP enabled and the owner's GitHub sign-in, which the seed records. So there was no admission bug to fix.
  • Other fields: capabilities, autonomy: "dry_run" and repositories all pass the input validator.

F1: both MCP steps now use one helper, .github/fly-e2e/propr-api.sh. On a non-2xx response it prints, for example, ::error::POST /api/automation-definitions returned HTTP 400: error: …; code: AGENT_INVALID (plus message when the response has one) to stderr and the step fails. It never prints request headers or the token. A non-JSON body or a failed connection also fails the step, with a clear line. I checked these cases against a local HTTPS stub under set -euo pipefail; the token appeared nowhere in the output.

Test: the automation payload now lives in .github/fly-e2e/mcp-automation-definition.json, and the workflow and the new test (test/flyE2eMcpAutomation.test.ts) both read it. The test passes the payload through the real create and start routes, the real validator and the real config store, configured as on Fly: Sprites, PROPR_SPRITES_MCP_TRANSPORT=forward, the internal URL, and no public URL. Only GitHub access and the job queue are stubbed. It checks:

  • the 400 above while only the env var lists the repository.
  • 201 and then 202 (run queued and enqueued) once the repository is stored.
  • that the admission report and the worker's grant request both choose ssh-reverse-forward at http://127.0.0.1:39080/api/mcp.

Both tests pass, and actionlint passes on the workflow.

Decision for you: on any instance configured only through GITHUB_REPOS_TO_MONITOR, automations on those repositories are refused and list_repositories returns nothing. That's an existing product gap, not something this PR introduced, so I only worked around it in the fixture. Fixing it would mean making admission and the MCP tools also accept env-monitored repositories, which goes beyond this PR; say if you want it.

Review digest

Risk-tiered paths

  • High risk (1 file)
    • .github/workflows/fly-e2e.yml (+21/−16): CI or workflow file
  • Normal risk (2 files)
    • .github/fly-e2e/mcp-automation-definition.json (added, +8/−0)
    • .github/fly-e2e/propr-api.sh (added, +30/−0)
  • Low risk (1 file)
    • test/flyE2eMcpAutomation.test.ts (added, +132/−0)

Diff size: 4 files changed, +191/−16 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 11m 0s
  • Tokens: 5,844,957 (5,817,393 in / 27,564 out)
  • Cost: $2.36

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 7181191277✓

I found the 400, and both F1 and F2 are done. I haven't re-run anything on Fly, so the next `MCP=true` run is the live check.

**The 400 came from `POST /automation-definitions`.** `validateAgentDefinitionRuntime` refuses it with `Repositories are not enabled: <repo>` (`AGENT_INVALID`). The fixture sets `GITHUB_REPOS_TO_MONITOR=$REPO`, which the daemon uses for issue runs, so the issue run worked. But automation admission and the `list_repositories` tool both read the stored repository list, and a fresh instance has nothing there. The new test reproduces this exact 400 with the real validator. If only the admission check were fixed, the run would have failed later anyway, because `list_repositories` would have returned nothing.

**The fix:** the MCP-mode sign-in seed (still over SSH, after the wake) now copies each `GITHUB_REPOS_TO_MONITOR` repository into the stored list, with GitHub's default branch, and logs `Persisted monitored repositories: …`. It's limited to MCP mode, so the plain smoke path is unchanged.

**Your other F2 questions:**
- **Agent:** `agentId: "claude"` matches the alias the configure step saves. A test now fails if the two ever drift apart.
- **Transport:** nothing requires a public MCP URL outside the transport selection. The admission report and the worker's grant request both use `planAgentRunMcpTransport`, which honours `forward`. Grant issuance only needs MCP enabled and the owner's GitHub sign-in, which the seed records. So there was no admission bug to fix.
- **Other fields:** `capabilities`, `autonomy: "dry_run"` and `repositories` all pass the input validator.

**F1:** both MCP steps now use one helper, `.github/fly-e2e/propr-api.sh`. On a non-2xx response it prints, for example, `::error::POST /api/automation-definitions returned HTTP 400: error: …; code: AGENT_INVALID` (plus `message` when the response has one) to stderr and the step fails. It never prints request headers or the token. A non-JSON body or a failed connection also fails the step, with a clear line. I checked these cases against a local HTTPS stub under `set -euo pipefail`; the token appeared nowhere in the output.

**Test:** the automation payload now lives in `.github/fly-e2e/mcp-automation-definition.json`, and the workflow and the new test (`test/flyE2eMcpAutomation.test.ts`) both read it. The test passes the payload through the real create and start routes, the real validator and the real config store, configured as on Fly: Sprites, `PROPR_SPRITES_MCP_TRANSPORT=forward`, the internal URL, and no public URL. Only GitHub access and the job queue are stubbed. It checks:
- the 400 above while only the env var lists the repository.
- 201 and then 202 (run `queued` and enqueued) once the repository is stored.
- that the admission report and the worker's grant request both choose `ssh-reverse-forward` at `http://127.0.0.1:39080/api/mcp`.

Both tests pass, and actionlint passes on the workflow.

**Decision for you:** on any instance configured only through `GITHUB_REPOS_TO_MONITOR`, automations on those repositories are refused and `list_repositories` returns nothing. That's an existing product gap, not something this PR introduced, so I only worked around it in the fixture. Fixing it would mean making admission and the MCP tools also accept env-monitored repositories, which goes beyond this PR; say if you want it.

PR: #3817
Comment by: @integry (ID: 7181191277)
Model: Claude Opus 5.5

ProPR-Agent: claude/claude-opus-5-5
@propr-dev propr-dev Bot changed the title 🔨 [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) ⚠️❼ [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) Nov 26, 2026
@integry

integry commented Nov 26, 2026

Copy link
Copy Markdown
Owner

MCP-mode rerun: the automation run ended failed, and the reason was lost

Run: https://github.com/integry/propr/actions/runs/45746653737 (1636a4e, MCP=true). The 400 is fixed:

  • Persisted monitored repositories: integry/propr-fly-fixture;
  • Started automation run 72f8503c-….

Then the verify step printed Automation run 72f8503c-…: failed and ::error::Automation run ended failed: with an empty reason. The app log dump starts only ~3 minutes before teardown (flyctl's buffer), so the run's own logs are gone. The fixture issue run in the same deploy succeeded. Teardown was clean.

F1 (blocker): capture the failure while the app is still up. When the automation run doesn't complete, the verify step must print, via the API:

  • the run's status and its failure fields: whatever the run record actually uses, e.g. failure, error, errorCode or lastError. The current jq reads a field that's empty;
  • the run's events/timeline;
  • the last ~80 lines of the report task's logs.

Redact them as the rest of the workflow does. Also print every worker log line since MCP_TRIGGERED_AT that mentions the run id or the report task id, fetched before teardown and not from the dump.

F2: noise that may be related. From 04:01:47 the worker logged Error getting worktree changes: fatal: ambiguous argument 'HEAD~1...HEAD' every 2 s, 22 times, until teardown. A report-only run's clone probably has a single commit. Make the changes probe handle a root commit (diff against the empty tree, or skip it for report runs) and log once rather than every poll. If that probe feeds the run's outcome, this may be the failure itself. Check.

F3: smoke workflow leftover. When the fixture issue run fails before opening a PR, its branch stays in the fixture repo: 19/… and 23/… today, which I deleted by hand. The Close fixture work step should also delete branches whose name starts with the fixture issue's number, even when there's no PR.

I'll re-run once F1 lands; F2 too if it turns out to be the cause.

@propr-dev propr-dev Bot changed the title ⚠️❼ [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) 🔨 [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) Nov 26, 2026
@propr-dev

propr-dev Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The PR implements per-run SSH forwarding with transport selection, grant propagation, lifecycle cleanup, and deployment support. No verified merge blocker emerged from static review of the supplied diff and surrounding context. Merge readiness is conditional on the three pending checks completing successfully; 31 checks passed and none failed. No commands or tests were run during this review.

✅ Authenticated forwarding — Each run generates separate keys, verifies the SSH host key, and restricts sshd to one loopback listener with sessions and local forwarding disabled.

✅ Grant propagation — The new transport survives grant issuance, tool-policy construction, and runtime admission while retaining the per-run bearer token.

✅ Meaningful coverage — Added tests exercise streaming, reconnect exhaustion, host-key rejection, pending upstream cleanup, and runtime teardown. The supplied history also records successful live automation verification.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S4: 🟢 Clarify public endpoint exposure

docs/docs/features/mcp.md says forced forwarding keeps MCP “off the public internet entirely,” but PROPR_SPRITES_MCP_TRANSPORT=forward changes agent transport selection; it does not disable the public endpoint. The new Fly defaults explicitly enable MCP at the public origin. Clarify that agents avoid the public endpoint and that operators must separately restrict public exposure if desired. This is a documentation follow-up rather than a demonstrated authorization bypass.

S5: 🟢 Exercise cancellation during setup

The lifecycle tests cover cancellation after launch, but not cancellation while configure(), proxy creation, or SSH establishment is pending. A focused test would strengthen confidence in the late-cleanup path in spritesRuntime.ts and ensure canceled setup cannot interfere with subsequent Sprite reuse. The supplied code does not establish a concrete failure in that interleaving, so this remains optional coverage.

Score

The implementation has substantial targeted coverage and no verified blocker in the supplied code. Final merge confidence remains conditional on the pending checks.

Score: 8/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 8s
  • Tokens: 102,045 (100,810 in / 1,235 out)
  • Cost: $0.96

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S4 S5

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 26, 2026
@propr-dev propr-dev Bot changed the title 🔨 [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) ✅❽ [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) Nov 26, 2026
@integry

integry commented Nov 26, 2026

Copy link
Copy Markdown
Owner

My own review (90bccf5): please fix before merge

R1: reconnect can't rebind the remote port (spritesMcpForwardConfig.ts ~111, spritesMcpForward.ts retries). sshd only drops a dead client after ClientAliveInterval 15 × ClientAliveCountMax 3 = 45 s. The worker's whole reconnect window is about 15.5 s (500+1000+2000+4000+8000 ms). After a half-open proxy path, the stale per-connection sshd child still holds 127.0.0.1:39080, every forwardIn fails with "address in use", and the run aborts with MCP_TRANSPORT_LOST although a later attempt would work. Fix both sides:

  • set sshd to ClientAliveInterval 5, ClientAliveCountMax 2;
  • before re-forwarding, have the worker kill the stale session for the forward user (e.g. mcp-forward.sh reset-sessions via exec: pkill -u propr-mcp sshd or equivalent);
  • make the reconnect window clearly longer than the server's dead-peer timeout.

Test: a held port is released, then the reconnect succeeds.

R2: a connection that completes after close() survives (spritesMcpForward.ts ~205). The abort listener can call client.end() before client.connect() has run (we're still in await connectProxy(...)). The connect then completes, forwardIn succeeds, and this.client = client is set after close() cleared it, leaving a live SSH session and remote listener. Check this.signal.aborted after await connectProxy and again after await established, and end the client if it's set. Add a test that aborts during connectProxy and during the handshake.

R3: Host header (spritesMcpForward.ts ~53). The relay passes raw bytes, so requests reach PROPR_INTERNAL_API_URL with Host: 127.0.0.1:39080. That breaks vhost- or SNI-routed https targets (404/421). Either restrict the target to http:// on loopback or private addresses, where Host doesn't matter (simplest, and matches the default http://127.0.0.1:4000), and refuse others with a clear message; or terminate HTTP and rewrite Host. Document the choice.

R4: repository seed restores removed repos (configLoader.ts ~387). An empty stored list is treated as "never configured", so repos an admin removed on purpose come back on every restart. Seed only when the list was never stored: key absent, or a one-time repos_seeded_from_env marker. Never re-seed after a user has saved a list, even an empty one. Test both cases.

R5: transport carried in a side field (agentRunSpec.ts ~41). The forward is selected only through toolPolicy.mcpTransport, which every place that rebuilds a policy has to copy. If it's dropped, the run quietly becomes reachable-url with a loopback URL and gets connection refused. Derive the transport from the grant URL (isSpritesMcpForwardUrl), or put it on the ProPR mcpServers entry. A loopback MCP URL without the forward should refuse the run explicitly.

R6: PROPR_SPRITES_MCP_FORWARD parsing (spritesMcpForwardConfig.ts ~49). Unknown values count as enabled, so disabled or none leave the forward on. Parse strictly like spritesMcpTransportPreference: true/false sets, anything else refuses Sprites MCP runs with Invalid PROPR_SPRITES_MCP_FORWARD.

R7 (small):

  • close() awaits a remote mcp-forward.sh stop (10 s timeout) in the run's finally, before the slot is released, and the Sprite is reset to its checkpoint anyway. Don't block release on it: fire and forget it with the timeout, or skip it when a reset follows.
  • logOncePerWorktree silences the same error on a reused worktree path for the life of the worker. Key it by task (or path + task id).

After these, ultrafix runs again. The live MCP-mode run stays the acceptance; I'll rerun it if R1, R2 or R5 change the forward or selection paths.

@propr-dev propr-dev Bot changed the title ✅❽ [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) 🔨 [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) Nov 26, 2026
@propr-dev

propr-dev Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 758d60c

Summary of Changes

R1–R7 are all fixed. R1, R2 and R5 change the forward and selection paths, so your live MCP-mode run is still the acceptance. The touched suites, core typecheck and lint all pass. test/spritesMcpForwardOpenSsh.test.ts also passes against a real OpenSSH 9.2 sshd that I pulled in from Debian packages.

R1: reconnect can't rebind the port

  • sshd now uses ClientAliveInterval 5 and ClientAliveCountMax 2, so it drops a dead client after 10 s.
  • Before each reconnect attempt, the worker runs a new mcp-forward.sh reset-sessions command over the Sprites exec API. It kills the sshd daemon's per-connection children and any propr-mcp processes, waits until 127.0.0.1:39080 is free, and leaves the daemon running. If the reset fails, the worker logs it and keeps retrying.
  • Reconnecting keeps going for at least 5 attempts and at least 30 s, three times sshd's dead-peer timeout.
  • Tests:
    • A fake test where a stale session holds the port: it is released, then the reconnect succeeds.
    • A test that the worker retries past its attempt count until the window has passed.
    • A shell test of reset_sessions.
    • A real-sshd case: I close only the worker side of the proxy, so sshd keeps the stale session and its listener. With the reset, the reconnect succeeds within 8 s. With the reset turned into a no-op, the test fails.

R2: connection completing after close()

  • The worker now checks for abort after await connectProxy (and destroys the socket) and again after await established, so a late connection is ended, never adopted.
  • Tests close the forward during a reconnect's proxy connect, during authentication and during the listener request. Each checks that no SSH session or listener is left.

R3: Host header. I took the simpler option: PROPR_INTERNAL_API_URL must be plain http:// on a loopback or private IP, localhost, a single-label name (api), or a .internal/.local name. Anything else is refused with a message saying why. The TLS path is removed. The choice is documented in agent-runtime.md.

R4: repos coming back after removal

  • The seed runs only when repos_to_monitor was never stored and a new repos_seeded_from_env marker is unset. The marker is set after the seed.
  • Tests cover: seeded once, an emptied list stays empty, the marker blocks a re-seed, and a stored list is left alone.

R5: transport in a side field

  • I removed AgentToolPolicy.mcpTransport. agentRunMcpGrant now derives the transport from the URL with isSpritesMcpForwardUrl.
  • A Sprites run whose ProPR MCP URL is any other loopback address is refused, both at planning and at run start.
  • Behaviour change: a loopback PROPR_SPRITES_MCP_URL (e.g. https://localhost) used to be accepted as given on open Sprites runs; it is now refused. I updated that assertion in spritesNetworkPolicy.test.ts.

R6: strict parsing. 1/true/on/yes (or unset) turns the forward on and 0/false/off/no turns it off. Anything else, such as disabled or none, refuses Sprites MCP runs with Invalid PROPR_SPRITES_MCP_FORWARD.

R7

  • close() starts the remote mcp-forward.sh stop in the background and no longer blocks the slot release. It is exposed as forward.remoteStop so tests can await it.
  • The log-once helper is now keyed by task id plus path. Scans with no task id always log. A test checks that a second task on the same path logs again.

Two things I found along the way:

  • Not in your list: ssh2's own ed25519 key generator produces a key its parser rejects about 1 time in 250 (13 of 3,000 in a probe). For the client key that would fail every connection attempt of a run, and it made the suite flaky. The forward now generates a new key until it parses. Ten runs in a row were clean after the fix.
  • test/spritesMcpForward.test.ts passes but never exits on its own. The untouched HEAD copy does the same, so it isn't from these changes. I ran it with --test-force-exit.

Docs updated: agent-runtime.md, configuration-reference.md and setup-fly.md. Nothing here is visual, so there are no previews.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (11 files)
    • packages/core/src/agents/runtime/agentRunMcpTransport.ts (+9/−2)
    • packages/core/src/agents/runtime/agentRunSpec.ts (+7/−4)
    • packages/core/src/agents/runtime/sprites/spritesMcpForward.ts (+69/−16)
    • packages/core/src/agents/runtime/sprites/spritesMcpForwardConfig.ts (+57/−9)
    • packages/core/src/agents/runtime/sprites/spritesNetwork.ts (+14/−1)
    • packages/core/src/agents/types.ts (+0/−6)
    • packages/core/src/daemon/configLoader.ts (+27/−12)
    • packages/core/src/extensions/extensionLaunch.ts (+1/−1)
    • packages/core/src/services/worktreeMonitorService.ts (+16/−8)
    • scripts/sprites-mcp-forward.sh (+31/−1)
    • src/jobs/agentRuns/toolPolicy.ts (+0/−1)
  • Low risk (10 files)
    • docs/docs/architecture/agent-runtime.md (+5/−4)
    • docs/docs/operations/configuration-reference.md (+1/−1)
    • docs/docs/tutorials/setup-fly.md (+1/−1)
    • packages/core/test/worktreeMonitorCommittedChanges.test.ts (+4/−1)
    • test/helpers/fakeSpriteSshd.ts (+21/−0)
    • test/monitoredRepositories.test.ts (+40/−21)
    • test/spritesMcpForward.test.ts (+186/−7)
    • test/spritesMcpForwardOpenSsh.test.ts (+27/−0)
    • test/spritesNetworkPolicy.test.ts (+11/−1)
    • test/spritesRuntime.live.test.ts (+1/−1)

Diff size: 21 files changed, +528/−98 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 28m 16s
  • Tokens: 13,606,567 (13,545,743 in / 60,824 out)
  • Cost: $4.87
  • Subscription usage: Weekly +1%

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 7186536546✓

R1–R7 are all fixed. R1, R2 and R5 change the forward and selection paths, so your live MCP-mode run is still the acceptance. The touched suites, core typecheck and lint all pass. `test/spritesMcpForwardOpenSsh.test.ts` also passes against a real OpenSSH 9.2 sshd that I pulled in from Debian packages.

**R1: reconnect can't rebind the port**
- sshd now uses `ClientAliveInterval 5` and `ClientAliveCountMax 2`, so it drops a dead client after 10 s.
- Before each reconnect attempt, the worker runs a new `mcp-forward.sh reset-sessions` command over the Sprites exec API. It kills the sshd daemon's per-connection children and any `propr-mcp` processes, waits until `127.0.0.1:39080` is free, and leaves the daemon running. If the reset fails, the worker logs it and keeps retrying.
- Reconnecting keeps going for at least 5 attempts and at least 30 s, three times sshd's dead-peer timeout.
- Tests:
  - A fake test where a stale session holds the port: it is released, then the reconnect succeeds.
  - A test that the worker retries past its attempt count until the window has passed.
  - A shell test of `reset_sessions`.
  - A real-sshd case: I close only the worker side of the proxy, so sshd keeps the stale session and its listener. With the reset, the reconnect succeeds within 8 s. With the reset turned into a no-op, the test fails.

**R2: connection completing after `close()`**
- The worker now checks for abort after `await connectProxy` (and destroys the socket) and again after `await established`, so a late connection is ended, never adopted.
- Tests close the forward during a reconnect's proxy connect, during authentication and during the listener request. Each checks that no SSH session or listener is left.

**R3: Host header.** I took the simpler option: `PROPR_INTERNAL_API_URL` must be plain `http://` on a loopback or private IP, `localhost`, a single-label name (`api`), or a `.internal`/`.local` name. Anything else is refused with a message saying why. The TLS path is removed. The choice is documented in `agent-runtime.md`.

**R4: repos coming back after removal**
- The seed runs only when `repos_to_monitor` was never stored and a new `repos_seeded_from_env` marker is unset. The marker is set after the seed.
- Tests cover: seeded once, an emptied list stays empty, the marker blocks a re-seed, and a stored list is left alone.

**R5: transport in a side field**
- I removed `AgentToolPolicy.mcpTransport`. `agentRunMcpGrant` now derives the transport from the URL with `isSpritesMcpForwardUrl`.
- A Sprites run whose ProPR MCP URL is any other loopback address is refused, both at planning and at run start.
- **Behaviour change:** a loopback `PROPR_SPRITES_MCP_URL` (e.g. `https://localhost`) used to be accepted as given on open Sprites runs; it is now refused. I updated that assertion in `spritesNetworkPolicy.test.ts`.

**R6: strict parsing.** `1/true/on/yes` (or unset) turns the forward on and `0/false/off/no` turns it off. Anything else, such as `disabled` or `none`, refuses Sprites MCP runs with `Invalid PROPR_SPRITES_MCP_FORWARD`.

**R7**
- `close()` starts the remote `mcp-forward.sh stop` in the background and no longer blocks the slot release. It is exposed as `forward.remoteStop` so tests can await it.
- The log-once helper is now keyed by task id plus path. Scans with no task id always log. A test checks that a second task on the same path logs again.

**Two things I found along the way:**
- **Not in your list:** ssh2's own ed25519 key generator produces a key its parser rejects about 1 time in 250 (13 of 3,000 in a probe). For the client key that would fail every connection attempt of a run, and it made the suite flaky. The forward now generates a new key until it parses. Ten runs in a row were clean after the fix.
- `test/spritesMcpForward.test.ts` passes but never exits on its own. The untouched HEAD copy does the same, so it isn't from these changes. I ran it with `--test-force-exit`.

Docs updated: `agent-runtime.md`, `configuration-reference.md` and `setup-fly.md`. Nothing here is visual, so there are no previews.

PR: #3817
Comment by: @integry (ID: 7186536546)
Model: Claude Opus 5.5

ProPR-Agent: claude/claude-opus-5-5

integry commented Nov 26, 2026

Copy link
Copy Markdown
Owner

/ultrafix goal=8 max=3

@propr-dev propr-dev Bot added the ultrafix label Nov 26, 2026
@propr-dev

propr-dev Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Ultrafix loop started (goal: 8/10, max cycles: 3)

First action: /review

💡 Tip: Remove the ultrafix label from this PR to stop further ultrafix cycles.

@propr-dev

propr-dev Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: Full Test Suite Shard 4/4

Please investigate and fix this CI failure.

  • Check: Full Test Suite Shard 4/4
  • Result: failure
  • Commit: 758d60ccc505 (758d60ccc505aee3cad3cff20ed7ba4c72ed6768)
  • Run: View CI failure

Failure evidence

.github:11
Process completed with exit code 1.

.github:52450
Process completed with exit code 1.

.github:2
Node.js 20 is deprecated. The following actions target Node.js 20 but are being forced to run on Node.js 24: actions/checkout@11d5960. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/

@propr-dev

propr-dev Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The PR implements per-run SSH forwarding for Sprites, including transport selection, grant plumbing, reconnects, and cleanup. It needs a small correction to its documented security guarantees before merge.

✅ Restricted SSH configuration — The generated configuration limits authentication to the run’s key and forwarding to one loopback listener, with host-key verification on the worker.

✅ Substantial lifecycle coverage — Added tests cover streaming, reconnects, cancellation, failed startup, and pending upstream connections.

This is a static review of the supplied code; no commands were run. Current checks show 29 passed, five pending, and no failures.

Merge blockers

Every finding below was introduced by this PR and must be resolved before merging.

F1: 🔴 Forward mode does not disable public MCP

  • Category: correctness

  • Required behavior: Configuration documentation must accurately describe whether an authenticated service remains publicly exposed.

  • Evidence: docs/docs/features/mcp.md, “Agent runs on remote runtimes”; packages/cli/src/commands/deploy/flyMachineConfig.ts, buildAppEnv; packages/core/src/agents/runtime/agentRunMcpTransport.ts, selectReverseForward.

    1. An operator deploys with GitHub sign-in and sets PROPR_SPRITES_MCP_TRANSPORT=forward, following the new assurance that this “keeps ProPR MCP off the public internet entirely.”
    2. The Fly deployment still sets MCP_ENABLED=true and MCP_PUBLIC_ORIGIN=https://<app>.fly.dev.
    3. selectReverseForward changes the endpoint used by agent runs. It does not change server enablement, public routing, or endpoint access.
    4. Agents use the private forward, but the deployment still exposes authenticated MCP at its public origin, contrary to the documented guarantee.

    static trace: the supplied deployment configuration and transport selector establish these independent behaviors. The per-run token and SSH restrictions protect authentication and the forwarding connection; they do not remove the public endpoint. This is an exposure-documentation error, not evidence of an authentication bypass.

  • Minimum fix: Correct the privacy claims in docs/docs/features/mcp.md, docs/docs/operations/deploy-fly.md, and .env.example to distinguish private agent traffic from public server exposure. Explain that forward mode removes the agents’ dependency on public MCP reachability; independently configured routing determines whether MCP is publicly exposed.

Suggestions

These are optional follow-ups and are not sent to /fix.

S6: 🟢 Exercise cleanup across Sprite reuse

The new test deliberately permits close() to return before remote shutdown completes. A follow-up test spanning delayed shutdown, checkpoint restoration, and a subsequent run would strengthen confidence that an old run’s background stop cannot affect its successor. The supplied excerpts do not establish a reachable failure across the pool’s restoration safeguards, so this is optional coverage rather than a verified blocker.

Score

The forwarding implementation has strong configuration and lifecycle coverage, but its privacy documentation currently promises more than the setting enforces. Correct that localized issue and complete the pending checks.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 19s
  • Tokens: 111,268 (109,724 in / 1,544 out)
  • Cost: $1.04

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix F1 S6

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 2f8f1ae

Summary of Changes

I fixed the Shard 4/4 failure. It was a test that kept the process alive after passing, not a bug in the product code.

Cause: test/spritesMcpForward.test.ts was the only failing unit in the shard (291/292 passed). All 31 of its subtests passed within about 6 seconds, but the process never exited, so the runner killed it at the 180 s per-unit limit. I bisected it locally to the test "close() does not wait for the remote sshd stop before the slot is released", added in 758d60c. That test replaces sprite.execFile so the remote stop command never finishes until the test says so. Normally that same stop command is what shuts down the fake sshd's listener. With it intercepted, the listener stayed open and kept the process running.

Fix: that test now stops the fake sshd itself once its assertions are done (test/spritesMcpForward.test.ts). Nothing else changed.

Verification:

  • The test that hung on its own now exits in about 3 s; before the fix it hung until a 25 s timeout.
  • I ran the full file 3 times: each run exited 0 in about 7 s with 31 passed and 0 failed. Before the fix it hung every time.

The "Node.js 20 is deprecated" message in the failure evidence is only a warning from actions/checkout and has nothing to do with the failure.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk: none
  • Low risk (1 file)
    • test/spritesMcpForward.test.ts (+3/−1)

Diff size: 1 file changed, +3/−1 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-dev[bot]
  • Time: 7m 37s
  • Tokens: 1,188,563 (1,184,351 in / 4,212 out)
  • Cost: $0.65

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 7187600473✓

I fixed the Shard 4/4 failure. It was a test that kept the process alive after passing, not a bug in the product code.

**Cause:** `test/spritesMcpForward.test.ts` was the only failing unit in the shard (291/292 passed). All 31 of its subtests passed within about 6 seconds, but the process never exited, so the runner killed it at the 180 s per-unit limit. I bisected it locally to the test "close() does not wait for the remote sshd stop before the slot is released", added in 758d60c. That test replaces `sprite.execFile` so the remote `stop` command never finishes until the test says so. Normally that same `stop` command is what shuts down the fake sshd's listener. With it intercepted, the listener stayed open and kept the process running.

**Fix:** that test now stops the fake sshd itself once its assertions are done (`test/spritesMcpForward.test.ts`). Nothing else changed.

**Verification:**
- The test that hung on its own now exits in about 3 s; before the fix it hung until a 25 s timeout.
- I ran the full file 3 times: each run exited 0 in about 7 s with 31 passed and 0 failed. Before the fix it hung every time.

The "Node.js 20 is deprecated" message in the failure evidence is only a warning from `actions/checkout` and has nothing to do with the failure.

PR: #3817
Comment by: @propr-dev[bot] (ID: 7187600473)
Model: Claude Opus 5.5

ProPR-Agent: claude/claude-opus-5-5
@propr-dev

propr-dev Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit d6cc6a6

Addressed 1 AI review comment (IDs: 7187642896)

Addressed finding F1

Summary of Changes

I've corrected F1. The docs no longer claim that PROPR_SPRITES_MCP_TRANSPORT=forward keeps ProPR MCP off the public internet. They now say it only changes how agent runs reach MCP, and that MCP_ENABLED and how the API is routed decide whether MCP is public.

Files named in the finding:

  • docs/docs/features/mcp.md: the forward opens no public port, and with forward agent runs don't depend on a public MCP URL and their MCP traffic stays off the internet. A new note says the setting doesn't turn MCP off or remove it from the public origin. The example is a propr deploy fly deployment: it still sets MCP_ENABLED=true and MCP_PUBLIC_ORIGIN=https://<app>.fly.dev, so OAuth clients can still reach the authenticated endpoint there.
  • docs/docs/operations/deploy-fly.md: I dropped "only" from "only over the SSH reverse forward" and added that MCP stays served at https://<app>.fly.dev/api/mcp either way. MCP_ENABLED=false is how to stop serving it publicly.
  • .env.example: the PROPR_SPRITES_MCP_TRANSPORT comment no longer says "keeping MCP off the internet". It now says forward only picks the agents' path, and that MCP_ENABLED and API routing decide public exposure.

Two more places with the same wrong claim, both changed:

  • docs/docs/architecture/agent-runtime.md, the forward bullet: its existing sentence ("ProPR MCP then never has to be reachable from the internet") was accurate. I added that this doesn't disable or hide a public MCP endpoint.
  • packages/core/src/agents/runtime/sprites/spritesMcpForwardConfig.ts: a doc comment said forward keeps "ProPR MCP off the public internet". I reworded it the same way; this is a comment change only.

The other references to the forward (agentRunMcpTransport.ts, the Fly e2e workflow, the tests) say MCP doesn't need to be reachable from the internet, which is true, so I left them alone.

There are no code or behaviour changes, so no new regression tests apply, and there is nothing visual to preview. I ran the suites that read .env.example or the docs:

  • cliInitCommand, composeApiIdentityPath and cliAssetLoading pass.
  • composeRenderedConfig ran 0 tests in this container, so it checked nothing.

Separate from F1: the PR description's live-verification note says the Fly run used forward mode "so MCP stays private even though the app has a public URL". That has the same inaccuracy, but I didn't edit the PR body.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (2 files)
    • .env.example (+2/−1)
    • packages/core/src/agents/runtime/sprites/spritesMcpForwardConfig.ts (+2/−1)
  • Low risk (3 files)
    • docs/docs/architecture/agent-runtime.md (+1/−1)
    • docs/docs/features/mcp.md (+1/−1)
    • docs/docs/operations/deploy-fly.md (+1/−1)

Diff size: 5 files changed, +7/−5 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 3m 45s
  • Tokens: 452,918 (449,138 in / 3,780 out)
  • Cost: $0.39

View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR

I've corrected F1. The docs no longer claim that `PROPR_SPRITES_MCP_TRANSPORT=forward` keeps ProPR MCP off the public internet. They now say it only changes how agent runs reach MCP, and that `MCP_ENABLED` and how the API is routed decide whether MCP is public.

**Files named in the finding:**
- **`docs/docs/features/mcp.md`:** the forward opens no public port, and with `forward` agent runs don't depend on a public MCP URL and their MCP traffic stays off the internet. A new note says the setting doesn't turn MCP off or remove it from the public origin. The example is a `propr deploy fly` deployment: it still sets `MCP_ENABLED=true` and `MCP_PUBLIC_ORIGIN=https://<app>.fly.dev`, so OAuth clients can still reach the authenticated endpoint there.
- **`docs/docs/operations/deploy-fly.md`:** I dropped "only" from "only over the SSH reverse forward" and added that MCP stays served at `https://<app>.fly.dev/api/mcp` either way. `MCP_ENABLED=false` is how to stop serving it publicly.
- **`.env.example`:** the `PROPR_SPRITES_MCP_TRANSPORT` comment no longer says "keeping MCP off the internet". It now says `forward` only picks the agents' path, and that `MCP_ENABLED` and API routing decide public exposure.

**Two more places with the same wrong claim, both changed:**
- **`docs/docs/architecture/agent-runtime.md`, the `forward` bullet:** its existing sentence ("ProPR MCP then never has to be reachable from the internet") was accurate. I added that this doesn't disable or hide a public MCP endpoint.
- **`packages/core/src/agents/runtime/sprites/spritesMcpForwardConfig.ts`:** a doc comment said `forward` keeps "ProPR MCP off the public internet". I reworded it the same way; this is a comment change only.

The other references to the forward (`agentRunMcpTransport.ts`, the Fly e2e workflow, the tests) say MCP doesn't *need* to be reachable from the internet, which is true, so I left them alone.

There are no code or behaviour changes, so no new regression tests apply, and there is nothing visual to preview. I ran the suites that read `.env.example` or the docs:
- `cliInitCommand`, `composeApiIdentityPath` and `cliAssetLoading` pass.
- `composeRenderedConfig` ran 0 tests in this container, so it checked nothing.

**Separate from F1:** the PR description's live-verification note says the Fly run used forward mode "so MCP stays private even though the app has a public URL". That has the same inaccuracy, but I didn't edit the PR body.

PR: #3817
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5

ProPR-Agent: claude/claude-opus-5-5
@propr-dev

propr-dev Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: Full Test Suite Shard 1/4

Please investigate and fix this CI failure.

  • Check: Full Test Suite Shard 1/4
  • Result: failure
  • Commit: d6cc6a6611aa (d6cc6a6611aae07664a2fe2a0d5fdd92abb24d97)
  • Run: View CI failure

Failure evidence

.github:11
Process completed with exit code 1.

.github:40791
Process completed with exit code 1.

.github:2
Node.js 20 is deprecated. The following actions target Node.js 20 but are being forced to run on Node.js 24: actions/checkout@11d5960. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/

@propr-dev

propr-dev Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 7bd1332

Summary of Changes

I fixed the Shard 1/4 failure. It was an intermittent race in a test this PR doesn't touch, triggered by the newer git on the CI runners. Nothing in the PR's own code caused it.

What failed: 292 of 293 test files in the shard passed. The failure was in test/worktreeObjectRecovery.test.ts, which matches main. Two tests failed, the "second damaged ref" one and the "repair interrupted before its fetch" one, with packfile … index not opened / unable to load rev-index. The same file passed on two earlier runs with the same git (2.56.1) and the same runner image, so it fails only some of the time.

Cause: git 2.56's own source shows that automatic maintenance after fetch and commit now uses the "geometric" strategy by default. It repacks in a background process. These two tests are the ones where the repair code adds a second pack to the test repository, and that is enough to start a background repack. The repack can swap pack files while the test's next git command is reading them.

Fix (test only): in test/worktreeObjectRecovery.test.ts, the test's source repository and all three clones now have maintenance.auto=false and gc.auto=0 (a small cloneWithoutMaintenance helper). I couldn't use a global git setting through environment variables: the production code already sets them, and another test in this file checks their exact numbering.

Verification: this container has git 2.39, which doesn't do this, so I built git 2.56.1 and put it first on the PATH. With two runs at a time to mimic the busy CI host:

  • the original file failed in exactly these two tests in 4 of 12 runs. The background process was still writing packs after a test finished (ENOTEMPTY … clone/.git/objects/pack during cleanup).
  • the fixed file passed all 16 runs of those two tests, and 4 full runs passed 32/32.
  • it also passes 32/32 with the container's own git 2.39.

Possible follow-up, not changed here: real repository clones also run this background maintenance on git 2.56. If a repack lands while the repair code is checking objects, that check could fail and wrongly mark the repository as needing manual repair. That's a separate change to objectRecovery.ts, so I left it out of this fix.

There's nothing visual to preview.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk: none
  • Low risk (1 file)
    • test/worktreeObjectRecovery.test.ts (+12/−3)

Diff size: 1 file changed, +12/−3 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-dev[bot]
  • Time: 21m 15s
  • Tokens: 3,927,630 (3,907,678 in / 19,952 out)
  • Cost: $1.66

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 7188508523✓

I fixed the Shard 1/4 failure. It was an intermittent race in a test this PR doesn't touch, triggered by the newer git on the CI runners. Nothing in the PR's own code caused it.

**What failed:** 292 of 293 test files in the shard passed. The failure was in `test/worktreeObjectRecovery.test.ts`, which matches `main`. Two tests failed, the "second damaged ref" one and the "repair interrupted before its fetch" one, with `packfile … index not opened` / `unable to load rev-index`. The same file passed on two earlier runs with the same git (2.56.1) and the same runner image, so it fails only some of the time.

**Cause:** git 2.56's own source shows that automatic maintenance after `fetch` and `commit` now uses the "geometric" strategy by default. It repacks in a background process. These two tests are the ones where the repair code adds a second pack to the test repository, and that is enough to start a background repack. The repack can swap pack files while the test's next git command is reading them.

**Fix (test only):** in `test/worktreeObjectRecovery.test.ts`, the test's source repository and all three clones now have `maintenance.auto=false` and `gc.auto=0` (a small `cloneWithoutMaintenance` helper). I couldn't use a global git setting through environment variables: the production code already sets them, and another test in this file checks their exact numbering.

**Verification:** this container has git 2.39, which doesn't do this, so I built git 2.56.1 and put it first on the PATH. With two runs at a time to mimic the busy CI host:
- the original file failed in exactly these two tests in 4 of 12 runs. The background process was still writing packs after a test finished (`ENOTEMPTY … clone/.git/objects/pack` during cleanup).
- the fixed file passed all 16 runs of those two tests, and 4 full runs passed 32/32.
- it also passes 32/32 with the container's own git 2.39.

**Possible follow-up, not changed here:** real repository clones also run this background maintenance on git 2.56. If a repack lands while the repair code is checking objects, that check could fail and wrongly mark the repository as needing manual repair. That's a separate change to `objectRecovery.ts`, so I left it out of this fix.

There's nothing visual to preview.

PR: #3817
Comment by: @propr-dev[bot] (ID: 7188508523)
Model: Claude Opus 5.5

ProPR-Agent: claude/claude-opus-5-5
@propr-dev

propr-dev Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

The PR implements per-run SSH reverse forwarding for Sprites, with transport selection, admission reporting, provisioning, recovery, and documentation. The supplied code supports the intended behavior; no verified merge blocker was found. Merge readiness is conditional on the remaining Validate Changes check completing successfully.

✅ Restricted SSH access — The generated configuration permits only the designated loopback reverse listener, disables sessions and other forwarding, and verifies the per-run host key.

✅ Recovery and cleanup coverage — Added tests exercise streaming, reconnects, half-open sessions, cancellation during connection establishment, and unreachable upstream targets.

✅ Live acceptance evidence — The supplied history records a successful automation on the reviewed head, backed by an MCP access-log entry and the transport diagnostic.

This was a static review of the supplied diff and context; no commands or tests were run.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S7: 🟢 Exercise delayed teardown across reuse

Consider adding a lifecycle test that delays the background remoteStop operation until a Sprite has undergone release and reuse. SpritesMcpForward.close() deliberately returns before the unscoped remote stop completes, while the current test checks only that close returns promptly. Verifying the interaction with checkpoint restoration would strengthen lifecycle coverage. This is optional because the supplied context does not establish an interleaving that survives restoration and disrupts a subsequent run.

S8: 🟢 Verify credential compatibility on upgrade

Consider an upgrade regression test for adding SYSTEM_TASK_SECRET to an existing Fly deployment. The supplied configuration documents credential encryption falling back from that secret to SESSION_SECRET, while the new deployment behavior generates the previously absent secret. Confirming that existing encrypted credentials remain readable would provide useful migration assurance. The relevant encryption implementation is not supplied, so this is a verification suggestion rather than a demonstrated defect.

Score

The implementation has substantial targeted coverage and supplied live verification, with no verified actionable defect. One current-head check remains pending.

Score: 8/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 53s
  • Tokens: 111,429 (110,501 in / 928 out)
  • Cost: $1.04

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

Copy and edit to choose records from this review:

/fix S7 S8

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 26, 2026
@propr-dev propr-dev Bot changed the title 🔨 [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) ✅❽ [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) Nov 26, 2026
@integry
integry merged commit 9d8892a into 3758-epic-runtime-abstraction-sc0 Nov 26, 2026
50 checks passed
@propr-dev propr-dev Bot changed the title ✅❽ [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) [3813 by Claude Opus 5.5] Remote runtimes: reach ProPR MCP from Sprites via a per-run SSH reverse forward (no public URL) Nov 26, 2026
propr-dev Bot pushed a commit that referenced this pull request Nov 26, 2026
On Sprites with no public MCP URL, URL MCP servers now reach the gateway through #3817's forward, and `remoteMcp` counts as supported there. The new tests and the neighbouring suites pass. Nothing was run live on Sprites; that waits for your check with #3816.

**1. Rebase.** The branch already contained 9d8892a: merge commit 983d1cc brought in the epic, so I didn't need to rebase again. The `TODO(#3817)` in `extensionRuntimeSupport.ts` is gone.

**2. Gateway through the forward**
- **Transport decision:** `extensionRuntimeSupport` uses #3817's `planAgentRunMcpTransport`. When it returns `ssh-reverse-forward`, the plan's loopback URL becomes the gateway's endpoint. The gateway is then `http://127.0.0.1:39080/api/extensions/mcp`, or `http://127.0.0.1:39080<base>/api/extensions/mcp` if `PROPR_INTERNAL_API_URL` has a base path. A test confirms the relay carries `/api/extensions/mcp/docs` to the API stand-in.
- **Restricted network policy:** the forward needs no extra host. The policy now skips the gateway host when the gateway is the forward listener, and the result is identical to the policy with no gateway. Any other loopback gateway URL is still refused, because nothing in the Sprite listens there.
- **Change you didn't ask for:** the forward used to open only when the run had a ProPR MCP grant over it, but an issue task with auto-applied URL servers may carry no grant. Without a change, its agent would call a loopback port where nothing listens. `SpritesRuntime.start` now also opens the forward when the run's gateway URL is the forward listener. It refuses the run if that URL doesn't match the forward target.

**3. Tests**
- In `packages/core/test/extensionRemoteRuntime.test.ts`: a Sprites run with a URL server and no public URL gets `http://127.0.0.1:39080/api/extensions/mcp/docs`, with `remoteMcp` supported in both open and restricted mode. With `PROPR_SPRITES_MCP_FORWARD=0`, the same run drops the auto-applied server, records it as skipped (`agent_runtime_unsupported`) and returns the note.
- In `test/spritesMcpForward.test.ts`:
  - a run with no ProPR MCP grant starts the forward before the agent, and a gateway call over it reaches the API.
  - a restricted Sprite adds no host for the loopback gateway.
  - a gateway URL that doesn't match the forward listener is refused.
- The new tests fail against the previous source and pass with the change.
- The forward, network-policy, Sprites runtime, registry, network-capability, runtime-notice, launch-integration and auto-apply suites pass: 85 tests in the Sprites suites and 52 in the rest.
- Core typecheck and core lint are clean.

**Docs:** I updated `agent-runtime.md` (the extensions section and the runtime table), the "Extensions on Fly runtimes" table in `setup-fly.md`, and the Sprites network-policy text in `execution-safety.md`. The Sprites restricted-network description string now also says the forward needs no gateway host.

There are no visual previews, since nothing in this change is visible in the UI.

PR: #3818
Comment by: @integry (ID: 7189751302)
Model: Claude Opus 5.5

ProPR-Agent: claude/claude-opus-5-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant