Skip to content

[3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites - #3853

Merged
integry merged 10 commits into
3758-epic-runtime-abstraction-sc0from
3838/claude-opus-5-5-run-mistral-vibe-and-open-20261127-1654-u8y
Nov 28, 2026
Merged

integry merged 10 commits into
3758-epic-runtime-abstraction-sc0from
3838/claude-opus-5-5-run-mistral-vibe-and-open-20261127-1654-u8y

Conversation

@propr-dev

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

Copy link
Copy Markdown
Contributor

AI Implementation Summary

Closes #3838

Branch: 3838/claude-opus-5-5-run-mistral-vibe-and-open-20261127-1654-u8y
Commits: ✅ Changes committed (239365b)


AI Processing Completed

Execution Details:

Summary:
Mistral Vibe and OpenCode now run on both Fly Machines and Sprites, using the same run spec as on Docker. The unit and fake-runtime tests pass, but nothing has run against real Fly or Sprites yet. The live smoke runs the issue requires before merge haven't happened, so there are no run links for the PR description yet.

Tests: every suite that covers the changed code passes: Fly, Sprites, network policy, egress proxy, registry, OpenCode agent and runtime packages, plus a new test/remoteRunVibeOpenCode.test.ts. Core typechecks and lints with zero warnings. One combined run of 17 suites hit the 10-minute limit. Run in smaller batches and one file at a time, all of them passed, the slowest in 9 s, so I don't know what stalled the combined run. I also ran the changed OpenCode entrypoint as a non-root user: it copies the login in, keeps the command's exit code, and writes the rotated login back.

What changed

  • Accepted agents: Fly Machines accept Claude Code, Codex, Vibe and OpenCode. Sprites add Vibe and OpenCode to their existing three. Antigravity on Fly is still refused. Agents that select a CLI version other than the pinned one are still refused.
  • Credentials: these still come only from the agent configuration's stores. Vibe's ~/.vibe store goes to the run, with MISTRAL_API_KEY from its .env passed as a secret variable. OpenCode's config store and, when configured, its data store both go to the run.
    • Both runtimes previously handled only one store per run, so OpenCode needed that generalised.
    • Rotated auth.json / account.json are written back through the credential broker as before.
    • OpenCode's entrypoint now also syncs rotated logins back when it starts as node, which is how both remote runtimes start it.
  • Vibe's prompt file and runtime home: the prompt file is uploaded read-only to the same path Docker binds it at. The runtime home is a fresh directory in the Machine or Sprite for each run. After the run, propr-export/export.json is copied back to the worker, which is where Vibe's cost parsing reads it.
  • Output and cost parsing: OpenCode's output and costs come from stdout, which both runtimes already capture.
  • Redaction (Fly): Fly output now also redacts stored provider keys in credential files and *_API_KEY / *_TOKEN variables.
  • Sprite installs: a Sprite installs opencode-ai, uv and mistral-vibe on Python 3.12 while it is provisioned, so the clean checkpoint caches them. The versions come from the Dockerfile.agent pins, and each is checked with --version. The uv archive is checked against its published SHA-256.
  • Restricted networking: Vibe's allowlist covers api.mistral.ai. OpenCode's adds the hosts of the provider named in its configured model, <provider>/<model>.
    • The providers covered are listed in execution-safety.md. Any other provider needs its host added in Settings.
    • Docker's proxy and the Sprites allowlist read the model from the same command line. Fly Machines still refuse restricted runs.

Smoke workflow (fly-e2e.yml)

  • Agent input: a new agent input (claude | codex | vibe | opencode, default claude) selects the agent and its llm-<agent> label.
  • Credentials: each agent is configured the way Claude already is. One base64 key in FLY_E2E_APP_ENV is installed into the agent's managed credential directory: CODEX_AUTH_B64, VIBE_ENV_B64 or OPENCODE_CONFIG_B64. No new repository secrets.
  • Missing credentials: if the key is missing, the summary says so and the run skips before creating anything.
  • Summary: it shows the agent, its pinned CLI version and the linked PR.
  • Leak and cleanup checks:
    • The worker log is checked with redact_fly_tokens and also searched for the credential's own values.
    • On Fly Machines, the agent image and the derived image are searched for those values too.
    • A final step checks that no app, Machine or Sprite is left.

Before merge

  • Add the new FLY_E2E_APP_ENV keys, then dispatch the four combinations: Vibe and OpenCode, each on fly-machines and sprites. Then put the run links in the PR description.
  • The fixture repo needs llm-vibe, llm-opencode and llm-codex labels.

Things to know

  • I changed the Sprites upload format to support several stores: files now go under source/<n>/. I updated the two tests that assumed the old layout, including the live test.
  • The Fly guest wrapper now gives node any parent directories it creates under /home/node, such as ~/.config for OpenCode.
  • The smoke's "nothing left behind" step parses flyctl apps list --json assuming each app has a Name field. I couldn't confirm that format here, so check that step on the first live run.

There's no visual change, so I made no previews. Docs are updated in agent-runtime.md, execution-safety.md and setup-fly.md.

Review digest

Risk-tiered paths

  • High risk (2 files)
    • .github/fly-e2e/agent-credentials.sh (added, +46/−0): auth-looking path
    • .github/workflows/fly-e2e.yml (+159/−14): CI or workflow file
  • Normal risk (17 files)
    • packages/core/src/agents/runtime/agentRunNetworkPolicy.ts (+15/−5)
    • packages/core/src/agents/runtime/fly/launch.ts (+98/−50)
    • packages/core/src/agents/runtime/fly/wrapper.ts (+4/−0)
    • packages/core/src/agents/runtime/flyMachinesRuntime.ts (+5/−2)
    • packages/core/src/agents/runtime/registry.ts (+2/−2)
    • packages/core/src/agents/runtime/remoteRunMounts.ts (added, +96/−0)
    • packages/core/src/agents/runtime/sprites/spritesCliPins.ts (+3/−1)
    • packages/core/src/agents/runtime/sprites/spritesCliVersions.ts (+2/−0)
    • packages/core/src/agents/runtime/sprites/spritesNetwork.ts (+2/−2)
    • packages/core/src/agents/runtime/sprites/spritesProvisioning.ts (+2/−1)
    • packages/core/src/agents/runtime/sprites/spritesRun.ts (+73/−21)
    • packages/core/src/agents/runtime/spritesRuntime.ts (+6/−1)
    • packages/core/src/network/egressAllowlist.ts (+47/−2)
    • packages/core/src/network/egressExecution.ts (+2/−2)
    • scripts/opencode-entrypoint.sh (+30/−16)
    • scripts/sprites-agent-setup.sh (+54/−1)
    • scripts/sprites-launcher.py (+40/−4)
  • Low risk (6 files)
    • docs/docs/architecture/agent-runtime.md (+17/−4)
    • docs/docs/features/execution-safety.md (+2/−0)
    • docs/docs/tutorials/setup-fly.md (+14/−1)
    • test/remoteRunVibeOpenCode.test.ts (added, +296/−0)
    • test/spritesRuntime.live.test.ts (+2/−1)
    • test/spritesRuntime.test.ts (+4/−1)

Diff size: 25 files changed, +1,021/−131 lines

View task for the run's logs and conversation.


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


💡 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!

Mistral Vibe and OpenCode now run on both Fly Machines and Sprites, using the same run spec as on Docker. The unit and fake-runtime tests pass, but nothing has run against real Fly or Sprites yet. The live smoke runs the issue requires before merge haven't happened, so there are no run links for the PR description yet.

Tests: every suite that covers the changed code passes: Fly, Sprites, network policy, egress proxy, registry, OpenCode agent and runtime packages, plus a new `test/remoteRunVibeOpenCode.test.ts`. Core typechecks and lints with zero warnings. One combined run of 17 suites hit the 10-minute limit. Run in smaller batches and one file at a time, all of them passed, the slowest in 9 s, so I don't know what stalled the combined run. I also ran the changed OpenCode entrypoint as a non-root user: it copies the login in, keeps the command's exit code, and writes the rotated login back.

What changed
- Accepted agents: Fly Machines accept Claude Code, Codex, Vibe and OpenCode. Sprites add Vibe and OpenCode to their existing three. Antigravity on Fly is still refused. Agents that select a CLI version other than the pinned one are still refused.
- Credentials: these still come only from the agent configuration's stores. Vibe's `~/.vibe` store goes to the run, with `MISTRAL_API_KEY` from its `.env` passed as a secret variable. OpenCode's config store and, when configured, its data store both go to the run.
  - Both runtimes previously handled only one store per run, so OpenCode needed that generalised.
  - Rotated `auth.json` / `account.json` are written back through the credential broker as before.
  - OpenCode's entrypoint now also syncs rotated logins back when it starts as `node`, which is how both remote runtimes start it.
- Vibe's prompt file and runtime home: the prompt file is uploaded read-only to the same path Docker binds it at. The runtime home is a fresh directory in the Machine or Sprite for each run. After the run, `propr-export/export.json` is copied back to the worker, which is where Vibe's cost parsing reads it.
- Output and cost parsing: OpenCode's output and costs come from stdout, which both runtimes already capture.
- Redaction (Fly): Fly output now also redacts stored provider keys in credential files and `*_API_KEY` / `*_TOKEN` variables.
- Sprite installs: a Sprite installs `opencode-ai`, `uv` and `mistral-vibe` on Python 3.12 while it is provisioned, so the clean checkpoint caches them. The versions come from the `Dockerfile.agent` pins, and each is checked with `--version`. The `uv` archive is checked against its published SHA-256.
- Restricted networking: Vibe's allowlist covers `api.mistral.ai`. OpenCode's adds the hosts of the provider named in its configured model, `<provider>/<model>`.
  - The providers covered are listed in `execution-safety.md`. Any other provider needs its host added in Settings.
  - Docker's proxy and the Sprites allowlist read the model from the same command line. Fly Machines still refuse restricted runs.

Smoke workflow (`fly-e2e.yml`)
- Agent input: a new `agent` input (`claude | codex | vibe | opencode`, default `claude`) selects the agent and its `llm-<agent>` label.
- Credentials: each agent is configured the way Claude already is. One base64 key in `FLY_E2E_APP_ENV` is installed into the agent's managed credential directory: `CODEX_AUTH_B64`, `VIBE_ENV_B64` or `OPENCODE_CONFIG_B64`. No new repository secrets.
- Missing credentials: if the key is missing, the summary says so and the run skips before creating anything.
- Summary: it shows the agent, its pinned CLI version and the linked PR.
- Leak and cleanup checks:
  - The worker log is checked with `redact_fly_tokens` and also searched for the credential's own values.
  - On Fly Machines, the agent image and the derived image are searched for those values too.
  - A final step checks that no app, Machine or Sprite is left.

Before merge
- Add the new `FLY_E2E_APP_ENV` keys, then dispatch the four combinations: Vibe and OpenCode, each on `fly-machines` and `sprites`. Then put the run links in the PR description.
- The fixture repo needs `llm-vibe`, `llm-opencode` and `llm-codex` labels.

Things to know
- I changed the Sprites upload format to support several stores: files now go under `source/<n>/`. I updated the two tests that assumed the old layout, including the live test.
- The Fly guest wrapper now gives `node` any parent directories it creates under `/home/node`, such as `~/.config` for OpenCode.
- The smoke's "nothing left behind" step parses `flyctl apps list --json` assuming each app has a `Name` field. I couldn't confirm that format here, so check that step on the first live run.

There's no visual change, so I made no previews. Docs are updated in `agent-runtime.md`, `execution-safety.md` and `setup-fly.md`.

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

propr-dev Bot commented Nov 27, 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: 239365b9eaf2 (239365b9eaf2d8780d7d88d20fed4645fe018eaf)
  • Run: View CI failure

Failure evidence

.github:11
Process completed with exit code 1.

.github:52429
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 27, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit cc72ff9

Summary of Changes

I fixed the shard 1/4 failure, and the failing test now passes locally. The only failing unit was test/flyE2eMcpAutomation.test.ts (296 of 297 passed). The SQLITE_BUSY and "Queue connection lost" errors in the log come from other tests that passed.

Cause: this PR changed the Fly smoke workflow so its configure step saves whichever agent the new agent input picks, with the agent type as its alias (alias: type). The test still looked for the old hard-coded alias: 'claude', found no saved agent, and failed with 0 !== 1.

That also exposed a real bug in the workflow. The MCP mode's automation payload (.github/fly-e2e/mcp-automation-definition.json) always uses agentId: "claude". A run with mcp on and agent=vibe or agent=opencode would therefore have pointed at an agent that was never saved.

Changes:

  • .github/workflows/fly-e2e.yml: the MCP step now sets the payload's agent to the selected one, the same way it already fills in the repository: jq … '.repositories = [$repo] | .agentId = $agent'. The stored "claude" default still matches the default agent.

  • test/flyE2eMcpAutomation.test.ts: the first test now checks the new chain:

    • exactly one agent is saved, aliased by its type.
    • that type comes from the AGENT input, which defaults to claude.
    • the MCP step sets the payload's agentId to the same $AGENT.

    I also fixed a stale comment that still named the old "Configure the fixture Claude agent" step.

Checks:

  • Both tests in the file pass.
  • Against the workflow as it was at the failing commit, the updated first test fails as it should.
  • The workflow still parses as YAML.
  • No other test reads fly-e2e.yml.

One thing I couldn't check: whether Vibe and OpenCode actually support MCP mode end to end. This fix only makes sure the MCP payload names the agent that was configured.

Review digest

Risk-tiered paths

  • High risk (1 file)
    • .github/workflows/fly-e2e.yml (+4/−2): CI or workflow file
  • Normal risk: none
  • Low risk (1 file)
    • test/flyE2eMcpAutomation.test.ts (+10/−5)

Diff size: 2 files changed, +14/−7 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-dev[bot]
  • Time: 4m 37s
  • Tokens: 1,098,004 (1,093,173 in / 4,831 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: 7224850437✓

I fixed the shard 1/4 failure, and the failing test now passes locally. The only failing unit was `test/flyE2eMcpAutomation.test.ts` (296 of 297 passed). The `SQLITE_BUSY` and "Queue connection lost" errors in the log come from other tests that passed.

**Cause:** this PR changed the Fly smoke workflow so its configure step saves whichever agent the new `agent` input picks, with the agent type as its alias (`alias: type`). The test still looked for the old hard-coded `alias: 'claude'`, found no saved agent, and failed with `0 !== 1`.

That also exposed a real bug in the workflow. The MCP mode's automation payload (`.github/fly-e2e/mcp-automation-definition.json`) always uses `agentId: "claude"`. A run with `mcp` on and `agent=vibe` or `agent=opencode` would therefore have pointed at an agent that was never saved.

**Changes:**
- **`.github/workflows/fly-e2e.yml`:** the MCP step now sets the payload's agent to the selected one, the same way it already fills in the repository: `jq … '.repositories = [$repo] | .agentId = $agent'`. The stored `"claude"` default still matches the default agent.
- **`test/flyE2eMcpAutomation.test.ts`:** the first test now checks the new chain:
  - exactly one agent is saved, aliased by its type.
  - that type comes from the `AGENT` input, which defaults to `claude`.
  - the MCP step sets the payload's `agentId` to the same `$AGENT`.

  I also fixed a stale comment that still named the old "Configure the fixture Claude agent" step.

**Checks:**
- Both tests in the file pass.
- Against the workflow as it was at the failing commit, the updated first test fails as it should.
- The workflow still parses as YAML.
- No other test reads `fly-e2e.yml`.

One thing I couldn't check: whether Vibe and OpenCode actually support MCP mode end to end. This fix only makes sure the MCP payload names the agent that was configured.

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

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

propr-dev Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Resolved merge conflicts from 3758-epic-runtime-abstraction-sc0 into 3838/claude-opus-5-5-run-mistral-vibe-and-open-20261127-1654-u8y in commit deb39cb

Conflicting Files

  • scripts/opencode-entrypoint.sh

Resolution Summary

I resolved the one conflict, in scripts/opencode-entrypoint.sh. No conflict markers are left anywhere in the repo, bash -n reports no syntax errors, and the three test files that cover the entrypoint and credentials (remoteRunVibeOpenCode, opencodeAgent, opencodeCredentials) pass: 72 tests, 0 failures.

What the conflict was about. Both branches changed the code that runs after the OpenCode command finishes, where refreshed credential files are copied back to the host's credential store.

  • This PR moved that copy-back loop into a function, sync_opencode_credentials. It's called from the existing root path and from the new path for Fly Machines and Sprites, where the entrypoint already runs as node.
  • 3758-epic-runtime-abstraction-sc0 changed the inline loop in two ways:
    • It skips copying auth.json back when the OpenCode 2.x database was seeded (sync_database=1). Otherwise the stale seeded file would undo a login made on the host since the run started.
    • It runs opencode-credentials.py sync afterwards to write database-held credentials back.

How I resolved it.

  1. I kept the PR's function and put the base branch's auth.json skip, with its comment, inside it. That way the fix covers every place the function is called, not just one.
  2. The condition in the function reads "${sync_database:-0}", not "$sync_database". The script runs under set -u, and only the root path sets sync_database. Without the default, the remote path would crash on an unset variable.
  3. In the root path, I kept the PR's call to sync_opencode_credentials and added the base branch's database sync step right after it.

Why this way. The PR's intent was to share one write-back routine across runtimes, so a copy-paste of the base branch's inline loop would have undone that. The base branch's change fixes a real bug where a logged-out credential gets restored, so it needs to apply everywhere the function runs. The remote path doesn't seed the database, so with the safe default its behaviour is unchanged: auth.json is still copied back there, as before.


🤖 Resolution Details

  • Model: Claude Opus 5.5
  • Time: 4m 26s

View Task Execution


System-triggered merge conflict resolution

Automatically resolved merge conflicts after merging target branch into PR branch.
Resolved conflicts in:
- scripts/opencode-entrypoint.sh

PR: #3853
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Auto-merged 3758-epic-runtime-abstraction-sc0 into 3838/claude-opus-5-5-run-mistral-vibe-and-open-20261127-1654-u8y (clean merge) in commit 397f536

No conflicts were found — the merge was verified by an AI agent.


🤖 Verification Details

  • Model: Claude Opus 5.5
  • Time: 3m 42s

View Task Execution


System-triggered merge conflict resolution

…bstraction-sc0' into 3838/claude-opus-5-5-run-mistral-vibe-and-open-20261127-1654-u8y

integry commented Nov 27, 2026

Copy link
Copy Markdown
Owner

/review

@propr-dev

propr-dev Bot commented Nov 27, 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 27, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR extends both remote runtimes through shared mount handling and multi-store credential transport. It needs changes before merge: credential redaction misses supported OpenCode configurations, the image leak check can falsely pass, and the required live validation remains outstanding.

✅ Multiple credential stores — Both runtimes preserve store IDs and declared output paths when returning refreshed credentials through the broker.

✅ Bounded prompt uploads — Prompt reads reject symlinks and oversized files before uploading them.

Current-head checks report 19 passed, five pending, and no failures. This review used static analysis of the supplied code; no commands were run.

Merge blockers

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

F1: 🔴 Redact keys from OpenCode JSONC

  • Category: security

  • Required behavior: Newly supported OpenCode runs must redact stored provider credentials from Fly output, including credentials in supported opencode.jsonc configurations.

  • Evidence: packages/core/src/agents/runtime/fly/launch.ts, stageCredentials

    1. An OpenCode configuration stores provider.options.apiKey in opencode.jsonc containing comments or trailing commas. The supplied provider manifest explicitly includes this file.
    2. The new remote support uploads it, but JSON.parse(file.content.toString(), ...) throws.
    3. The catch branch adds content only when file.refresh is true. Configuration files are not refreshable, so the provider key never enters storeSecrets.
    4. If the command prints that key—the same output exposure exercised by the new synthetic-key test—the Fly redactor lacks its value and preserves it in captured output.

    The environment-key collection does not cover a key supplied only through this file. The new tests exercise strict JSON credentials, so they do not cover this path. static trace: supported manifest → stageCredentials → prepared.secrets → captured-output redaction.

  • Minimum fix: Extract credential values from supported JSONC configurations as well as strict JSON, and add a regression that prints a synthetic key loaded from a commented opencode.jsonc.

F2: 🔴 Prevent false-negative image leak checks

  • Category: correctness

  • Required behavior: The smoke workflow must fail when an agent image contains one of the installed credential values.

  • Evidence: .github/workflows/fly-e2e.yml, “Check that the agent credentials stayed out of the agent images”

    1. An exported image contains a matching credential before the end of its filesystem archive.
    2. grep -aqF finds the credential and exits immediately, closing its input.
    3. With enough archive data remaining, docker export encounters the closed pipe and exits unsuccessfully.
    4. Because set -o pipefail is enabled, the pipeline is unsuccessful despite the match. Consequently, && found=1 does not execute.
    5. The step leaves found=0 and reports that the image contains no credential.

    The pipeline is the left side of &&, so set -e does not stop the script on this failure. Both base and derived image checks use this logic. static trace: shell pipeline status and early-exiting grep; no command was executed.

  • Minimum fix: Consume the complete export while checking for matches, and handle export errors separately from the search result. Verify both a credential-containing archive with substantial trailing data and an export failure.

F3: 🔴 Supply the required live smoke evidence

  • Category: requirement

  • Required behavior: The supplied objective explicitly requires live Vibe and OpenCode runs on both Fly Machines and Sprites, with run links added before merge.

  • Evidence: .github/workflows/fly-e2e.yml, new agent dispatch input; test/remoteRunVibeOpenCode.test.ts

    static trace: The workflow adds the ability to select each agent, while the new runtime tests use fake services. The supplied implementation summary explicitly states that none of the four required live combinations has run and that their links are absent. The authoritative current-head checks provide no corresponding live smoke evidence.

    Merging with the supplied evidence would leave the explicit acceptance criterion unmet, including verification of real provisioning, credential delivery, task completion, and cleanup. Passing fake-runtime tests does not establish those external integrations.

  • Minimum fix: Complete successful, non-skipped smoke runs for Vibe and OpenCode on each runtime and attach their run links to the PR description.

Suggestions

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

S1: 🟢 Align OpenCode package selection

Dockerfile.agent selects opencode-ai for version 1 and @opencode/cli otherwise, while Sprite setup always installs opencode-ai. Consider sharing or mirroring that selection. The supplied excerpts do not establish the current OpenCode pin, so this is a compatibility follow-up rather than a demonstrated current provisioning blocker.

Score

The implementation has useful shared transport logic and focused tests, but two concrete defects and an outstanding live acceptance requirement prevent merge readiness.

Score: 5/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 24s
  • Tokens: 87,814 (85,704 in / 2,110 out)
  • Cost: $0.83

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 F2 F3 S1

🤖 Review by ProPR

@propr-dev propr-dev Bot changed the title 🔨 [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites ⚠️❺ [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites Nov 27, 2026
@integry

integry commented Nov 27, 2026

Copy link
Copy Markdown
Owner

Please fix F1 and F2 from the latest review:

  • F1: parse opencode.jsonc (comments and trailing commas) when collecting store secrets for redaction. Add a regression that prints a synthetic key loaded from a commented opencode.jsonc and checks it's redacted.
  • F2: make the image leak check consume the whole docker export stream (for example, export to a file or use grep -c and read the count), and fail the step separately on an export error.
  • S1: also align Sprite setup's OpenCode package selection with Dockerfile.agent.

F3 (the live runs) is on me: I'll dispatch the four smoke runs once F1 and F2 land.

@propr-dev propr-dev Bot changed the title ⚠️❺ [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites 🔨 [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites Nov 27, 2026
@propr-dev

propr-dev Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit ee8a8d8

Summary of Changes

F1, F2 and S1 are fixed. The OpenCode regression suite passes 10/10, and core typechecks and lints with zero warnings. The F2 workflow change was checked locally against a fake docker, not in a real CI run.

F1 — opencode.jsonc secrets are now redacted.

  • Cause: Fly's credential staging read each store file with JSON.parse. A commented opencode.jsonc threw, so its apiKey was never added to the redaction list.
  • Fix: I added a small parseJsonc to packages/core/src/utils/jsonUtils.ts. It strips // and /* */ comments and trailing commas, but never inside strings, so "https://…" is untouched. fly/launch.ts now uses it.
  • Regression: a new test in test/remoteRunVibeOpenCode.test.ts loads a synthetic key from an opencode.jsonc with line, block and trailing comments and trailing commas. It does a full fake Fly run whose agent prints the key, then checks the output has only [REDACTED] and the key isn't in the Machine env. It shares a helper with the existing full-run test.
  • Proof: switched back to JSON.parse, the new test fails.

F2 — the image leak check now reads the whole export. In fly-e2e.yml, grep -aqF is replaced by grep -acF, which reads the whole stream and writes a match count. Each side of the pipe has its own exit status, and the step fails separately on:

  • docker export failing: "Exporting … failed (docker export exited N), so it was not searched".
  • grep failing, or a count that isn't a number.
  • a count above 0, which reports the number of matching lines.

With a fake docker writing a 2 MB export, the step passed when the export was clean, failed when it held a key, and failed with the export error when the exit code was 17.

S1 — Sprite setup now picks the same package as Dockerfile.agent. sprites-agent-setup.sh installs opencode-ai for a 1.x pin and @opencode/cli otherwise. Before, the current 2.4.2 pin would have been installed as [email protected]. The setup test now runs the package-choice line from both files for the current pin and for a 1.x version and checks they agree. I corrected the matching sentence in agent-runtime.md.

Other checks: the Fly Machines, create-request, runtime-packages, Sprites runtime and flyE2eMcpAutomation suites all pass. flyE2eMcpAutomation fails one test when run with PROPR_DEMO_MODE=true, which is my test setting; it fails the same way on an untouched copy of HEAD.

There's no visual change, so I made no previews. The four live smoke runs (F3) are still yours to dispatch.

Review digest

Risk-tiered paths

  • High risk (1 file)
    • .github/workflows/fly-e2e.yml (+11/−3): CI or workflow file
  • Normal risk (3 files)
    • packages/core/src/agents/runtime/fly/launch.ts (+3/−1)
    • packages/core/src/utils/jsonUtils.ts (+39/−0)
    • scripts/sprites-agent-setup.sh (+3/−1)
  • Low risk (2 files)
    • docs/docs/architecture/agent-runtime.md (+1/−1)
    • test/remoteRunVibeOpenCode.test.ts (+41/−8)

Diff size: 6 files changed, +98/−14 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 9m 9s
  • Tokens: 2,359,257 (2,344,595 in / 14,662 out)
  • Cost: $1.12

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: 7228913052✓

F1, F2 and S1 are fixed. The OpenCode regression suite passes 10/10, and core typechecks and lints with zero warnings. The F2 workflow change was checked locally against a fake `docker`, not in a real CI run.

**F1 — `opencode.jsonc` secrets are now redacted.**
- **Cause:** Fly's credential staging read each store file with `JSON.parse`. A commented `opencode.jsonc` threw, so its `apiKey` was never added to the redaction list.
- **Fix:** I added a small `parseJsonc` to `packages/core/src/utils/jsonUtils.ts`. It strips `//` and `/* */` comments and trailing commas, but never inside strings, so `"https://…"` is untouched. `fly/launch.ts` now uses it.
- **Regression:** a new test in `test/remoteRunVibeOpenCode.test.ts` loads a synthetic key from an `opencode.jsonc` with line, block and trailing comments and trailing commas. It does a full fake Fly run whose agent prints the key, then checks the output has only `[REDACTED]` and the key isn't in the Machine env. It shares a helper with the existing full-run test.
- **Proof:** switched back to `JSON.parse`, the new test fails.

**F2 — the image leak check now reads the whole export.** In `fly-e2e.yml`, `grep -aqF` is replaced by `grep -acF`, which reads the whole stream and writes a match count. Each side of the pipe has its own exit status, and the step fails separately on:
- `docker export` failing: "Exporting … failed (docker export exited N), so it was not searched".
- grep failing, or a count that isn't a number.
- a count above 0, which reports the number of matching lines.

With a fake `docker` writing a 2 MB export, the step passed when the export was clean, failed when it held a key, and failed with the export error when the exit code was 17.

**S1 — Sprite setup now picks the same package as `Dockerfile.agent`.** `sprites-agent-setup.sh` installs `opencode-ai` for a 1.x pin and `@opencode/cli` otherwise. Before, the current 2.4.2 pin would have been installed as `[email protected]`. The setup test now runs the package-choice line from both files for the current pin and for a 1.x version and checks they agree. I corrected the matching sentence in `agent-runtime.md`.

**Other checks:** the Fly Machines, create-request, runtime-packages, Sprites runtime and `flyE2eMcpAutomation` suites all pass. `flyE2eMcpAutomation` fails one test when run with `PROPR_DEMO_MODE=true`, which is my test setting; it fails the same way on an untouched copy of HEAD.

There's no visual change, so I made no previews. The four live smoke runs (F3) are still yours to dispatch.

PR: #3853
Comment by: @integry (ID: 7228913052)
Model: Claude Opus 5.5

ProPR-Agent: claude/claude-opus-5-5
@propr-dev propr-dev Bot changed the title 🔨 [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites ⚠️❺ [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites Nov 27, 2026

integry commented Nov 27, 2026

Copy link
Copy Markdown
Owner

/review

@propr-dev propr-dev Bot changed the title ⚠️❺ [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites 🔨 [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites Nov 27, 2026
@propr-dev

propr-dev Bot commented Nov 27, 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 27, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR adds Vibe and OpenCode support across Fly Machines and Sprites using shared mount handling and existing credential-broker contracts. The requested fixes are present, and I found no verified code blocker in the supplied diff. Merge readiness still awaits the four owner-managed live smoke runs.

✅ JSONC redaction fixed — Store-secret collection now parses comments and trailing commas, with a regression checking that a synthetic opencode.jsonc key is redacted from captured Fly output.

✅ Export failures handled independently — The image scan consumes the complete export using grep -acF, captures both pipeline statuses, and separately rejects export errors and credential matches.

✅ Package selection aligned — Sprite provisioning now mirrors Dockerfile.agent’s OpenCode package selection for legacy and current versions.

This was a static review; no commands were run. The authoritative checks report 25 passed, none failed or pending, and 17 neutral/skipped.

Merge blockers

No merge blockers.

Suggestions

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

S2: 🟢 Exercise image-scan failure cases

An optional shell regression for .github/workflows/fly-e2e.yml would help preserve the corrected pipeline behavior. Cover a clean export, a credential match followed by substantial output, and an export that emits partial data before failing. The implementation addresses these cases statically; executable coverage would protect against recurrence.

Score

The requested fixes are implemented and current checks pass. The outstanding live validation of both agents on both remote runtimes remains a material verification gap, owned by the requester rather than an additional code-fix requirement.

Score: 7/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 41s
  • Tokens: 87,765 (86,995 in / 770 out)
  • Cost: $0.78

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 S2

🤖 Review by ProPR

@propr-dev propr-dev Bot changed the title 🔨 [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites ⚠️❼ [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites Nov 27, 2026
propr-dev Bot pushed a commit that referenced this pull request Nov 27, 2026
I've implemented all three parts of #3863, but none of the live acceptance runs on a Fly-launched instance have happened, so there are no run links for the PR yet. The new tests pass: 311 server-side tests across the touched suites and 12 UI tests. Typecheck, lint (zero warnings) and the OpenAPI check are clean.

1. Pasted credentials (works on every runtime, including Docker)
- The agent dialog has a third setup option, Paste a key or token. Editing a saved agent shows the same section.
- Claude: an Anthropic API key or a `claude setup-token` token. Either goes into `settings.json` under `env` as `ANTHROPIC_API_KEY` or `CLAUDE_CODE_OAUTH_TOKEN`. Saving one removes the other, and other settings are kept.
- Codex: an OpenAI API key, written to `auth.json` the way `codex login --with-api-key` does it, or a pasted `auth.json`.
- OpenCode: a pasted `auth.json`, stored in its data directory.
- Each option links to where the key or token comes from.
- Values are write-only. The dialog and the new `GET/PUT/DELETE /api/agents/:id/credentials` endpoints only report "set" plus the last 4 characters. Remove deletes a value.
- Files are written atomically with mode 0600, under the same store lock the runs use.
- I added redaction patterns for these key formats and for secrets inside the JSON files, with a case in `test/redactSecrets.test.ts`.
- Vibe keeps its existing Mistral key field, which the API already redacts. I didn't touch the stores #3853 changes.

2. Interactive login on the remote runtime
- This applies when the agent runs on Sprites or Fly Machines and there's no local Docker. "No Docker" means neither `DOCKER_HOST` nor `/var/run/docker.sock` is present.
- Sprites: the login takes a Sprite from the normal pool, so it counts against `PROPR_SPRITES_MAX`. It runs the login CLI with a TTY, and the Sprite is always deleted afterwards, never returned to the pool.
- Fly Machines: the login starts a short-lived `propr-login-*` Machine from `PROPR_FLY_IMAGE`, holding a `PROPR_FLY_MACHINES_MAX` slot. Fly's API has no interactive console, so output and keystrokes go through its exec API, polled about once a second. If ProPR crashes, the Machine ends the CLI and destroys itself.
- On success, the login files the provider manifest declares are copied into the agent's credential store, then the Sprite or Machine is destroyed.
- If no slot frees up within 30 seconds, or Fly's organization machine limit is hit, the login fails with a message naming the cap.
- Provisioning a new Sprite takes a few minutes. The dialog streams progress meanwhile.

3. Health check by runtime
- For agents on Sprites or Fly Machines, the check no longer touches a local Docker image or starts a test run. It checks three things: the runtime token is accepted, the CLI version (Sprites) or agent image (Fly) resolves, and the agent has a stored credential.
- Failures now show Agent runtime unavailable or an auth error, never "Agent image preparation failed".
- Docker instances behave as before.

Things to know
- The API process needs `PROPR_SPRITES_TOKEN` or the `PROPR_FLY_*` variables. They're already shared on a `propr deploy fly` instance, since the API and worker run in the same container.
- Interactive login on Sprites covers the agents Sprites runs today (Claude, Codex, Antigravity). OpenCode becomes available there once #3853 adds it.
- To stay under the file-length limit, I moved the terminal-output sanitizer, the Docker helpers and the login routes into separate files. The OpenAPI spec was regenerated.

Docs: `setup-fly.md` has a new "Agent credentials" section. `agents-and-models.md` describes pasting credentials and interactive login without Docker.

Still needed before merge: the live runs on a Fly-launched instance — (a) an `AI` issue to a PR with a pasted key on both Sprites and Fly Machines, (b) the interactive Claude login on Sprites followed by a run, and (c) a healthy agent card. Previews of the dialog and agent cards were taken against a mocked API.

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

propr-dev Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

Ready to merge within the effective scope. The changes extend the existing run-spec and credential-broker paths to Vibe and OpenCode without introducing a separate execution architecture.

✅ Credential handling — Both remote runtimes support multiple manifest-filtered stores and route refreshed credentials through the existing broker. Fly redaction now parses JSONC, with a regression covering a commented configuration.

✅ Launch prerequisites — Vibe execute runs explicitly start as root, preserve the unprivileged agent execution path, and have regression coverage alongside every other agent type.

✅ Operational verification — The supplied live results demonstrate successful OpenCode runs on both runtimes and Vibe reaching the expected billing failure, including fail-fast reporting and cleanup. Current checks report 25 passed, none failed or pending.

This assessment is based on static review of the supplied diff and context; I ran no commands.

Merge blockers

No merge blockers.

Suggestions

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

S4: 🟢 Complete successful Vibe smoke runs

When a funded Mistral account is available, run Vibe through a successful edit and linked PR on both runtimes. This would exercise real usage-export collection beyond the synthetic tests. It is optional for this merge because the authorized follow-up explicitly accepts reaching the billing failure as the live verification endpoint.

S5: 🟢 Exercise OpenCode credential rotation live

The reported OpenCode smoke runs used a model requiring no API key. A future authenticated run that refreshes a login would strengthen confidence in the new non-root entrypoint synchronization and remote write-back integration. The supplied broker and runtime tests already cover the relevant file exchange, so this is additional assurance rather than a merge requirement.

Score

The implementation addresses the authorized follow-ups, has targeted regression coverage, and has no verified merge blocker in the supplied code. The reported live results and passing current checks support merging within scope.

Score: 8/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 28s
  • Tokens: 97,978 (97,414 in / 564 out)
  • Cost: $0.87

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

integry commented Nov 28, 2026

Copy link
Copy Markdown
Owner

/ultrafix goal=8 max=10

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

propr-dev Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

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

First action: /review

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

@propr-dev

propr-dev Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@integry

integry commented Nov 28, 2026

Copy link
Copy Markdown
Owner

My own review of 4c64cba (beside the ProPR review). One fix, please:

R1 🟠 Vibe's Mistral key isn't added to the Fly run's output redaction. stageCredentials (fly/launch.ts) collects secret values to redact only by parsing a store file as JSON or JSONC. Vibe's store file is .vibe/.env (MISTRAL_API_KEY=…), which isn't JSON, so the parse throws. The catch pushes the content only when file.refresh is set, so the key never reaches the redaction list. The live leak check passed only because Vibe didn't print the key.

  • Fix: when a store file isn't JSON, parse it as dotenv (KEY=value lines, optional export , quoted values). Add every value whose key matches CREDENTIAL_ENV (or CREDENTIAL_KEY) to secrets.
  • Check that the Sprites path (spritesRun.ts) does the same.
  • Add a unit test with a .vibe/.env store whose value then appears in the run output and must come back redacted.

Minor: in fly/launch.ts, if (m.credentialStore) return unsupportedRemoteRunMount(m); return unsupportedRemoteRunMount(m); has the same result on both branches; collapse it.

Checked and fine:

  • Vibe user: '0:0' only for execute runs, with analysis still sandboxed;
  • the wrapper's start-as-root guard;
  • writeReturnedRuntimeFile (allowlisted relative paths, link check, atomic rename);
  • parseJsonc, with string and escape handling;
  • OpenCode provider egress derived from --model, which matches openCodeUtils.ts:147.

@propr-dev

propr-dev Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR extends Vibe and OpenCode to both remote runtimes with shared mount handling, multi-store credentials, usage collection, and smoke-workflow support. No code-level merge blocker was verified from the supplied diff and context.

✅ Credential handling — Both runtimes preserve store identities through materialization and write-back, using the existing credential broker.

✅ Targeted fixes — Vibe execute specs now explicitly start as root; tests cover every agent’s root-start requirement while preserving Vibe’s analysis sandbox.

✅ Leak-check corrections — Fly redaction parses JSONC, and the image scan consumes the export stream while checking export and search failures separately.

Merge readiness still needs the outstanding live verification. The supplied history establishes an OpenCode/Fly success, but does not establish successful remaining combinations or Vibe reaching the accepted billing-error endpoint after this fix. Current checks report 25 passed, 20 skipped, and no failures. This review was static; no commands were run.

Merge blockers

No merge blockers.

Suggestions

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

S6: 🟢 Automate non-root credential synchronization

Consider adding a subprocess regression for the new non-root branch in scripts/opencode-entrypoint.sh: seed credentials, rotate them through a synthetic command, and verify write-back and exit-code preservation. The remote-runtime tests simulate returned credentials rather than exercising that shell branch. This would strengthen coverage; the supplied implementation does not demonstrate a defect requiring it before merge.

Score

The implementation addresses the authorized fixes and has passing current checks. A material gap remains in the required live-runtime evidence, preventing an unconditional merge-ready assessment.

Score: 7/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 53s
  • Tokens: 95,765 (94,775 in / 990 out)
  • Cost: $0.87

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 S6

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 28, 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 10. 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 28, 2026
@propr-dev

propr-dev Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 030adf2

Summary of Changes

I fixed R1 on both runtimes and collapsed the duplicate branch. One part of your diagnosis doesn't quite match the code, though.

Fly was already covered; Sprites wasn't. The broker never copies .vibe/.env to the Machine as a store file. The Vibe store lists .env as a secret-variable file, so the broker reads MISTRAL_API_KEY from it into bundle.secretEnv, and Fly already adds those values to its redaction list. The real gap was on Sprites: its output pipeline was given only the Sprites org token, so a printed Mistral key would have reached the output unredacted. Store credentials, the Vibe key and the run's credential variables were all missing there.

What changed

  • New shared helper (agents/runtime/remoteRunSecrets.ts):
    • A store file is read as JSON/JSONC first.
    • If that fails, it's read as dotenv using the existing python-dotenv-compatible parseDotenv. That covers export , quoted values and comments.
    • Every value whose key matches CREDENTIAL_ENV or CREDENTIAL_KEY goes into secrets. As before, a refreshed token file that isn't JSON is still redacted whole.
    • The helper also holds the credential variable names and the "at least 12 characters, deduplicated" filter. Fly and Sprites now share all of it.
  • fly/launch.ts: uses the helper. unsupportedFlyMount now has a single final return unsupportedRemoteRunMount(m), with the comment kept above it.
  • Sprites: prepareSpriteRun (spritesRun.ts) now builds the same list: the transport token, bundle.secretEnv values (including Vibe's .env key), store-file secrets and the run's credential variables. spritesExecution.ts passes them to the output pipeline.

Tests (test/remoteRunVibeOpenCode.test.ts): Vibe's spec can now put the key only in .vibe/.env (export MISTRAL_API_KEY="…").

  • A full Fly run prints the key, and the captured output comes back redacted.
  • A full Sprites run does the same.
  • A unit test checks the dotenv fallback (export, single and double quotes, an inline comment, a non-secret key left alone) and that JSON parsing and the refresh fallback still work.

With the Sprites pipeline change undone, the new Sprites test fails and the Fly one passes, which confirms where the gap was.

Verification

  • All 13 tests in remoteRunVibeOpenCode pass.
  • These suites pass: flyMachinesRuntime (42), flyMachinesCreateRequest (3), flyDerivedImage (52), flyRuntimePackages (8), spritesRuntime (40), spritesMcpForward (33), spritesNetworkPolicy (12), spritesPool (37).
  • Core typecheck passes, and eslint with zero warnings passes on the changed files.
  • spritesLeaseProvisioning hung twice when I first ran it, once killed at 300 s and once at 120 s. Four later runs with my change all passed its 4 tests in about 2 s, and it also passed against HEAD's versions of the changed files. I didn't find the cause of the hang; since it hasn't come back, I'm treating it as an intermittent stall, not something this change causes.

There's no visual change, so I made no previews.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (4 files)
    • packages/core/src/agents/runtime/fly/launch.ts (+6/−21)
    • packages/core/src/agents/runtime/remoteRunSecrets.ts (added, +60/−0)
    • packages/core/src/agents/runtime/sprites/spritesExecution.ts (+1/−1)
    • packages/core/src/agents/runtime/sprites/spritesRun.ts (+5/−1)
  • Low risk (1 file)
    • test/remoteRunVibeOpenCode.test.ts (+41/−4)

Diff size: 5 files changed, +113/−27 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 18m 14s
  • Tokens: 3,940,764 (3,940,278 in / 486 out)
  • Cost: $1.25

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: 7233427402✓

I fixed R1 on both runtimes and collapsed the duplicate branch. One part of your diagnosis doesn't quite match the code, though.

**Fly was already covered; Sprites wasn't.** The broker never copies `.vibe/.env` to the Machine as a store file. The Vibe store lists `.env` as a secret-variable file, so the broker reads `MISTRAL_API_KEY` from it into `bundle.secretEnv`, and Fly already adds those values to its redaction list. The real gap was on Sprites: its output pipeline was given only the Sprites org token, so a printed Mistral key would have reached the output unredacted. Store credentials, the Vibe key and the run's credential variables were all missing there.

**What changed**
- **New shared helper (`agents/runtime/remoteRunSecrets.ts`):**
  - A store file is read as JSON/JSONC first.
  - If that fails, it's read as dotenv using the existing python-dotenv-compatible `parseDotenv`. That covers `export `, quoted values and comments.
  - Every value whose key matches `CREDENTIAL_ENV` or `CREDENTIAL_KEY` goes into `secrets`. As before, a refreshed token file that isn't JSON is still redacted whole.
  - The helper also holds the credential variable names and the "at least 12 characters, deduplicated" filter. Fly and Sprites now share all of it.
- **`fly/launch.ts`:** uses the helper. `unsupportedFlyMount` now has a single final `return unsupportedRemoteRunMount(m)`, with the comment kept above it.
- **Sprites:** `prepareSpriteRun` (`spritesRun.ts`) now builds the same list: the transport token, `bundle.secretEnv` values (including Vibe's `.env` key), store-file secrets and the run's credential variables. `spritesExecution.ts` passes them to the output pipeline.

**Tests** (`test/remoteRunVibeOpenCode.test.ts`): Vibe's spec can now put the key only in `.vibe/.env` (`export MISTRAL_API_KEY="…"`).
- A full Fly run prints the key, and the captured output comes back redacted.
- A full Sprites run does the same.
- A unit test checks the dotenv fallback (export, single and double quotes, an inline comment, a non-secret key left alone) and that JSON parsing and the refresh fallback still work.

With the Sprites pipeline change undone, the new Sprites test fails and the Fly one passes, which confirms where the gap was.

**Verification**
- All 13 tests in `remoteRunVibeOpenCode` pass.
- These suites pass: `flyMachinesRuntime` (42), `flyMachinesCreateRequest` (3), `flyDerivedImage` (52), `flyRuntimePackages` (8), `spritesRuntime` (40), `spritesMcpForward` (33), `spritesNetworkPolicy` (12), `spritesPool` (37).
- Core typecheck passes, and eslint with zero warnings passes on the changed files.
- `spritesLeaseProvisioning` hung twice when I first ran it, once killed at 300 s and once at 120 s. Four later runs with my change all passed its 4 tests in about 2 s, and it also passed against HEAD's versions of the changed files. I didn't find the cause of the hang; since it hasn't come back, I'm treating it as an intermittent stall, not something this change causes.

There's no visual change, so I made no previews.

PR: #3853
Comment by: @integry (ID: 7233427402)
Model: Claude Opus 5.5

ProPR-Agent: claude/claude-opus-5-5
@propr-dev propr-dev Bot changed the title 🔨 [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites ⚠️❼ [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites Nov 28, 2026
integry pushed a commit that referenced this pull request Nov 28, 2026
integry pushed a commit that referenced this pull request Nov 28, 2026
@integry

integry commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Live verification evidence for the current head 030adf2 (informational, no code changes requested):

Combination Run Head Result
OpenCode × Sprites 46113459254 030adf2 ✅ success (after the Sprites redaction change)
OpenCode × Fly Machines 46090427349 earlier head; Fly path only refactored since ✅ success
OpenCode × Sprites 46100622570 earlier head ✅ success
Vibe × Fly Machines 46101986760 4c64cba (root-start fix) ✅ reached the accepted endpoint: Mistral HTTP 402 billing_payment_failure surfaced; credential install, clone workspace, root start, leak checks with a real key and teardown all passed
Vibe × Sprites 46103175207 4c64cba ✅ same accepted 402 endpoint

The Mistral account billing block is external and accepted as the Vibe endpoint; a full Vibe agent completion isn't possible without it. All four agent × runtime combinations have been exercised live.

integry commented Nov 28, 2026

Copy link
Copy Markdown
Owner

/ultrafix goal=8 max=10

@propr-dev propr-dev Bot changed the title ⚠️❼ [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites 🔨 [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites Nov 28, 2026
@propr-dev propr-dev Bot added the ultrafix label Nov 28, 2026
@propr-dev

propr-dev Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

ℹ️ Analyzed the follow-up request by @integry

Analysis Summary

I made no code changes, since the comment asks for none.

I checked that the head 030adf2 is the commit with the Sprites redaction fix (chore: redact store and Vibe secrets in Sprites run output). Your OpenCode × Sprites run 46113459254 ran on that commit, so the latest code has been tested live on Sprites.

That gives these results for the four agent × runtime combinations:

Combination Run Head Outcome
OpenCode × Fly Machines 46090427349 291a6d8 Full pass
OpenCode × Sprites 46100622570, 46113459254 22681a5, 030adf2 Full pass, including on the current head
Vibe × Fly Machines 46101986760 4c64cba Reached the accepted Mistral 402 billing_payment_failure stop
Vibe × Sprites 46103175207 4c64cba Reached the same accepted 402 stop

Two gaps to note:

  • No Vibe run on 030adf2. That commit added Vibe's Mistral key to the Sprites output redaction. The new unit test prints the key in a full Sprites run and checks that it's redacted. But neither Vibe run has happened since that change. They passed the leak checks only because Vibe never printed the key.
  • No Fly run on the current head. The Fly path has only been refactored since 291a6d8 (it now uses the shared secrets helper), and unit tests cover it.

The "Before merge" section of the PR description still asks for the run links. I haven't edited the description; you can paste the table above into it.

There's no visual change, so there are no previews.

No code changes were necessary based on the current state of the branch.


🤖 Analysis Details

  • Model: Claude Opus 5.5 (medium)
  • Time: 3m 23s
  • Tokens: 97,352 (96,564 in / 788 out)
  • Cost: $0.23

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: 7235024561✓

@propr-dev

propr-dev Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor Author

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

First action: /review

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

@propr-dev

propr-dev Bot commented Nov 28, 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 28, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

Ready to merge within the effective scope. The changes extend both remote runtimes using existing run specifications and credential-broker contracts. The implementation and follow-up fixes are proportionate to the requested work.

✅ Credential handling — Multiple stores retain separate write-back identities, and both runtimes collect redaction values from JSON, JSONC, dotenv and credential environment variables.

✅ Launch prerequisites — Vibe execute runs now start as root, preserve the privilege drop, and have regression coverage alongside every other agent type. Analysis retains its separate sandbox.

✅ Smoke verification — The workflow checks export and search failures separately, detects failed tasks while awaiting PRs, and verifies teardown. The supplied live evidence covers all four combinations, with Mistral’s billing failure explicitly accepted as Vibe’s endpoint.

The authoritative checks report 25 passed, 22 skipped and no failures or pending checks. This review used the supplied code and evidence; no commands were run.

Merge blockers

No merge blockers.

Suggestions

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

S7: 🟢 Automate non-root credential synchronization

Add a shell-level regression for the new non-root branch in scripts/opencode-entrypoint.sh: run a command that changes a seeded credential and exits nonzero, then verify both write-back and exit-status preservation. The supplied runtime tests exercise broker exchange using fake runtimes, while the implementation summary reports manual entrypoint verification. Automating that existing verification would help prevent regressions; it is optional for this merge.

Score

The supplied diff satisfies the amended objective, with targeted regression coverage, passing current checks and accepted live verification. No merge-blocking defect was established.

Score: 9/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 48s
  • Tokens: 97,064 (96,088 in / 976 out)
  • Cost: $0.90

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

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 28, 2026
@propr-dev propr-dev Bot changed the title 🔨 [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites ✅❾ [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites Nov 28, 2026
@integry
integry merged commit d69bd48 into 3758-epic-runtime-abstraction-sc0 Nov 28, 2026
50 checks passed
@propr-dev propr-dev Bot changed the title ✅❾ [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites [3838 by Claude Opus 5.5] Run Mistral Vibe and OpenCode on Fly Machines and Sprites Nov 28, 2026
propr-dev Bot pushed a commit that referenced this pull request Nov 28, 2026
I fixed the Validate Changes failure. The only problem was the Core Package Lint file-length limit: the merge from #3853 left `packages/core/src/agents/runtime/sprites/spritesProvisioning.ts` at 401 code lines, one over the 400 maximum.

**Fix:** I moved the separate `export type { Slot };` line into the existing export, which is now `export { startupStep, SpritePoolCapacityError, type Slot };`. No behaviour changes.

**Checks:** `npm run lint` in `packages/core` now passes with no warnings, and `tsc --noEmit` for core is clean.

**Separate failure on this commit:** the full test suite comment also reports `test/spritesLeaseProvisioning.test.ts` hitting the 180s timeout in shard 4. You didn't ask me to fix that and I made no change for it. When I ran that file on its own here, all 4 tests passed in about 2s, so it doesn't fail on its own in this container. If it shows up again in CI, it should be looked at separately.

PR: #3865
Comment by: @propr-dev[bot] (ID: 7236051545)
Comment by: @github-actions[bot] (ID: 7236051747)
Model: Claude Opus 5.5

ProPR-Agent: claude/claude-opus-5-5
propr-dev Bot pushed a commit that referenced this pull request Nov 28, 2026
I fixed the shard 4 failure, and the test now passes locally (10/10 subtests).

**Cause:** in run 46198702192 the only failing file was `test/agentRunSpecStartsAsRoot.test.ts`. That test was added in #3853 and has to cover every agent type. The `pi` agent type, added in #3847, landed on this branch through the epic merges, and nobody added a `pi` case to the test. So two subtests failed:
- "every agent type has a task spec case" failed because the list had no `pi`.
- "pi: the task spec starts as root…" crashed because the `pi` case didn't exist.

**Fix (test only, in `test/agentRunSpecStartsAsRoot.test.ts`):** Pi doesn't build a run spec at all. It starts its own `docker run --user 0:0`, so it can't run on Fly Machines or Sprites and the remote-runtime "starts as root" check doesn't apply to it. I split Pi out as a Docker-only agent type:
- The existing run-spec checks now cover every type except `pi`.
- Pi gets its own case that builds its real task Docker arguments and checks that they start as root.
- The coverage check still requires every agent type to appear in one list or the other, so a new agent type fails until someone adds a case for it.

The earlier comment about `test/spritesLeaseProvisioning.test.ts` timing out at 180s came from an older run. In this run it didn't fail, and it passes locally in about 4s. I made no change for it; if it shows up again, it's most likely runner contention rather than code.

This is a test-only change with nothing to see on screen, so there are no previews.

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

ProPR-Agent: claude/claude-opus-5-5
integry pushed a commit that referenced this pull request Nov 29, 2026
… paste credentials + interactive login on the remote runtime (#3865)

* feat: add pasted agent credentials and remote-runtime login

I've implemented all three parts of #3863, but none of the live acceptance runs on a Fly-launched instance have happened, so there are no run links for the PR yet. The new tests pass: 311 server-side tests across the touched suites and 12 UI tests. Typecheck, lint (zero warnings) and the OpenAPI check are clean.

1. Pasted credentials (works on every runtime, including Docker)
- The agent dialog has a third setup option, Paste a key or token. Editing a saved agent shows the same section.
- Claude: an Anthropic API key or a `claude setup-token` token. Either goes into `settings.json` under `env` as `ANTHROPIC_API_KEY` or `CLAUDE_CODE_OAUTH_TOKEN`. Saving one removes the other, and other settings are kept.
- Codex: an OpenAI API key, written to `auth.json` the way `codex login --with-api-key` does it, or a pasted `auth.json`.
- OpenCode: a pasted `auth.json`, stored in its data directory.
- Each option links to where the key or token comes from.
- Values are write-only. The dialog and the new `GET/PUT/DELETE /api/agents/:id/credentials` endpoints only report "set" plus the last 4 characters. Remove deletes a value.
- Files are written atomically with mode 0600, under the same store lock the runs use.
- I added redaction patterns for these key formats and for secrets inside the JSON files, with a case in `test/redactSecrets.test.ts`.
- Vibe keeps its existing Mistral key field, which the API already redacts. I didn't touch the stores #3853 changes.

2. Interactive login on the remote runtime
- This applies when the agent runs on Sprites or Fly Machines and there's no local Docker. "No Docker" means neither `DOCKER_HOST` nor `/var/run/docker.sock` is present.
- Sprites: the login takes a Sprite from the normal pool, so it counts against `PROPR_SPRITES_MAX`. It runs the login CLI with a TTY, and the Sprite is always deleted afterwards, never returned to the pool.
- Fly Machines: the login starts a short-lived `propr-login-*` Machine from `PROPR_FLY_IMAGE`, holding a `PROPR_FLY_MACHINES_MAX` slot. Fly's API has no interactive console, so output and keystrokes go through its exec API, polled about once a second. If ProPR crashes, the Machine ends the CLI and destroys itself.
- On success, the login files the provider manifest declares are copied into the agent's credential store, then the Sprite or Machine is destroyed.
- If no slot frees up within 30 seconds, or Fly's organization machine limit is hit, the login fails with a message naming the cap.
- Provisioning a new Sprite takes a few minutes. The dialog streams progress meanwhile.

3. Health check by runtime
- For agents on Sprites or Fly Machines, the check no longer touches a local Docker image or starts a test run. It checks three things: the runtime token is accepted, the CLI version (Sprites) or agent image (Fly) resolves, and the agent has a stored credential.
- Failures now show Agent runtime unavailable or an auth error, never "Agent image preparation failed".
- Docker instances behave as before.

Things to know
- The API process needs `PROPR_SPRITES_TOKEN` or the `PROPR_FLY_*` variables. They're already shared on a `propr deploy fly` instance, since the API and worker run in the same container.
- Interactive login on Sprites covers the agents Sprites runs today (Claude, Codex, Antigravity). OpenCode becomes available there once #3853 adds it.
- To stay under the file-length limit, I moved the terminal-output sanitizer, the Docker helpers and the login routes into separate files. The OpenAPI spec was regenerated.

Docs: `setup-fly.md` has a new "Agent credentials" section. `agents-and-models.md` describes pasting credentials and interactive login without Docker.

Still needed before merge: the live runs on a Fly-launched instance — (a) an `AI` issue to a PR with a pasted key on both Sprites and Fly Machines, (b) the interactive Claude login on Sprites followed by a run, and (c) a healthy agent card. Previews of the dialog and agent cards were taken against a mocked API.

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

* chore: move Docker process helpers out of agentLoginDocker

I fixed the Shard 2/4 failure; it was caused by this PR's code, not by flakiness. The failing test file now passes.

**Cause:** `test/agentRoutesOpenCodeDiscovery.test.ts` replaces `child_process` with a mock that only provides `execFile`. This PR gave `agentRoutes` a new import chain: `agentCredentialStore` → `agentLoginDocker.ts`. When I moved the Docker helpers into `agentLoginDocker.ts`, that file started importing `spawn` from `node:child_process`. Under the mock, `spawn` doesn't exist, so the test file failed to load:

```
SyntaxError: The requested module 'node:child_process' does not provide an export named 'spawn'
```

**Fix:** I changed the source rather than adding `spawn` to the test's mock.
- `defaultRunDocker`, `defaultSpawnDocker` and `DockerCommandResult` now live in a new file, `packages/api/services/agentLoginDockerProcess.ts`.
- `agentLoginDocker.ts` no longer imports `child_process`. It keeps only the path and image resolution, which is all the credential store needs.
- `agentLoginSessionManager.ts` imports the Docker helpers from the new file. Its exports are unchanged.

**Checks run:**
- `agentRoutesOpenCodeDiscovery`, `remoteAgentLogin` and `agentRemoteCredentials`: all pass.
- The six other suites that touch agent login: all pass, including `agentLoginRoutes`, `routeAuthorization` and `agentDefaultConfigPaths`.
- `tsc` for `packages/api` and zero-warning ESLint on the three changed files: clean.

I didn't rerun the full shard locally. There's no visual change, so I didn't make previews.

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

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

* chore: harden agent credential writes and runtime readiness checks

I fixed all four findings (F1–F4) and added a regression test for each. I put the HEAD versions of the API services back temporarily, and the new F1, F2 and F3 tests failed against them. With the fixes, the touched suites pass: 17 core tests and 61 API tests. Typecheck and lint pass with zero warnings.

**F1: credential edits now read and merge inside the lock**
- `writeCredentialStoreFiles` (`credentialStoreWriter.ts`) now also accepts a function that computes the files to write. It runs while holding the store lock, and the symlink and size checks run there too.
- `rewrite` in `agentCredentialStore.ts` now reads `settings.json` and merges into it inside that function, so a PUT and a DELETE that overlap each build on the other's result.
- `storeReturnedLoginFiles` writes whole login files and doesn't merge, so it didn't have this bug.
- **Tests:** a core test runs two overlapping merges. An API test makes a real PUT (swap the API key for an OAuth token) and DELETE (remove the API key) wait on a busy lock at the same time. The result keeps the new token, removes the key, and keeps an unrelated `model` setting.

**F2: a cancelled login can no longer save credentials**
- The writer takes an optional cancellation signal. It checks it before waiting for the lock, and again inside the lock just before writing.
- That signal is the one cancel and timeout already abort. It now reaches the writer through the session manager, `collectRemoteLoginFiles` and `storeReturnedLoginFiles`. Collection also checks it between file reads.
- For OpenCode, which writes to two stores, the check runs under each store's lock.
- After collection, `runRemoteLoginSession` checks whether the session has already ended. If so, it reports neither "Saved…" nor "Could not save…" and leaves the cancelled or timed-out status as it is.
- **Tests:**
  - A login is cancelled while its collection waits on a busy lock: nothing is written, the status stays cancelled, and the runtime is closed once.
  - Collection with an already-aborted signal stores nothing.
  - A write aborted while waiting for the lock publishes nothing.

**F3: Antigravity's stored login is now checked**
- `remoteCredentialProblem` no longer depends on whether a provider supports pasted credentials. It checks the provider's login files from the credential manifest, plus pasted credentials where those are supported.
- An Antigravity agent without `antigravity-cli/antigravity-oauth-token` now reports `auth_required`, with a login-only message, since it has no paste option.
- **Test:** the missing-login case, then the ready case once the file is stored.

**F4: Fly readiness now resolves the image**
- New `fly/imageResolution.ts`. Images on `registry.fly.io` are resolved with the Fly token (through the existing `FlyRegistry`), down to the linux/amd64 manifest.
- Images on other registries are resolved anonymously, the same way Fly would pull them without credentials. The Fly token is never sent outside `registry.fly.io`.
- `flyReadiness` calls this after the Machines list succeeds. A failure returns not-ready, which shows on the card as `runtime_unavailable`. A 404 says the image doesn't resolve, and a 401 or 403 says access was refused.
- **Tests:**
  - Image resolution is required before Ready.
  - A 404 or 403 makes the agent not ready.
  - Image references parse correctly.
  - A fake registry checks the Fly-token path and the anonymous path, including that the Fly token never reaches another registry.

**Not fixed: unavoidable timing gaps.**
- A cancel that arrives after the in-lock check has passed can't stop a write that is already happening.
- For OpenCode's two stores, a cancel between the two writes can leave the first store written.

These come down to the filesystem having no atomic cross-store write, not stale state.

There's no visual change, so I didn't capture previews.

PR: #3865
Comment by: @integry (ID: 7232932164)
Model: Claude Opus 5.5

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

* fix: protect settings.json on read failure; clear key on login

I fixed F5 and F6. All 19 tests in `packages/api/test/agentRemoteCredentials.test.ts` pass, including 3 new ones, and so do the 17 in `test/remoteAgentLogin.test.ts`. Core and API typecheck clean and lint shows zero warnings. All 3 new tests fail when run against the previous `agentCredentialStore.ts`.

**F5: a failed read no longer wipes existing settings**
- Saving or removing a pasted credential now uses a strict reader (`strictRead` in `packages/api/services/agentCredentialStore.ts`), still under the store lock. A missing file still counts as empty. Any other read failure, such as an oversized `settings.json`, now stops the request with a 400: "The existing settings.json could not be read, so it was left unchanged". Before, the failure was treated as an empty file and the settings were overwritten.
- The tolerant reader is now used only for status reporting (`readAgentCredentialStatus` and `remoteCredentialProblem`).
- New test: with an oversized `settings.json`, both a save and a remove are refused, the file is byte-for-byte unchanged, and the status still reads.

**F6: interactive login now replaces a pasted key or token**
- A new core helper, `withoutPastedClaudeAuthentication` in `pastedCredentials.ts` (exported from `@propr/core`), takes `ANTHROPIC_API_KEY` and `CLAUDE_CODE_OAUTH_TOKEN` out of `settings.json` and keeps everything else.
- When `storeReturnedLoginFiles` saves a Claude login, it rewrites `settings.json` in the same locked write as `.credentials.json`. The new login and the removal of the old key land together, and the existing cancellation check before publishing still covers both.
- If `settings.json` can't be read, nothing is saved and the login reports "Could not save the login". Otherwise the old key could still override the new login.
- New tests:
  - Switching from a pasted key to an interactive login removes the key and keeps the other settings (`model`, other env vars). The status then shows no pasted credential, only the stored login.
  - When `settings.json` can't be read, the login stores no `.credentials.json` and leaves `settings.json` unchanged.

Codex and OpenCode don't have this problem, because their login file (`auth.json`) is the same file the pasted credential lives in, so a login replaces it.

**Not fixed: the same F6 conflict exists for Docker logins.** On a Docker instance, the CLI writes `.credentials.json` straight into the bound config directory, and the session is marked successful when the container exits. Nothing removes a previously pasted key from `settings.json`, so it can still override the new login. That code path wasn't part of the requested fix. Fixing it would mean adding a locked settings cleanup to the Docker success handler in `agentLoginSessionManager.ts`.

I made no previews because nothing in the UI changes.

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

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

* test: wait for logger startup before faking timers in sprites test

Shard 4 failed because one test file, `test/spritesLeaseProvisioning.test.ts`, hung after it had already passed. It ran all four of its subtests in under a second, then never exited, and the runner killed it at the 180s limit. This PR's code didn't cause it: the file is unchanged on this branch, and the hang is a known flake in how the test sets up its fake clock.

**Cause:** the test swaps in a fake `setTimeout` clock. The logger's background thread sometimes finishes starting while that fake clock is active. A timer it sets during startup lands on the fake clock and is thrown away when the test cleans up. The thread then stays open and keeps the process alive. It's timing-dependent, so it happens more often on a busy CI host.

**Fix:** the test now waits for the logger to finish starting before it turns on the fake clock. This is a copy of the fix in the still-open PR #3868, which hit the same flake. Because the change is byte-for-byte the same, the two branches will merge cleanly whichever lands first. Only `test/spritesLeaseProvisioning.test.ts` changed, with 9 lines added and 1 changed.

**Verification:** the file passed 10 out of 10 times through `scripts/run-test-suite.mjs`, with all 10 running in parallel to add load. I can't fully confirm the fix locally, because before the change the file also passed when run alone, so the real test is the next CI run.

There's no visual change, so I didn't make any previews.

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

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

* chore: keep other Codex credential on remove; wait for Fly capacity

I fixed F7 and F8 and added regression tests for both. I couldn't do F9: it needs live runs on a Fly-launched instance, which this container can't reach. Both touched test suites pass (20/20 each), and typecheck and zero-warning lint are clean for the changed core files.

### F7 — Removing one Codex kind no longer deletes the other
In `packages/core/src/agents/credentials/pastedCredentials.ts`, both Codex kinds still go through `removePastedCredential`. That runs on the current `auth.json`, read under the store lock. It now checks which kind the file actually holds:
- **Kind not in the file** (a newer save replaced it): nothing changes, so a stale Remove keeps the replacement.
- **Only that kind in the file:** the file is deleted, as before.
- **File holds both** (key and ChatGPT tokens): only the removed one goes.

This also protects a ChatGPT `auth.json` written by an interactive Codex login, which lands in the same file. Claude kinds already removed only their own variable, and OpenCode has a single kind, so neither had this bug.

**Tests:** a unit test in `test/remoteAgentLogin.test.ts` covers both directions, a missing file and the file holding both. An API-level test in `packages/api/test/agentRemoteCredentials.test.ts` saves a key, replaces it with a ChatGPT `auth.json`, removes the old key, and checks the login survives and the agent still counts as having credentials.

### F8 — Fly login now waits for real capacity
In `packages/core/src/agents/runtime/fly/flyLogin.ts`, the one-shot check that failed immediately is replaced by a wait:
- It rechecks Fly's live Machine count every 2 seconds.
- It shares one 30-second deadline with the in-process slot wait, so the total wait still can't exceed 30 seconds.
- The terminal shows "All N Fly Machines are in use; waiting up to 30s…".
- When the deadline passes, the error names `PROPR_FLY_MACHINES_MAX` and the wait time.
- If the user cancels during the wait, the login is cancelled rather than reported as a capacity error.

The Sprites login already retries against its pool inventory until the same 30-second limit, so it needed no change.

**Tests:** the old "full capacity" test expected an immediate failure; it now checks that the login waits the full period and rechecks. Two new tests cover a Machine freed by another process during the wait (the login then starts) and cancelling during the wait.

There is still a short window between a capacity check showing a free Machine and the create call, where another process can take it. That race between separate processes and Fly's API can't be closed. When Fly refuses the create at its organisation limit, the login still fails with the existing capacity message.

### F9 — Live acceptance runs: still to do
These runs still have to happen before merge, on a Fly-launched instance running this branch:
- An `AI` issue taken to a PR with a pasted key, on both Sprites and Fly Machines.
- An interactive Claude login on Sprites, followed by a run.
- An agent card showing healthy.

No run links or healthy-card evidence exist yet, and the existing tests run against mocked Fly and Sprites APIs, so they don't stand in for these runs.

No visual previews were captured, since neither fix changes what's on screen.

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

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

* chore: merge Slot type export to fit spritesProvisioning line limit

I fixed the Validate Changes failure. The only problem was the Core Package Lint file-length limit: the merge from #3853 left `packages/core/src/agents/runtime/sprites/spritesProvisioning.ts` at 401 code lines, one over the 400 maximum.

**Fix:** I moved the separate `export type { Slot };` line into the existing export, which is now `export { startupStep, SpritePoolCapacityError, type Slot };`. No behaviour changes.

**Checks:** `npm run lint` in `packages/core` now passes with no warnings, and `tsc --noEmit` for core is clean.

**Separate failure on this commit:** the full test suite comment also reports `test/spritesLeaseProvisioning.test.ts` hitting the 180s timeout in shard 4. You didn't ask me to fix that and I made no change for it. When I ran that file on its own here, all 4 tests passed in about 2s, so it doesn't fail on its own in this container. If it shows up again in CI, it should be looked at separately.

PR: #3865
Comment by: @propr-dev[bot] (ID: 7236051545)
Comment by: @github-actions[bot] (ID: 7236051747)
Model: Claude Opus 5.5

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

* chore: accept OpenCode and Vibe in Sprites and Fly health checks

I fixed F10: the Sprites health check now accepts OpenCode and Vibe agents. It no longer reports "Agent runtime unavailable" for providers Sprites actually runs.

**What was wrong:** the health check kept its own list of the providers Sprites runs (Claude, Codex, Antigravity). `SpritesRuntime` uses a longer list that also has Vibe and OpenCode. Because the check rejected those two before looking at the token or the CLI version, a valid setup could never pass.

**The fix:**
- **One shared list:** the Sprites provider list now lives in one exported constant, `SPRITES_AGENT_TYPES` in `packages/core/src/agents/runtime/sprites/spritesCliVersions.ts`. Runs, interactive logins and the health check all use it, so they can't drift apart again. OpenCode and Vibe now go through the same pinned CLI version check as the others.
- **Same bug on Fly Machines:** while checking related code I found the Fly Machines health check had the same problem. It hardcoded Claude and Codex, but the Fly runtime also runs Vibe and OpenCode. It now uses the same rule the Fly runtime uses (`isRemoteAgentType`), so Vibe and OpenCode agents there no longer show as unavailable either.

**New tests** in `test/remoteAgentLogin.test.ts`:
- **OpenCode and Vibe on Sprites:** each is ready on its pinned CLI version and reports that version. A missing token or a non-pinned CLI version is still refused.
- **Matching the runtimes:** for every provider, Sprites and Fly Machines readiness must agree with what each runtime itself accepts. Antigravity is still refused on Fly.

**Verification:**
- The new tests failed on the old code and pass now (22 of 22 in the file).
- `test/spritesRuntime.test.ts` and `test/spritesPool.test.ts` still pass (77 of 77).
- The core typecheck and zero-warning lint on the changed files are clean.

There's no visible UI change, so I didn't make previews.

**Found but not changed (outside F10):** the interactive login on Fly Machines still only accepts Claude and Codex (`flyMachinesRuntime.ts:62`). That limit matches the PR description, so I left it alone.

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

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

* chore: recognize Vibe and OpenCode credentials in remote health check

F11 is fixed. The remote health check now recognizes the credentials Vibe and OpenCode runs actually use, so an agent set up that way shows **Ready** instead of `auth_required`. The new and updated tests pass, typecheck and lint (zero warnings) are clean, and none of this was run on a live Sprites or Fly instance.

**What the check now counts as a credential**

- **Vibe:**
  - A `.env` file in its config directory with a non-empty `MISTRAL_API_KEY`. This is read through the provider manifest, the same way the broker extracts it for a run.
  - `MISTRAL_API_KEY` in the agent's env vars, in ProPR's own environment, or in the Mistral key setting. If settings can't be read, they add no key, as at run time.
  - The config directory is found the way a Vibe run finds it: `VIBE_CONFIG_PATH` first, then the saved path. Paths the login resolver refuses, such as a custom `~/…` path, no longer cause a false failure.
- **OpenCode:**
  - A provider with a non-empty `options.apiKey` in `opencode.json`, `opencode.jsonc` (comments and trailing commas allowed) or `config.json`.
  - A provider key variable (`*_API_KEY` or `*_TOKEN`) among the agent env vars that ProPR passes to the run. GitHub tokens are not counted.

**One addition beyond the two named sources:** an OpenCode agent that offers one of the built-in free models now passes the check with no credential at all. The docs say these models need no login, and the Docker health check already reports such an agent as ready. Without this, the remote check would still have reported it as `auth_required`.

**Code changes**

- The file checks are in a new core module, `packages/core/src/agents/credentials/configuredCredentials.ts`.
- `remoteCredentialProblem` in `packages/api/services/agentCredentialStore.ts` is now async, because it may read settings. `agentHealthCheck.ts` awaits it.
- The health-check sentence in `docs/docs/features/agents-and-models.md` now lists these sources.

**Tests:** I added `packages/api/test/agentRemoteCredentialSources.test.ts` with 8 cases. They cover each source above, blank keys still failing, `VIBE_CONFIG_PATH`, the refused `~/…` path, and a full health check returning **Ready** for Vibe with only `.env` and OpenCode with only its config-file key. All 8 fail when run against the previous code. These tests, the existing credential and health-check suites, the OpenCode discovery route test and the redaction test all pass: 132 tests in total.

There are no visual changes, so I made no previews.

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

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

* chore: keep operator credential changes from active runs on write-back

I fixed both findings, and each new regression test fails without its fix and passes with it.

**F12: active runs can restore removed credentials**
- Every write through the store writer (paste, Remove, and the files from an interactive login) now records which paths it changed, under the store lock and before the files are published. The record is a small file in the store, `.propr-operator-mutations.json` (new `packages/core/src/agents/credentials/operatorMutations.ts`). It is published the same way as the credentials, so a writer whose lock was taken over can't roll it back.
- The broker reads that record before it copies the store for a run. At write-back, under the lock, a path changed since the run was staged gets the new outcome `kept-operator-change`. The run's copy then can't overwrite a replacement, even with a later refresh time, and can't recreate a removed file.
- What stays the same:
  - A run whose copy still matches the current file writes back as before (`written`).
  - Between runs racing each other, the most recent refresh still wins.
  - A change to a different file in the store doesn't block the run.
- If the record can't be read, every path counts as changed, so the check fails closed. The next change replaces the bad record.
- The Docker, Sprites and Fly runs all go through this broker, so all three are covered.
- Tests:
  - `test/agentCredentialBroker.test.ts` covers: Codex remove, Codex account replacement with a later refresh time, OpenCode remove, runs staged after a change, the unchanged-copy case, and an unreadable record.
  - `packages/api/test/agentCredentialOperatorMutations.test.ts` runs the real paste and Remove functions against a run staged earlier.

**F13: Fly rejects supported OpenCode logins**
- `FlyMachinesRuntime.startLogin` now uses `flyLoginSupported`: an agent type Fly Machines runs that also has an interactive login. That gives Claude, Codex and OpenCode, and replaces the hard-coded `['claude', 'codex']` list.
- Antigravity is still refused before any Machine is created.
- Tests:
  - `test/remoteAgentLogin.test.ts` checks that the Machine runs `opencode auth login` and creates both the config and data directories.
  - The new API test runs a full login session through a real `FlyMachinesRuntime` with a fake Machines API. It checks that the session succeeds, the Machine is destroyed, and OpenCode's `auth.json` ends up in the agent's data store.

**Docs:** one sentence in `agents-and-models.md` saying Remove, replace and a new login also hold for runs already in progress.

**Checks run:**
- The root credential, Fly, Sprites, redaction and remote-login suites pass.
- The API agent login, credential and health-check suites pass: 78 pass, 0 fail, after rebuilding shared and core.
- Core and API typecheck are clean, and lint shows zero warnings on the changed files.

**Not covered (separate, existing behaviour):** runs that mount the store directly rather than through the broker write to the real file themselves, so this check can't stop them. That happens with `PROPR_AGENT_CREDENTIAL_BROKER=legacy`, or by default when the worker can't write the store. I left that alone.

The change has nothing visible in the UI, so I made no previews.

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

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

* chore: fence stale runs and clear pasted Claude key on Docker login

I fixed both findings. Each new regression test fails on the old code and passes now. Lint (zero warnings), the core and API typechecks, the 187 tests in the credential and login suites, and 87 Sprites/Fly runtime tests all pass.

**F14: run staged during an operator change overwrites the replacement**
- **Change:** the mutation record is now published in two steps, both under the store lock. The new tokens go out with the paths marked "pending" before any file is published. The mark is cleared once the writer stops publishing, whether it succeeded or failed. A run that stages while a path is pending always counts as staged before that change. So if its copy no longer matches the store, its refreshed token is kept out rather than winning on recency. Runs stay lock-free and synchronous, so a read-only store still stages. The changes are in `operatorMutations.ts`, `credentialStoreWriter.ts` and a comment in `broker.ts`.
- **Crash case:** if a writer dies mid-publication, its mark stays. Runs on that path then lose the recency rule until its next operator change completes. That keeps the operator's change, at the cost of the old run-vs-run behaviour for that path.
- **Tests:** two new cases in `test/agentCredentialBroker.test.ts`:
  - A run is staged in the exact window from the finding: new record, old `auth.json`. The replacement is kept, and a run staged afterwards writes back normally.
  - A mark left by a dead writer keeps fencing until the path's next change clears it, and then recency between runs works again.
- **Old code:** run with only a test hook added, it returns `written-newer`, meaning the old account overwrote the replacement.

**F15: pasted Claude key survives a Docker login**
- **Change:** when a Docker login container exits 0 for Claude, the session runs the same locked `settings.json` cleanup as the remote login before reporting success. Other settings are kept.
  - A failed login leaves the pasted key in place.
  - So does a login cancelled or timed out while the cleanup waits for the lock.
  - If the cleanup fails, the login is reported as failed ("Could not save the login: …").
  - Other agent types still finish immediately, as before.
- **Tests:** three cases in `packages/api/test/agentCredentialOperatorMutations.test.ts`: success, failure, and cancel while waiting for the lock. On the old code, the pasted key survived the successful login.
- **Line limit:** `agentLoginSessionManager.ts` was already at 397 of the 400-line limit. I moved two Docker helpers (image pull and orphan sweep) unchanged into `agentLoginDocker.ts`.
- **Docs:** I added one sentence to `agents-and-models.md`: a successful Claude login removes a pasted key or token on every runtime, and a failed or cancelled login leaves it.

One race can't be avoided: a cancel that arrives just after the cleanup published reports "cancelled" even though the key was removed. The remote login has the same race.

**Two related problems I found but didn't fix (outside F14/F15):**
1. **A Docker login isn't recorded as an operator change.** The container writes the login files straight into the store, and no mutation token is recorded for them. A run staged before a Docker login can still overwrite the new login with its newer refresh. After this fix only `settings.json` gets a token. Remote logins go through the writer and are covered.
2. **Removal isn't fenced by the lock.** When the writer deletes a file, it calls `fs.rmSync` directly instead of going through the lock's publication directory. A writer whose lock was taken over as stale can therefore still delete a file afterwards, including the next writer's replacement. File contents and the mutation record are fenced; removals are not.

The changes are server-side only, so there are no visual previews.

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

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

* chore: redact OpenCode secrets and lease credential removals

I fixed both findings, F16 and F17, and added a regression test for each. Each new test fails against the branch's previous code and passes now.

**F16: OpenCode secrets are now redacted** (`packages/core/src/utils/secretRedaction.ts`)
- I added two patterns that redact the values of `key`, `refresh`, `access` and `token` inside an OpenCode `auth.json` entry. `token` holds the second secret in OpenCode's `wellknown` entries, so I included it as part of the same defect.
- They only fire inside an object that also has a `"type"` field, whether `type` comes before or after the secret. Pasted documents keep the operator's field order, so both have to work. Limiting them this way stops a plain `"key"` or `"access"` field elsewhere in a log from being redacted.
- **Test** (`test/redactSecrets.test.ts`): uses opaque values for `oauth`, `api` and `wellknown` entries, both compact and in the stored two-space layout. It also checks that an unrelated `key`/`access` document passes through unchanged.

**F17: a removal can no longer delete a successor's credential** (`packages/core/src/agents/credentials/credentialStoreWriter.ts`)
- Removal now goes through the lease, the same way replacements do. The writer creates a directory inside its publication directory, moves the file into it, then deletes it there.
- After a stale takeover, that publication directory has been moved away, so the move fails with `CredentialStoreLeaseRevokedError` and the successor's file stays. A file that is already missing still counts as removed.
- Removals are refused for directories, the same as the old direct delete.
- **Test** (`test/agentCredentialStoreLockMultiprocess.test.ts`, new fixture `test/fixtures/credentialStoreWriterContender.ts`): a removal process records its pending mutation and is then suspended. A second process takes over the stale lock and publishes a replacement, then the first resumes. The test checks that:
  - the replacement survives.
  - the removal fails as taken over.
  - the pending mark is cleared.
  - no publication or removal directory is left behind.

  Against the old code, the successor's `auth.json` was deleted.
- **Other deletions checked:** this was the only deletion of a canonical store file in the PR. The broker's write-back never deletes, and the other deletions in the credential staging code only remove per-run copies.
- **Remaining race:** a removal that completes before the takeover revokes its lease simply happens before the successor's write, which is the correct order. There's no avoidable gap left.

**Verification:** I ran the credential lock, broker, remote-login, redaction and tool-policy suites, plus the API `agentRemoteCredentials` suite after rebuilding the core package. All tests passed. Core typecheck and lint on the changed files are clean with zero warnings. No visual previews: nothing here changes what users see.

**Found separately, not changed:**
- If the lease is revoked between preparing a replacement file and renaming it into place, the writer's replacement path throws a raw `ENOENT` rather than `CredentialStoreLeaseRevokedError`. Nothing in the store changes; only the error type is inconsistent with the broker, which converts it.
- When a log entry is redacted as an object rather than as text, only the string values are checked, so no rule that relies on field names applies, including the existing Claude/Codex one. This predates the PR.

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

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

* fix: fix lint limits in agent config modal and login session manager

I fixed both lint failures that broke Validate Changes. `eslint . --max-warnings 0` now passes in both `propr-ui` and `packages/api`.

**UI: complexity 22, limit 20 (`AgentConfigModal.tsx`)**
- I moved two conditions out of the component into helpers in `agentCredentialSetupUtils.ts`:
  - `showsPastedCredentials(type, isEditing, credentialSetup)` decides when the "Paste a key or token" section shows. The form section and the submit path now both use it.
  - `storedCredentialAgentId(agent, type)` returns the saved agent's id only while its type hasn't changed.
- Defining the helpers inside the modal file pushed it to 403 lines, over the 400-line limit, which is why they're in the utils file.

**API: 404 lines, limit 400 (`agentLoginSessionManager.ts`)**
- In `write()`, the remote and local branches each repeated the same input check, timestamp update and timeout reset. I merged them into one path that writes to the remote runtime or to the container's stdin.
- Behaviour is unchanged: the same errors are thrown in the same order for both kinds of login.

**Checks**
- The UI typecheck is clean.
- The 44 SettingsPage UI test files pass (425 tests).
- The 4 API test files that exercise the login session manager all pass: `agentLoginRoutes`, `agentLoginPi`, `agentRemoteCredentials` and `agentCredentialOperatorMutations`. I ran them through the repo's test runner after rebuilding `shared` and `core`.

This is a code-only change with nothing visible, so there are no previews.

PR: #3865
Comment by: @propr-dev[bot] (ID: 7246900062)
Comment by: @github-actions[bot] (ID: 7246900152)
Model: Claude Opus 5.5

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

* test: cover Pi as Docker-only agent in starts-as-root test

I fixed the shard 4 failure, and the test now passes locally (10/10 subtests).

**Cause:** in run 46198702192 the only failing file was `test/agentRunSpecStartsAsRoot.test.ts`. That test was added in #3853 and has to cover every agent type. The `pi` agent type, added in #3847, landed on this branch through the epic merges, and nobody added a `pi` case to the test. So two subtests failed:
- "every agent type has a task spec case" failed because the list had no `pi`.
- "pi: the task spec starts as root…" crashed because the `pi` case didn't exist.

**Fix (test only, in `test/agentRunSpecStartsAsRoot.test.ts`):** Pi doesn't build a run spec at all. It starts its own `docker run --user 0:0`, so it can't run on Fly Machines or Sprites and the remote-runtime "starts as root" check doesn't apply to it. I split Pi out as a Docker-only agent type:
- The existing run-spec checks now cover every type except `pi`.
- Pi gets its own case that builds its real task Docker arguments and checks that they start as root.
- The coverage check still requires every agent type to appear in one list or the other, so a new agent type fails until someone adds a case for it.

The earlier comment about `test/spritesLeaseProvisioning.test.ts` timing out at 180s came from an older run. In this run it didn't fail, and it passes locally in about 4s. I made no change for it; if it shows up again, it's most likely runner contention rather than code.

This is a test-only change with nothing to see on screen, so there are no previews.

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

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

* chore: reject OpenCode auth.json pastes without a credential

F18 is fixed: an OpenCode `auth.json` with no actual credential in it is now refused, the working file stays in place, and the agent is no longer reported as having credentials or shown as Ready.

**What changed** (`packages/core/src/agents/credentials/pastedCredentials.ts`)
- **Validation before replacing the file:** each provider entry must be one of the three types `opencode auth login` writes, and must hold a non-empty credential:
  - `api` needs `key`.
  - `oauth` needs `refresh` or `access`.
  - `wellknown` needs `key` or `token`.
  - Any other type is refused, and so is an entry whose credential fields are missing or only spaces. If one entry is bad, the whole document is refused. The error goes back to the operator as a 400, so `rewrite` never replaces the existing `auth.json`.
- **Status reporting:** the status check now uses the same per-entry test. A file with provider entries but no usable credential reports "not set", where before it reported "set". Because the health check reads that status, `remoteCredentialProblem` now returns "No credentials are stored…" instead of Ready.

**Sibling paths checked**
- The Codex `auth.json` check already required a key or login tokens.
- The OpenCode login-file check skips the pasted `auth.json`, so the status fix covers it.
- An OpenCode `auth.json` collected after an interactive remote login is still stored without this check. It now reports "not set" if it has no credential. One test fixture for that path stored `{"a":{"type":"api"}}`, so I added a key to it.

**Regressions added**
- `packages/api/test/agentRemoteCredentials.test.ts`: saves a working OpenCode login, then tries six credential-free or unsupported pastes. Each is refused, and the file is byte-for-byte unchanged afterwards, still with no credential problem. A credential-free file written straight into the store reports "not set" and fails the health check.
- `test/remoteAgentLogin.test.ts`: checks the refusal messages for each type, and that valid `api`, `oauth` and `wellknown` documents are kept as-is.

**Verification:** 61 tests pass across the touched credential suites, plus the related broker, operator-mutation and credential-source suites. The broker suite has to go through `scripts/run-test-suite.mjs` because it needs module mocks. The `tsc` typecheck is clean for core and api, and lint shows zero warnings on the changed files.

I made no visual previews because nothing on screen changed.

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

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

* chore: recheck agent health after removing a stored credential

F19 is fixed: removing a stored credential in the agent dialog now reruns that agent's health check. A card that showed **Ready** updates to the new result instead of keeping the old cached one.

**What changed**
- `AgentPastedCredentials.tsx`: a new optional `onStoredCredentialRemoved(agentId)` callback is called after `clearAgentCredential` succeeds. If the delete fails, the error shows as before and no recheck is requested.
- `AgentConfigModal.tsx`: passes that callback through. I put the props destructuring on fewer lines because the file had gone over the 400-line lint limit.
- `AgentsListSection.tsx`: connects the callback to the existing `recheck`, the same path used after saving a pasted credential and after closing the login dialog.

**Regression test** in `AgentsListSection.test.tsx`: a Codex agent whose only credential is a stored OpenAI key starts as **Ready**. The test opens Edit, clicks **Remove** and closes the dialog with Cancel. It then checks for a fresh health request with the force flag, the "No credential stored" alert, and that **Ready** is gone. With the connection removed, the test fails.

**Other places checked**
- `AgentPastedCredentials` is the only place in the UI that deletes a credential.
- `AgentsListSection` is the only place that renders `AgentConfigModal`.
- Saving a credential and closing the login dialog already rechecked health.

Removing a credential and then saving the agent rechecks once on removal. If the save changes the agent's configuration, the existing revision logic can start one more check.

**Verification:** all 426 tests in `propr-ui/src/pages/SettingsPage/` pass. `tsc --noEmit` and ESLint with zero warnings allowed are clean for that directory.

I didn't make a visual preview: the card just shows the existing health-error state, with no new UI.

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

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

* refactor: extract Mistral API key field from AgentConfigModal

I fixed the UI lint failure that broke Validate Changes. `AgentConfigModal.tsx` was at 410 code lines, over the 400-line limit.

I moved the Vibe agent's Mistral API key field, including its show/hide toggle and the "Get your API key from Mistral AI" link, into its own component, `propr-ui/src/pages/SettingsPage/MistralApiKeyField.tsx`. The markup is the same as before. The modal now just renders that component when the agent type is `vibe`, and the file is well under the limit.

The full `propr-ui` lint (`eslint . --max-warnings 0`) and the typecheck now pass. The three agent dialog test files also pass (26 tests). I didn't take previews, since nothing on screen changes.

PR: #3865
Comment by: @github-actions[bot] (ID: 7248908297)
Comment by: @propr-dev[bot] (ID: 7248908799)
Model: Claude Opus 5.5

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

* chore: request full Claude sign-in link in agent login terminal

The URL was not being mangled by ProPR. The Claude CLI itself prints that short link, and the login now asks it for the full one. The live end-to-end Sprites login (item 3) is still not done: I have no access to a Fly instance from here, so it needs to be repeated on a Docker-less instance.

**Cause.** I recorded `claude auth login` (Claude Code 2.1.330) in a 120×40 PTY with the same environment the remote logins use. The CLI prints `https://claude.ai/oauth/authorize?z-…` with 45 characters after the `?`, both in the visible text and in the OSC 8 link target. Piped with no TTY it prints the same thing, and there are no redraws. Since 2.1 the CLI compacts the sign-in link on purpose: the 45 characters are 2 scope characters plus the 43-character `code_challenge`, and `client_id`, `redirect_uri` and `state` are dropped. An environment variable in the CLI, `CLAUDE_CODE_FULL_SIGN_IN_LINK`, turns this off. I couldn't check whether claude.ai accepts the compact link, because curl gets a Cloudflare 403.

**Fixes**
- **Full link:** the Claude login now sets `CLAUDE_CODE_FULL_SIGN_IN_LINK=1`. In the recording, the CLI then prints the full `https://claude.com/cai/oauth/authorize?code=true&client_id=…&redirect_uri=…&code_challenge=…&state=…` on one line. The setting reaches Sprites, Fly Machines and local Docker (Docker passes it with `-e`, and the entrypoint keeps it). Local Docker logins were getting the compact link too, since that container is also started with `-t`.
- **Wider terminal:** the login terminal is now 1000 columns on both remote runtimes. Sprites spawns with `cols: 1000`. On Fly, `script` can't take a size from its input pipe, so it runs `stty cols 1000 rows 40` before starting the CLI. I didn't use `TERM=dumb` or `NO_COLOR`: neither was needed, and they could change how the CLIs' paste prompts behave.
- **OSC 8 links in `sanitizeTerminalChunk`:** it now keeps the target of an OSC 8 hyperlink. If the visible label doesn't match the target (ignoring line breaks and spaces), the target is written out as plain text after it. Other control strings stay hidden. Targets that aren't a single scheme-and-text URI are dropped, and anything over 8 KB isn't tracked.
- **"Not signed in" badge:** an `auth_required` error whose message says no credentials are stored (or "not logged in / not signed in") now shows **Not signed in**. An expired login still shows **Authentication expired**.

**Tests.** The new `packages/api/test/agentLoginTerminal.test.ts` uses the recorded transcripts, saved in `packages/api/test/fixtures/agentLoginTranscripts/`. It feeds them in at several chunk sizes so escape sequences fall across chunk boundaries.
- The Claude transcript keeps the full URL with `client_id`, `redirect_uri`, `code_challenge` and `state`, and no control characters are left.
- The real recording has no redraws, so one test builds them from it: the label is wrapped at 120 columns, cleared and rewritten with cursor moves, and partly overwritten. The full URL still comes through from the link target. That test and the label-differs-from-target test fail with the old sanitizer.
- The Codex device-login transcript keeps `https://auth.openai.com/codex/device` and the one-time code.
- The compact-link transcript is kept as a test, showing the short URL comes from the CLI and not the sanitizer.
- The existing Sprites and Fly login tests now also check the 1000-column terminal.

The touched server suites (70 tests), the agent default-path tests and the UI card tests (19, including a new "Not signed in" case) all pass. Typecheck and zero-warning lint are clean.

I captured a preview of the badge with a mocked API: one card that was never signed in next to one whose login expired.

PR: #3865
Comment by: @integry (ID: 7258599907)
Model: Claude Opus 5.5

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

* chore: agent credentials on Docker-less instances: paste credentials +…

I fixed F20: when a login CLI wraps a hyperlink's label across rows, the browser now gets the complete sign-in URL as one unbroken piece of text.

**The fix** (`packages/api/services/agentLoginTerminal.ts`): the old check stripped all whitespace from the label and compared it to the link's target. A label wrapped across rows passed that check, so the full URL was never written out and the dialog only made the first row clickable. A new helper, `labelShowsTarget`, now skips writing the URL out only when the label contains it unbroken and followed by whitespace or the end of the label. That boundary check matches how `AgentLoginModal` finds URLs, so a label like `https://…/a.` also gets the clean URL written after it.

**Tests** (`packages/api/test/agentLoginTerminal.test.ts`), two new cases:
- **Wrapped label:** uses the recorded Claude authorize URL with its label split into 120-column rows and nothing else changed. Fed in chunks of 1, 2, 7, 119, 120, 121 and 4096 characters, the output shows the wrapped label and then the full URL in one piece, with every OAuth parameter checked.
- **URL plus trailing text:** a label where the URL runs into trailing punctuation gets the URL written out again. A label that shows the URL followed by a space does not.

All 8 sanitizer tests pass. Both new tests fail when run against the previous version of the file. ESLint reports zero warnings on both files, and `tsc` reports no errors in them.

The existing check that an unwrapped label isn't repeated still passes. No other code changed in this PR does the same comparison: the sanitizer has a single caller, and the only other OSC 8 matches are the test transcripts. I didn't make a visual preview because the change only affects the text sent to the login dialog.

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

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

---------

Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>
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