Repository navigation
[Epic] Pi coding agent support - #3847
Conversation
… a disposable runtime and safe credential handling (#3839) * chore: install Pi CLI in agent image with disposable runtime Pi 1.6.1 is now in the agent image, with its own entrypoint and the credential write-back helper. I couldn't build the image here because there's no Docker in this container, so the image build and the new smoke checks haven't run. Their first real run will be CI. Tested: - I installed Pi 1.6.1 from npm and ran the Dockerfile's `pi --version` / `pi --help` flag check against it; it passes and catches a missing flag. - Through a local logging proxy, Pi sent its provider traffic via `HTTPS_PROXY` and contacted only the provider host (`api.anthropic.com`, `openrouter.ai`). It made no `pi.dev` calls in `-p` mode. - The new test file `test/piCredentials.test.ts` (23 cases) passes. It covers the credential helper and runs the entrypoint as a non-root user with a stand-in `pi`. - The related suites pass, and typecheck (core, API, root) and core lint are clean. - One test fails, and it was already failing: `thirdPartyNotices` "committed notice carries the date…". The `Generated:` date in `THIRD_PARTY_LICENSES.md` doesn't match the last `package-lock.json` commit; I didn't change either. Decision for you: the issue asks for `pi: '1.6.1'` in `AGENT_DEFAULT_VERSIONS`, but `pi` only becomes an agent type in #3832. Adding it to `AgentType` now would ripple through the UI and about 40 typed lookup tables. Instead I added an `AgentCliType` (the agent types plus `pi`) and used it only for the image version tables, labels, build args, egress lists and the entrypoint map. When #3832 adds `pi` as an agent type the extra entry deduplicates itself and nothing else needs undoing. The catch: if you'd rather `pi` became a full agent type in this change, that pulls a chunk of #3832 forward. What's in place: - Image: a `pi-cli` stage installs `@earendil-works/pi-coding-agent@${PI_CLI_VERSION}` (default 1.6.1), checks `pi --version` and that `pi --help` lists the eight required flags, and puts `pi` on PATH. The final image gets a `dev.propr.agent.pi.version` label. `scripts/build-images.sh` has the matching `PI_CLI_VERSION`. Both content-hash lists and the app image's build context include the new files. Npm version lookup works for the scoped package. - Entrypoint (`scripts/pi-entrypoint.sh`), dispatched from `agent-entrypoint.sh`: - Each run starts with a fresh `/tmp/propr-pi-home/agent` as `PI_CODING_AGENT_DIR`, with sessions under it. - It copies only `auth.json`, `settings.json`, `models.json`, `AGENTS.md`, `SYSTEM.md` and `APPEND_SYSTEM.md` from `PROPR_PI_SOURCE_DIR`. Host `sessions/`, `extensions/` and `mcp.json` are never copied; ProPR can supply its own `mcp.json` through `PROPR_PI_MCP_CONFIG`. - It sets `PI_SKIP_VERSION_CHECK=1` and `PI_TELEMETRY=0`. It also sets `PI_OFFLINE=1`, which the issue didn't ask for. It stops Pi's startup model-catalog fetch from `pi.dev`, and the value can be overridden. - Every Pi or helper call (seed, version probe, the task, sync) goes through `su-exec node`. The task's exit status is passed through. - Provider API-key env vars pass through unchanged. - Credentials (`scripts/pi-credentials.py`): `seed` saves an owner-only snapshot of the imported `auth.json` before Pi touches it. `sync` writes refreshed OAuth entries back one provider at a time, only if the host entry still equals the snapshot. It never rewrites API-key entries, never adds or removes providers, and writes nothing if no OAuth entry changed. The write is atomic: temp file opened with `O_CREAT|O_EXCL, 0o600`, original mode kept. It also takes Pi's own `auth.json.lock` (same format as Pi's locking library), so it can't interleave with a host Pi refresh; stale locks are taken over. - Egress: Pi's allowlist covers Anthropic, OpenAI and ChatGPT sign-in, OpenRouter, Gemini and GitHub Copilot, including their token-refresh hosts. `pi.dev` and `radius.pi.dev` are excluded, and Pi is marked as proxy-compatible. - Smoke tests: `scripts/smoke-test-images.sh` runs `pi --version` through the entrypoint and compares it with the image label. It also starts the entrypoint as `--user 0:0` with a mounted source dir and fails if anything under `/tmp/propr-pi-home` isn't owned by `node`. The preview-image smoke test covers Pi the same way. - Other: third-party notices list the new package as MIT, and `agent-runtime.md` has a short Pi section. I updated the existing test fixtures that list image labels, and added a Pi case to the provider-egress test. There's nothing visible to capture, so I made no preview. ProPR-Agent: claude/claude-opus-5-5 * chore: guard Pi host dir and symlinked auth.json from runtime sync I fixed both findings, F1 and F2. `test/piCredentials.test.ts` now passes in full (26 of 26). I also ran the new tests against the old scripts: the two regressions below fail there, so they do catch the original bugs. **F1: a runtime home could delete the host Pi dir** (`scripts/pi-entrypoint.sh`) - Before anything is deleted or chowned, the entrypoint now resolves both `PROPR_PI_RUNTIME_HOME` and `PROPR_PI_SOURCE_DIR` to real paths, following symlinks and `..`. - It then refuses with exit 64 if either path is inside the other. Before, it only caught a runtime home inside the source dir, not one that contains it. - It also refuses a runtime home that resolves to `/`. The old check only caught the literal value `/`, so something like `/tmp/..` would have got through. - New tests: a runtime home that contains the source dir, given as the parent dir (the `/home/node/.pi` case), as `agent/..`, and as a symlink to the parent. Each one exits 64 and leaves the host `auth.json` and `sessions/` untouched. A runtime home equal to the source dir is also refused. **F2: write-back replaced a symlinked `auth.json`** (`scripts/pi-credentials.py`) - `sync` now resolves the host `auth.json` path once. It uses that real file for the lock, the read, the file mode and the atomic replace. The temp file is created next to the real file, the target gets the new credentials, and the symlink stays in place. - This matches Pi's own lock, which is also taken on the real file. - New test: with `auth.json` as a symlink to a mode-0640 file elsewhere, after a refresh the link still exists and points to the same file. That file holds the refreshed entry, keeps mode 0640, and has no temp or lock files left next to it. The other place this could matter is `seed`, which writes the snapshot. It deletes the snapshot path first, so it never writes through a link and needed no change. PR: #3839 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * fix: forward stop signals to Pi and sync credentials on exit I fixed F3: stopping a Pi container mid-task now passes the signal on to Pi, waits for Pi to exit, and still writes refreshed OAuth credentials back to the host. All 28 tests in `test/piCredentials.test.ts` pass, including the two new ones. Against the old entrypoint, both new tests fail. I couldn't run the root code path (starting as root and dropping to `node` via `su-exec`) here, because there's no root or Docker in this container; CI's image smoke test is its first real run. **What changed in `scripts/pi-entrypoint.sh`:** - **Signal forwarding:** Pi now runs as a background child instead of in the foreground. Handlers for `SIGTERM`, `SIGINT` and `SIGHUP` pass the signal to Pi. The shell keeps waiting until Pi has actually exited, then runs the credential sync once. - **Exit status:** the container exits with Pi's status, which is 143 after `docker stop` if Pi doesn't handle the signal. If Pi exits cleanly after being told to stop, the entrypoint reports `128 + signal` rather than 0. A signal that arrives during the sync waits until the sync finishes. - **Three problems I hit and fixed while testing:** - The background job was a bash subshell running a helper function, so signals reached the subshell and left Pi orphaned. A new `exec_as_node` helper makes the task's PID Pi itself. - Bash without job control makes background commands ignore `SIGINT` and `SIGQUIT`. The task now starts with `env --default-signal=INT,QUIT` to undo that; Debian bookworm's coreutils 9.1 supports the flag. - Bash also points a background command's stdin at `/dev/null`, so the prompt on stdin is now passed through explicitly. **Tests and docs:** - New tests for `SIGTERM` and `SIGINT`. A stand-in Pi refreshes the Anthropic token and keeps running; the test then signals the entrypoint the way tini would. They check: - the exit status is 143 or 130. - Pi was stopped, not left running. - the host `auth.json` holds the refreshed entry and nothing else changed. - The existing run test now also checks that the prompt on stdin reaches Pi. - I updated the existing check that every Pi call drops to `node` so it covers `exec_as_node`. - The Pi section of `agent-runtime.md` now has one sentence on the shutdown behaviour. **Separate finding (not changed):** in an interactive `docker run -it`, Ctrl-C reaches Pi from the terminal and again from the entrypoint, so Pi gets `SIGINT` twice. ProPR runs Pi with `-p` and no terminal, so this only matters for manual interactive use. I didn't change tini to signal the whole process group (`tini -g`). That would affect every agent image, which is beyond this finding. PR: #3839 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>
|
✅ Applied the requested follow-up changes in commit 279c440 Summary of ChangesI removed the The change: the test "waits for a held Pi auth.json lock" used to start two processes through a shell: a "holder" script standing in for a host Pi, and the credentials sync. Now Node runs the holder script directly with Checks: all 28 tests in This is a test-only change with nothing visual, so there are no previews. Review digestRisk-tiered paths
Diff size: 1 file changed, +9/−5 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
I removed the `bash -c` call that CodeQL flagged at `test/piCredentials.test.ts:274`, so no shell ever sees the temp-dir paths or file names now.
**The change:** the test "waits for a held Pi auth.json lock" used to start two processes through a shell: a "holder" script standing in for a host Pi, and the credentials sync. Now Node runs the holder script directly with `spawnSync('python3', ['-I', '-B', script, …paths])`. The holder starts the sync itself with `subprocess.Popen` and a plain argument list. It then sleeps 0.5s, writes its refresh to the host `auth.json`, releases the lock, and exits with the sync's exit code. The timing is the same as before. The test still checks that the sync exits 0, that the holder's refresh wins, and that the lock is gone afterwards.
**Checks:** all 28 tests in `test/piCredentials.test.ts` pass. ESLint has no rules configured for this file, so the lint run checked nothing. I didn't run a negative check (breaking the lock wait to confirm the test fails), but the assertions are unchanged.
This is a test-only change with nothing visual, so there are no previews.
PR: #3847
Comment by: @github-advanced-security[bot] (ID: 4721690976)
Model: Claude Opus 5.5
ProPR-Agent: claude/claude-opus-5-5
…or tasks, with full persisted execution events (#3849) * feat: add Pi agent type with JSON-mode runs and persisted events I've registered `pi` as a full agent type, and implementation tasks and PR follow-ups now run through Pi in JSON mode with the whole trace saved as execution events. The new tests pass (23 of 23). So do the existing suites I picked that touch agent types, models, reasoning levels, metrics, the watchdog and the CLI, plus the propr-ui Settings/config tests. Typecheck passes for every package and lint passes for core and root `src/`. I did not run a real containerised Pi task: there's no Docker here, so the full in-image run hasn't happened yet. Agent type. `pi` is now in the shared and core type lists, `createAgentFromConfig`, the default config path (`~/.pi/agent`, overridable with `PI_CONFIG_PATH`/`HOST_PI_DIR`), the in-container path, the health-check models, the PR template's agent name, and the CLI and UI types. Now that `pi` is a real agent type, I removed the temporary image-only `pi` entry that #3839 added; `AgentCliType` is now just an alias for the agent type. Invocation. Each run is `pi -p --mode json --model <provider/id> [--thinking <level>] --session-dir /tmp/propr-pi-home/agent/sessions --no-approve`, with the prompt on stdin. - Reasoning levels: `low` through `max` pass straight through. `ultra` and `ultracode` run at `max`. Unset or `auto` leaves the model's own default. - Docker: the container starts as root only so the existing entrypoint can set up the per-run Pi home, then Pi runs as `node`. - Pi config dir: mounted only if it exists on the host, because Docker would otherwise create it there owned by root. It is mounted read-write so the entrypoint can write refreshed sign-in tokens back. - Secrets: the GitHub token and provider API keys go in through the Docker client's environment, so they never appear in the command line. - Analysis runs: read-only workspace and no saved session. They get no tools, or only `read,grep,find,ls` when the caller allows read-only inspection. Model IDs. These use the form `pi-<provider>/<model>`, with an optional `:<thinking>` suffix. The defaults are Opus 5.5, Sonnet 5.5, GPT-6.2 Astra, Gemini 4 Argon and Devstral 2 via OpenRouter. PR titles, aliases (e.g. `llm-pi-devstral2`) and pricing resolve to the underlying model. The startup config migration no longer drops Pi models that aren't in the catalog, and doesn't re-add default models an operator has removed. Parser. It reads the session id, summary, success rule, per-response token sums and provider cost exactly as the issue specifies. Each tool call gets exactly one result event: Pi reports a result in both `tool_execution_end` and a `toolResult` message, and `turn_end` repeats it, so duplicates are skipped. The failed `cat missing.txt` call is recorded with `is_error: true`. Things that behave differently from what you might assume: - Pi exits 0 even when the provider rejects the request. I checked this against a real Pi 1.6.1 run with a bad OpenRouter key: it ended with `stopReason: "error"` and exit code 0. The success rule catches this, and there's a test built from that output. - Provider cost needed a shared change. To use Pi's reported cost instead of ProPR pricing, I added a `providerCostUsd` field. It's passed through the result converters into `recordLLMMetrics`, which uses it before pricing. It is only set when every response says `totalFromProvider`, so other agents are unaffected. - Managed diagnostics skip Pi, because its sessions live in a per-run directory and the host dir holds nothing to inventory. - Context scouting stays off for Pi. It isn't added to the agents allowed to do repository scouting. Watchdog. Pi's `toolCall` blocks, `tool_execution_start`/`_end`, `toolResult` messages and `turn_end` results are now tracked as tool calls. A long-running tool is held to the longer tool threshold instead of being treated as a stall. Tests and docs. The fixture is at `test/fixtures/pi/pi-1.6.1-json-tool-task.jsonl` and the tests are in `test/piAgent.test.ts`. I updated two existing tests for the new type: a missing `pi` entry in `agentDefaultConfigPaths` and an expected error message in `apiOpenCodeRoutes`. `docs/docs/features/agents-and-models.md` now has a Pi row and a short Pi section. Not done: - Launcher and CLI setup plumbing for `HOST_PI_DIR` (orchestrator, `initStack`, `checkCommands`). - A Pi parser for the live output view in the API. - Pi-specific fields in the agent settings dialog. Pi does now appear in the agent type selector automatically. No preview was made: the only visible change is that new "Pi" option in the type selector. ProPR-Agent: claude/claude-opus-5-5 * test: add pi to expected agent types in OpenCode CLI help test I fixed the one failing test in shard 3. Everything else in the shard passed. **Cause:** `test/cliAgentOpenCode.test.ts:29` checks the help text for the `agent add` command against a hard-coded list of agent types. This branch adds `pi`, so the help now reads `Agent type (claude, codex, antigravity, opencode, vibe, pi)`. The old pattern ended at `vibe)` and no longer matched. **Fix:** I added `pi` to the expected list in that pattern. The file now passes locally (3 of 3). I also searched the other tests for the same hard-coded list. `packages/cli/src/commands/setupCommand.test.ts` has a similar one, but it's for skill targets, not agent types. This branch doesn't add `pi` to that list, so I left it alone. No preview, since this only changes a test. PR: #3849 Comment by: @propr-dev[bot] (ID: 7224133308) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * fix: keep Pi run results when post-run steps fail I fixed F1. When a Pi run has finished and something after it fails, the failed result now keeps what the run produced instead of discarding it. The new regression tests pass, and they fail against the previous `PiAgent.ts`. **Problem.** Pi built the finished response inside the `try`, so the `catch` couldn't see it. A rejecting `onSessionId` callback, or a failing log write, produced a failed result with no tokens, cost, session or conversation. In the callback case the run's log row was never written either. **Changes:** - **`packages/core/src/agents/impl/PiAgent.ts`:** - **What a failure keeps:** `executeTask` now holds the finished response outside the `try`. On any later failure it builds the result with the shared `failedExecutionResult` helper. That keeps the session id, conversation, token usage, cost, provider cost, provider model, reasoning level and execution id, and Pi also keeps the run's usage metrics. - **Failures before Pi produced output:** these keep the prompt and carry no run data, as before. - **Log row:** if the run finished but its log row was never written, it is now written once, marked failed, with Pi's provider cost. If that write fails too, a warning is logged and the failed result is still returned. - **`packages/core/src/agents/impl/utils/failedAgentExecution.ts`:** `failedExecutionResult` now also keeps `providerCostUsd`. Claude and Codex already route through this helper; they don't set that field today, so nothing changes for them. **Sibling check.** Claude and Codex already keep the finished response this way and write the missing log row. Pi's `analyze` path doesn't have the bug: it has no awaited step between building the result and returning it. **Tests.** The new file `test/piAgentPostExecutionFailure.test.ts` runs the real `executeTask` against the recorded Pi 1.6.1 trace, with only the Docker call replaced. It covers: - A rejecting session callback: the result keeps the run, and the log row is written exactly once. - A failing log write: the result still keeps the run. - Docker throwing before any output: the prompt is kept, there is no run data, and no row is written. - The shared helper keeping `providerCostUsd`. All 4 pass, and 2 of them fail against the old `PiAgent.ts`. `test/piAgent.test.ts` and `test/llmMetricsFailedExecutions.test.ts` still pass (30 of 30). The core typecheck passes, and zero-warning lint passes on the two changed source files. Lint has no config that covers the new test file, so it wasn't linted. One thing to know: when the log write itself is what fails, the failure path tries it once more. The Codex agent does the same. No preview was made, because nothing visible changed. PR: #3849 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>
…ommit subjects, planner, indexing and the repository scout (#3858) Pi now handles every analysis path (reviews, summaries, commit subjects, planner, indexing and the review context scout), and Pi task runs get the extension library and the `propr` MCP server. I installed Pi 1.6.1 locally and ran the real CLI against a stub model server, because the issue's scout flag set doesn't work as written. The scout flags needed one change. The issue's flags (`--no-builtin-tools --no-extensions …`) leave the scout with no tools at all. `--no-extensions` also unloads Pi's own built-in MCP support. The working set is: - `--no-builtin-tools`, plus `--tools` listing only the three `mcp__propr_repository__*` tools. - `--no-extensions --extension builtin:mcp`, `--no-skills`, `--no-prompt-templates`, `--no-approve`. - A generated `mcp.json` with only the `propr_repository` server, set to `"exposure": "direct"`. Pi's default exposure only lets the model reach MCP tools through its `codemode` script tool, which the flags above leave unloaded. With exactly the args ProPR builds, the model saw only the three scout tools: `bash` and `read` came back "Tool … not found", and a scout read returned the file. A `.pi/mcp.json`, an extension and a skill planted in the project and agent dirs did not load; with the flags removed, they did. The scout mounts the repository read-only at the scout server's root, with no git mounts and no GitHub token, like the other agents. `buildPiRepositoryScoutConfig` and `buildPiRepositoryScoutArgs` sit next to the OpenCode and Vibe builders in `repositoryScoutMcpServer.ts`. Other analyses run tool-less (`--no-tools`) on a read-only workspace, the same as Claude. The scout is the only analysis that asks for tools, so I replaced the old `read,grep,find,ls` mode with the scout mode. Analysis results go through the existing JSON parser and success rules (final text, usage, provider cost). Task runs: - `PiAgent.executeTask` now goes through `executeWithExtensions` and passes `extensionAgentLaunch`, as Claude and Codex do. - The tool policy becomes a generated `mcp.json`, passed to the container as `PROPR_PI_MCP_CONFIG`. It holds `Bearer ${PROPR_EXTENSION_MCP_0_TOKEN}` placeholders, never token values; the values arrive via `-e NAME`. - Each staged skill bundle is passed as `--skill /opt/propr/extensions/<id>`, with `--no-skills` for exclusive runs. I added an internal `skillPaths` field to the tool policy for this. - Runs join the policy's Docker network. Live checks with real Pi all passed: bearer-auth HTTP server, stdio server through the bridge (secret inherited from the environment), and skill loading. Gates: #3841 hasn't landed, so I added `pi` to `EXTENSION_RUNTIMES` and `AGENT_TYPES_SUPPORTING_PROPR_MCP`. The five hard-coded `['claude', 'codex']` copies now call a shared `isExtensionRuntime`. Error messages and UI text now read "Claude, Codex or Pi". I regenerated the OpenAPI spec and client types. Readable tool events: - MCP tools are named `<server>/<tool>` in persisted events. - Calls made inside a `codemode` script now get their own tool events. Before, they produced results with no matching call. - The live view now recognises Pi output, and the task watcher uses the Redis stream for Pi. `src/jobs/reviewContextScout.ts` now accepts Pi. Indexing and the planner already choose agents generically, so they needed no change. Tests: I added `test/piScoutAndExtensions.test.ts` (14 tests, including the bridge smoke test), `test/piAgentAnalysis.test.ts` (7) and `packages/api/test/liveDetailsPiParser.test.ts` (3). Two real Pi 1.6.1 recordings are now fixtures, with only the temp paths rewritten. The existing Pi, extension, scout, agent-run-trigger, task-submission and live-details suites and the UI editor test pass. Typecheck and lint are clean for root, core, api and propr-ui. `packages/api/test/mcpObservableSurface.test.ts` fails, but it fails the same way on a clean copy of HEAD. Not tested: a containerised Pi run, because there is no Docker here. The flags and config were verified with the Pi CLI run directly on the host. I updated the Pi section in `agents-and-models.md` and the runtime mentions in `agent-extensions.md`. No preview: the only visible change is the word "Pi" added to three help texts. ProPR-Agent: claude/claude-opus-5-5 Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>
…d login, health check, diagnostics and docs (#3857) * docs: add Pi to settings UI, CLI, managed login and health check Pi can now be configured and run everywhere the other agents are: the settings UI, managed login, the CLI and setup, health check, diagnostics, MCP settings and docs. Typecheck and lint are clean for every package I touched, and the affected test suites pass. There's no Docker here, so I haven't done a real containerised login or health check. Instead I installed Pi 1.6.1 locally and ran `pi auth check` and `pi auth login` against it to confirm the output, exit codes and prompts the code relies on. Managed login - How it runs: the login container runs `pi auth login <provider> --no-browser`, or `--api-key` to save a key. I tested sign-in on Anthropic (paste a code), OpenRouter (paste the redirect URL) and the ChatGPT subscription (device code); `--api-key` saved a key to `auth.json`. - Where credentials go: `pi-entrypoint.sh` has a login mode that points Pi straight at the mounted dir (`~/.propr/agent-credentials/<id>/.pi/agent`). It skips the per-run copy because the write-back after a run only saves refreshed tokens, never a new login. - Choosing the provider: in the UI, a small dialog asks for the provider and login method before the container starts. Through the API the provider is optional and defaults to the provider of the agent's default model. Health check - Pi agents are checked with `pi auth check --provider <p> --json --no-refresh` instead of running a prompt. The provider comes from the health-check model. - It runs with no network, the credential dir mounted read-only, and API keys passed through the environment rather than the command line. - `ready` shows as ready. `not_ready` and `invalid` show as sign-in required, with Pi's reason. An unknown provider is reported as a configuration problem rather than a login prompt. Settings UI - Credentials: Pi offers three choices: log in to a new managed account, use an existing config dir (`~/.pi/agent`), or use API keys. The API-key choice shows one key field per provider used by the selected models. - Models and logo: a provider + model control adds any `pi-<provider>/<model>`. Pi gets a π logo. The CLI version controls already worked for Pi. CLI and setup - `propr agent login <pi-agent>` accepts `--provider` and `--api-key`. - Pi is now known to `propr check` and `propr init`, the agent skill (installed to `~/.pi/agent/skills/propr`), both launcher copies (`HOST_PI_DIR` → `PI_CONFIG_PATH`), `docker-compose.yml`, the local-setup engine and the desktop setup schema. Diagnostics and MCP - Redaction: the keys and tokens in Pi's `auth.json` are now redacted. - Managed diagnostics: Pi is now included. The previous Pi change had skipped it, so Pi run logs were silently refused; they are captured now. - MCP: the settings catalog lists `PI_CONFIG_PATH`, `PI_TIMEOUT_MS` and `HOST_PI_DIR`. Creating an agent through the MCP tools now uses each type's own default config path; before, it fell back to `~/.vibe` for every type without managed login. Docs: `agent-runtime.md` has a Pi section covering the image, entrypoint, credential mount, disposable agent dir, refresh write-back rules, managed login and health check. The setup guides, configuration reference, `.env.example` and CHANGELOG are updated. `settings-locations.md` is generated from the settings catalog, so I regenerated it rather than editing it. Tests: new tests cover the login descriptor and routes, the entrypoint's login mode, health-check parsing (using recorded Pi 1.6.1 output), redaction, CLI validation and login, the launcher, and the UI dialogs (463 settings UI tests pass). `test/agentRegistryManagedAgentPin.test.ts` only passes when run with `--experimental-test-module-mocks`. Gaps: - `propr check` still sends a short prompt to validate Pi rather than using `pi auth check`. - A stack with only a provider API key and no `HOST_PI_DIR` isn't detected as having Pi, so you need `--agents pi`. - The setup wizard's login step always signs in to `anthropic`; use `propr agent login --provider` for anything else. - `SKILL.md` itself is unchanged; the skill installer knows about Pi. Four UI previews are attached: the Pi agent dialog with API keys, the same dialog with managed login, the provider picker, and an agent card showing a `not_ready` health result. ProPR-Agent: claude/claude-opus-5-5 * docs: split agent login code to stay under max-lines limit I fixed the Validate Changes failure. Only the API lint step had failed: two files on this branch went over the 400-line `max-lines` limit, and the API lint fails on any warning. Every other stage in the run passed. **`packages/api/services/agentLoginSessionManager.ts` (431 → 437 total lines, 400 limit)** — I moved two groups of code into `services/agentLoginDocker.ts`, without changing what they do: - The Pi login logic: picking the provider, building the login command, and returning a clear error for bad input. It's now one exported function, `resolveAgentLoginDescriptor`, and `start()` calls it. - The default Docker run and spawn helpers, plus the `DockerCommandResult` type. The manager still re-exports that type, so existing imports keep working. **`packages/api/test/agentLoginRoutes.test.ts` (498 lines)** — I split it up: - The Pi route and descriptor tests now live in a new file, `test/agentLoginPi.test.ts`. - The shared test fixtures are in a new `test/agentLoginTestHelpers.ts`, which both test files import. **Checks I ran:** - `eslint . --max-warnings 0` in `packages/api` now passes, and the API typecheck is clean. - All 20 tests in `agentLoginRoutes.test.ts` and `agentLoginPi.test.ts` pass. - `test/agentDefaultConfigPaths.test.ts` passes (29 tests). I didn't add previews, since nothing visible changed. PR: #3857 Comment by: @propr-dev[bot] (ID: 7226481658) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * docs: return empty configEnv from Pi auth check docker args I fixed the build error that broke the Restricted network container smoke check; I haven't run the check itself. **Cause:** The merge from the epic branch (`bdab602a4`) made `configEnv` a required field on `PiDockerInvocation`. The Pi health check builder added on this PR, `buildPiAuthCheckDockerArgs`, still returned only `{ args, secretEnv }`. That made the core package fail to build in the workflow's `npm run test:prepare` step, which is the exit code 2 in the log. **Fix:** - `packages/core/src/agents/impl/utils/piAuthCheck.ts`: the health check now returns `configEnv: {}`. It has no non-secret config to pass, so nothing changes at runtime. - `test/piAuthCheck.test.ts`: added `configEnv: {}` to the test's hand-written invocation so it matches the type. **Verification:** - `tsc --noEmit` on `packages/core` is clean. - `npm run test:prepare`, the step that failed in CI, now builds every package. - `test/piAuthCheck.test.ts` passes (6 of 6). It needs `PROPR_DEMO_MODE=1`; without it the file reports one failure and stops. The later steps of that check build the agent image and run tests in a real container. There's no Docker here, so I couldn't run them; the next CI run on this PR will cover them. No previews, since nothing visible changed. PR: #3857 Comment by: @propr-dev[bot] (ID: 7227137481) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * docs: resolve agent default config path only on create I fixed the Shard 3/4 failure. The cause was a bug in this PR, not a flaky test. **Cause:** the one failing test was `packages/api/test/mcpReviewerConcurrency.test.ts`. In `packages/api/mcp/toolsConfiguration.ts`, this PR changed the fallback config path for new agents from `'~/.vibe'` to the agent type's own default. But that path is worked out for create, update and remove alike, and only create passes a `type`. So every `update_agent_configuration` and `remove_agent_configuration` call now threw `TypeError: Cannot read properties of undefined (reading 'configPath')`. The MCP layer turned that into an `OUTCOME_UNKNOWN` 500, which is the `'unknown'` the test got instead of `'completed'`. I reproduced this locally and got the stack trace by temporarily logging the error, then removed the logging. **Fix:** the new agent's path is now only worked out when an agent is created, which is the only case that needs it. Creating an agent still uses each type's default path, as the PR intended. **Verification:** - `mcpReviewerConcurrency.test.ts` failed locally the same way as CI before the fix and passes after it. - `mcpToolInputBudget`, `settingsCatalog` and `mcpIntegration` pass (14/14). - Lint with zero warnings and the `packages/api` typecheck are both clean. I didn't rerun the whole shard. This change has nothing visual, so there are no previews. PR: #3857 Comment by: @propr-dev[bot] (ID: 7227524858) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * docs: show readable model and provider in Pi model hint I've fixed F1: the hint under "Add a Pi model" no longer shows the raw model ID. Instead of `Runs as pi --model openrouter/qwen/qwen3-coder` it now reads **"Adds Qwen3 Coder via OpenRouter."** The Pi settings tests pass (6 of 6), and typecheck and lint are clean for the UI. - **New helper:** `describePiModel` in `propr-ui/src/pages/SettingsPage/piAgentFieldsUtils.ts` turns a `pi-<provider>/<model>` ID into that text. The model name comes from the shared `getModelDisplayName` helper, which uses the catalog name or makes a readable name from an unknown ID. The provider name comes from the Pi provider list, and an unknown provider is made readable the same way. - **The hint itself** (`PiAgentFields.tsx`): before anything valid is typed, it says "Enter the model id as Pi names it for this provider." The duplicate warning is unchanged. Raw IDs are still used for the input value, the saved model list and the API payload. - **Tests** (`PiAgentConfig.test.tsx`): a unit test covers a catalog model (`Claude Sonnet 5.5 via Anthropic`), a model and a provider that aren't in any list, and an OpenRouter model. The add-agent dialog test now checks that the new hint appears and that no raw ID shows as text. - **Other places checked:** none of the other PR-changed UI files (`AgentConfigModal`, `PiLoginOptionsDialog`, `AgentLoginModal`, `AgentCredentialSetup`) show a model ID in visible text. **Not changed, outside F1:** - The model-ID box still has the placeholder `e.g. qwen/qwen3-coder`. I left it because it's an example of what to type into the box. - The login modal shows the raw provider ID, e.g. `anthropic · Credentials are saved to…`. That's a provider rather than a model, so it isn't covered by this finding. I've attached a screenshot of the add-agent dialog showing the new hint. PR: #3857 Comment by: @integry (ID: 7227576335) 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>
) * feat: add Pi live view and stored output parsing I've added live view and stored-output parsing for Pi runs. Each tool call now shows up with its result, assistant text and thinking stream as they arrive, and token usage adds up across responses. The new and nearby test suites pass, and API typecheck and lint pass. I haven't seen it work against a real running Pi task in the UI. Parser (`packages/api/services/redisOutputParserPi.ts`, new) - Routing: `parseLine` sends Pi records to the new parser before the Codex, OpenCode and Antigravity checks. That ordering matters: a Pi assistant `message_end` would otherwise pass for an OpenCode message. Records only count as Pi's if they have Pi's shape (e.g. a `session` needs a numeric `version` and an `id`; `tool_execution_*` needs a `toolCallId`), so other agents' records are left alone. - Streaming text: deltas are buffered per `contentIndex` and shown as the pending message while they stream. `text_end`/`thinking_end` replaces the buffer with the final content, and thinking is marked as reasoning. `message_end` fills in any block that never got an end event; a block that already ended isn't repeated. A finished block keeps the ID it had while streaming, so the live view doesn't jump. - Tools: - Tool calls are emitted from the assistant `message_end` blocks, which carry the arguments, or from `tool_execution_start`, whichever comes first. - Pi reports each result three times (`tool_execution_end`, the `toolResult` message, `turn_end`). Only one result per call is emitted, with its error flag. - If a result arrives for a call that was never announced, a tool_use line is added first so they still pair up. - Also: - User prompts are not shown. - Usage comes from assistant `message_end` only. - An assistant stop with `error` or `aborted` shows Pi's error message. Wiring - Fix outside the issue's list: Pi's `agent_end.messages` contains messages keyed by role, which the whole-document Vibe transcript scan could claim, swallowing the Pi stream. Both `parseRedisOutput` and the live projector (`liveOutputStream.ts`) now skip that scan when the output contains Pi lines. A test covers it and fails without the guard. - Stored output: `liveDetailsStoredOutputFormat.ts` now detects a `'pi'` format, and the live-details routes parse it through the same parser via a new `parsePiOutputToConversationResult`. Without this, the live projector held Pi output back as unidentified preamble. - Task watcher: `taskWatcher.ts` now uses the Redis watcher for `pi` tasks. - Line splitting: output is split on LF only, as Pi's docs require. Tests - `test/redisOutputParser.test.ts`, the fixture regression test: the fixture gives four tool calls, and the three results pair with their calls (the `cat missing.txt` bash call is the one error). It also checks the final assistant text, and usage of 3,785 input and 229 output tokens. - Other new tests there: - delta buffering and the pending message. - the Vibe guard. - other agents' record shapes not being read as Pi. - stored-format detection, including a startup banner and CRLF line endings. - `packages/api/test/liveOutputPi.test.ts`: reading the stream one record at a time gives the same events and IDs as one full read. - Existing suites still green: redisOutputParser (Codex, OpenCode, Vibe 3, Antigravity), liveDetails (Antigravity, Codex DB fallback, OpenCode, completed persisted), liveOutput (stream, identity, retention), agentStreamProjection, the two taskWatcher suites, and the Codex app-server and Antigravity native goal suites. The trimmed fixture has one call with no result (`7Rc4Yw8fp`) and one result whose call isn't in it (`6UNoPXH4u`). The test checks that every result has a call before it, not that every call has a result. No preview images: the Pi live view reads from Redis, and there's no Redis server here to run the UI against a Pi stream. The preview manifest suggests adding one to the agent image. ProPR-Agent: claude/claude-opus-5-5 * chore: key Pi tool result live IDs by tool-call ID I fixed F1: a Pi tool result now gets the same live ID whether it comes from `tool_execution_end` or from a copy Pi repeats later. That holds for a long-running watcher and for a fresh read after Redis trimmed the earlier record, so the UI no longer shows the same result twice. **The fix** (`packages/api/services/redisOutputParserPi.ts`, `emitToolResult`) - The result's ID used to come from the byte offset of whichever record emitted it. It now comes from the tool-call ID, so all three of Pi's copies (`tool_execution_end`, the `toolResult` message, `turn_end`) give the same ID. - Skipped repeat copies no longer reserve a numbered slot in their record. A slot only matters for events numbered by position, and results no longer are, so watcher and fresh read can't disagree about it. - Nothing changes for other agents: `withIds` and the ID scheme in `liveOutputStream.ts` are untouched. **Other Pi events.** I checked the rest of the Pi parser for the same problem and found none: - Tool calls already take their ID from the call ID. - Text, thinking and error-stop events are each emitted from only one kind of record, so trimming can't change which copy a reader sees first. **Regression test** (`packages/api/test/liveOutputPi.test.ts`) - A call is followed by its `tool_execution_end`, `toolResult` message and `turn_end`. The test compares a record-by-record watcher, a full read, and a fresh read that starts at the `toolResult` message after earlier output was trimmed. - It checks that each read has exactly one result, that the result's ID is the same in all three, and that every event in the trimmed read matches one the watcher emitted. - With the fix removed, the test fails on the ID assertion. One difference remains: in the fresh read, the result's timestamp is the `toolResult` message's own, about a second later than the watcher's, because `tool_execution_end` carries none. The call event that read adds before its result has the tool name but not the arguments. Both are under the same IDs, so they don't cause duplicates, and the test allows for them. **Verification:** - The Pi, live-output and live-details suites plus `test/redisOutputParser.test.ts`: 126 tests, 109 passed, 0 failed, 17 skipped. - API typecheck and lint on the changed files both pass. There's no preview, since nothing on screen changes beyond the duplicate no longer appearing. PR: #3856 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: key Pi text and thinking IDs by message timestamp and index I fixed F2. Pi assistant text and thinking now keep the same live ID whether a reader watched the stream without interruption or started fresh after Redis retention trimmed earlier records. The UI should no longer show the same narration twice. **The fix** (`packages/api/services/redisOutputParserPi.ts`) - **New key:** each text or thinking block is keyed by its message's timestamp and its `contentIndex`, instead of the byte offset of whichever record emitted it. I checked Pi's source (pi-ai / pi-agent-core 0.73.1): the provider stamps an assistant message once when it starts streaming, and `message_end` carries that same message object. So `message_start` and `message_end` always give the same key, and so does the block's own `text_end` or `thinking_end` in between. - **Pending message:** while a block streams it uses that same key, so the finished block still keeps the ID it had while streaming. - **Reader that missed `message_start`:** it can't know the key, so it no longer emits a block at `text_end`/`thinking_end`, or when the next block starts. It keeps showing the block as the pending message and emits it at `message_end`, under the same key and timestamp the watcher used. - **Slots:** blocks with a key no longer reserve a numbered slot in the `message_end` record. This keeps the later "Pi stopped (error)" event's ID the same across readers. - **Fallback:** if an assistant message has no timestamp, the old record-offset behaviour applies unchanged. **Tests** - **New test in `packages/api/test/liveOutputPi.test.ts`:** a message with a thinking block, a text block and an error stop is read four ways, besides the record-by-record watcher. A full read, and fresh reads starting at a thinking delta, at `thinking_end`, at `text_end` and at `message_end`. Each read must match the watcher's events exactly, IDs and timestamps included. The test also checks that each completed block keeps its streaming ID. It fails on the previous parser. - **Changed existing test** in `test/redisOutputParser.test.ts`: it gave `message_start` and `message_end` different timestamps, which Pi never does. I made them match, and updated the expected pending key to the new block key. **Verification** - The live-output and live-details suites: 105 tests, 88 passed, 0 failed, 17 skipped. - `test/redisOutputParser.test.ts`: 22 passed. - API typecheck and lint both pass. There's no preview, since nothing on screen changes beyond the duplicate no longer appearing. PR: #3856 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: remove duplicate parsePiOutputToConversationResult export I fixed the Validate Changes failure: the Core source build and the API build both pass again. **Cause:** When the epic branch was merged into this PR, `packages/api/routes/liveDetailsOutputParsers.ts` ended up with two exported functions named `parsePiOutputToConversationResult`. The epic's version uses core's `parsePiConversationLog`; this PR's version used the Redis live-view parser. TypeScript rejects the duplicate, so both builds failed. **Fix:** I kept the epic's version and deleted this PR's duplicate, plus its `parseRedisOutput` import, which nothing else in the file used. The epic's version names MCP tools `<server>/<tool>` and lists the calls a `codemode` script makes as their own tool events, and its tests in `packages/api/test/liveDetailsPiParser.test.ts` check for exactly that. The live-details route still sends `'pi'` stored output to this function. **What changes for this PR:** Saved Pi output is no longer read by the same parser as the live view. Reading the stream one record at a time still gives the same events as one full read, but that test only covers the live-view parser. **Checks run:** - The repo build and the `packages/api` typecheck pass after rebuilding shared and core. - These test suites pass: `liveDetailsPiParser`, `liveOutputPi`, `test/redisOutputParser` and the `liveDetails*` suites. - ESLint passes on the edited file with zero warnings. This is a backend build fix with nothing visible to a user, so there are no preview images. PR: #3856 Comment by: @propr-dev[bot] (ID: 7227181093) Comment by: @github-actions[bot] (ID: 7227181488) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: hold unkeyed Pi blocks until message_end to avoid duplicates I fixed F3: a Pi text or thinking block no longer shows up twice in the live view when a watcher starts reading after retention has trimmed that message's `message_start`. **The fix** (`packages/api/services/redisOutputParserPi.ts`, `processMessageUpdate`): while the parser doesn't know which message a block belongs to, it keeps buffering the deltas but no longer shows them as the pending message. Before, the block was shown under the offset of the delta record, and `message_end` then emitted it under `pi:block:<timestamp>:<index>`. `appendUniqueEvents` treated that as a new event, so the UI showed both. Now the first time the block appears is at `message_end`, under its block key, the same as a full read. When the message identity is known, the block still streams under its block key and keeps that ID when it completes. **Same defect elsewhere:** the only place the Pi parser shows a pending block is `processMessageUpdate`. The fix also covers a `message_start` that has no timestamp, which hit the same duplicate before. With pending blocks now always keyed, the branch that dropped an unkeyed earlier block on a block switch couldn't run any more, so I removed it. I also reworded one doc comment on `emitBlock` to match. **Regression test** (`packages/api/test/liveOutputPi.test.ts`): a watcher's first read starts at a delta (or at `thinking_end`, or mid-text-delta) and stops before `message_end`. The test checks that nothing is published and nothing is pending. It then feeds `message_end` as a separate read and checks that the completed blocks come out under the same IDs a full read gives, with no ID repeated. Against the HEAD parser it fails at "the read from record 3 publishes no unidentified block"; with the fix it passes. **Trade-off:** when a watcher joins a message part-way through, that message's text stays hidden until it finishes, instead of streaming in from the first retained delta. Messages the watcher sees from their start stream exactly as before. **Verification:** - `liveOutputPi` passes, 4 of 4. - `test/redisOutputParser.test.ts` passes, 22 of 22. - `liveDetailsPiParser`, `liveOutputIdentity`, `liveOutputRetention`, `liveOutputStream` and `agentStreamProjection` all pass. - API `tsc --noEmit` and eslint with `--max-warnings 0` on the changed files are clean. - `liveOutputTimestamps` ran 0 tests because it needs a real Redis server. I didn't capture a preview: the change is visible in the live view, but there's no Redis server here to run the UI against a trimmed Pi stream. The manifest suggests adding `redis-server` to the agent image. PR: #3856 Comment by: @propr-ultrafix (ID: 0) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5 * chore: derive Pi live event IDs from record data, not read start Every Pi live event ID now comes only from data in the record itself, and one test checks every start line of each stream. The new and existing Pi tests pass, along with the nearby live-output and live-details suites, API lint (`--max-warnings 0`) and API typecheck. **The fix** (`packages/api/services/redisOutputParserPi.ts`) - **Tool calls and results:** both are keyed by `toolCallId`. The parser no longer uses per-record slot numbers, so how many earlier copies a read saw can't shift an ID. - **Text and thinking blocks:** keyed by message identity plus `contentIndex`. The identity is `message.timestamp`, falling back to `responseId` only when there's no timestamp. I put the timestamp first because the captured fixtures reuse `responseId: "c1"` for every message, so `responseId` alone would collide. - **Deltas before the identity is known:** they stay buffered and unpublished until `message_end`, which publishes each block once under its final ID. When the identity is known, `text_end`/`thinking_end` publish the block under the ID it streamed under, and `message_end` doesn't add a second copy. - **Two more start-dependent paths, now removed:** - If a new block or a new message started before the previous block ended, the parser used to publish that block's partial text. Its content then depended on how many deltas a read had seen. Now the block stays buffered until `message_end` supplies the final text, and a message that never ends is not published. - The "Pi stopped (error)" note is now keyed by its message identity instead of its position in the record. **The test** (`packages/api/test/liveOutputPi.test.ts`) runs on three streams: - the captured `pi-1.6.1-json-tool-task.jsonl`. - a new fixture, `test/fixtures/pi/pi-1.6.1-json-streamed-blocks.jsonl`, with several thinking and text deltas, a tool call, and an error stop. I built it by hand from the shapes in the 1.6.1 captures; it is not a real capture. - an irregular stream: a block starting before the previous one ended, a message that never ends, and one without a timestamp. For every start line `i`, it checks your three conditions. It also feeds lines `0..k` to a line-by-line watcher, merges the result with a read from every `j ≤ k`, and checks that nothing appears under two IDs. The F1/F2/F3 regressions are still there. Three caveats: - **"A tool result's ID equals its call's ID":** I read this as both IDs derived from the same `toolCallId` (`…:tool_use:external:<id>` and `…:pi:tool_result:<id>:0`). Making them literally the same string would break your "no ID appears twice" rule, since a call and its result are separate events. The test checks that both extract to the result's `toolUseId`. - **The old parser passes on both real fixtures.** After F1–F3 it was already consistent on those streams; only the irregular stream makes it fail, at line 2. The new parser passes all three. - **Unstamped messages:** in the irregular stream, a message with no timestamp shows the time of the last stamped record, which depends on where the read started. Its ID and text are stable, so the test skips the time check for that stream only. Pi stamps every message, so this doesn't come up with real output. Not run: 17 tests in the neighbouring suites were skipped because they need a running Redis server, which this container doesn't have; they only cover other agents' streams. I made no preview images, because this change has no visible effect in the UI. PR: #3856 Comment by: @integry (ID: 7227626300) 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>
Goals can now run on Pi. A goal keeps a single Pi session across all its runs, and every later run reopens that session file, so the conversation carries through checkpoints, pauses, corrections and model changes.
How it works
- Capability: `goalCapabilities` reports Pi as goal-capable with `launch: 'goal-prompt'`, `resume: 'whole-session'`, `runningInput: 'safe-boundary-resume'`. The probe runs `pi --help` offline with nothing mounted and requires the session flags (`-p`, `--mode`, `--session`, `--session-id`, `--session-dir`, `--no-session`). `PiAgent.goalCapable` is now `true`.
- Where sessions live: each goal gets its own directory at `/tmp/git-processor/pi-goal-sessions/<goal-id>` (override with `PI_GOAL_SESSIONS_PATH`), outside Pi's disposable home. It's created at 0700 and mounted into the run.
- Owner-only: `scripts/pi-entrypoint.sh` chowns the mounted directory to `node` and sets it and its files to owner-only before Pi starts and again after it exits, including after a stop. Without this, Pi's session files come out world-readable (0644).
- New goal: the first run uses `--session-id <uuid>`, an ID ProPR assigns. The ID is saved as soon as the stream shows Pi has written the prompt to the session file. A run stopped before that saves nothing, so the next attempt starts fresh instead of resuming an empty session. To read that moment from the stream I added a small `sessionIdFromLine` option to the shared docker executor.
- Resume: later runs use `--session <exact file>`. If you point Pi 1.6.1 at a file that doesn't exist, it quietly starts an empty session there. So the worker checks the file exists first and fails the goal with a clear error if it's gone.
- Boundaries: checkpoints, model changes, pause and input go through the existing whole-session path in `processGoalJob.ts`. Goal input is sent to Pi unchanged, and direct goals protect the `.git` metadata.
- Environment: Pi now passes the per-run environment (goal mode, launch strategy, admission parent and its key) into the container by variable name. Before this, Pi dropped it; this applies to task runs too.
- Cleanup: deleting a goal removes its session directory. A finished goal keeps it so it can be continued.
- RPC mode (`--mode rpc` live steering) is not implemented; I documented it as a follow-up in `docs/docs/features/goals.md`.
The docs are also updated in `agents-and-models.md` and `architecture/agent-runtime.md`.
Testing
- New `test/piGoalSession.test.ts` (16 tests) covers the capability probe against the real Pi 1.6.1 help output, session store permissions, `--session-id` vs `--session` args, and the missing-file failure. It also covers a run that resumes and keeps the earlier conversation, and a resume after a checkpoint that delivers the checkpoint feedback into the same session.
- Two entrypoint tests in `test/piCredentials.test.ts` cover the owner-only permissions and refusing unsafe or missing directories.
- Separately, I ran the real Pi 1.6.1 binary through the real entrypoint against a mock model server. It created the session under the assigned ID and resumed it with the conversation intact ("seen 2 user messages"), with files at 0600 and directories at 0700.
- Typecheck passes for core, root and api, and lint is clean on the changed files. The existing Pi, goal, docker-executor and `processGoalJob` suites pass.
- The API goal route tests are only partly checked. `goalRoutes.test.ts` passes alone (it contains delete-route cases). Run together with `goalContinueRoute` and `goalCliRoutes`, it hit a 600s timeout with almost no output; that looks like the known hang at exit in `packages/api` tests, but I didn't confirm it.
There are no visual previews because nothing in the UI changes.
ProPR-Agent: claude/claude-opus-5-5
Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>
✅ Epic ready for final merge: Pi coding agent support6 of 6 issues merged All 6 issues have been merged into this epic branch. This epic PR is ready for final review and merge. Posted automatically by ProPR |
|
🔀 Resolved merge conflicts from Conflicting Files
Resolution SummaryAll 12 conflicted files are resolved and no conflict markers remain anywhere in the repo. Main had moved OpenCode to the new Image and scripts
Core and API
CLI, UI and docs
Tests
Verification
🤖 Resolution Details
System-triggered merge conflict resolution |
Automatically resolved merge conflicts after merging target branch into PR branch. Resolved conflicts in: - Dockerfile.agent - docs/docs/features/agents-and-models.md - packages/api/services/agentHealthCheck.ts - packages/api/services/redisOutputParser.ts - packages/api/test/agentHealthCheck.test.ts - packages/cli/src/commands/agentCommands.ts - packages/core/src/agents/types.ts - packages/core/src/agents/version/types.ts - propr-ui/src/pages/SettingsPage/AgentCredentialSetup.tsx - scripts/generate-notices.sh - scripts/smoke-test-images.sh - test/redisOutputParser.test.ts PR: #3847 Model: Claude Opus 5.5
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
|
|
CI failed: Validate Changes Please investigate and fix this CI failure.
Failure evidence
|
Checks FailedValidation failed during setup, tests, CLI packaging, linting, or build checks. View Logs |
|
✅ Applied the requested follow-up changes in commit fb16e2c Processed 2 comments:
Summary of ChangesI fixed the Validate Changes failure. It was the API lint gate: the health-check probe in Fix: I moved the code that turns a credential-check result into a health result into its own helper,
Verification (local):
There are no visual previews because nothing visible changed. Review digestRisk-tiered paths
Diff size: 1 file changed, +11/−8 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed the Validate Changes failure. It was the API lint gate: the health-check probe in `packages/api/services/agentHealthCheck.ts` had a complexity of 22, and the limit is 20. The Pi credential-check branch added in this epic pushed it over. **Fix:** I moved the code that turns a credential-check result into a health result into its own helper, `credentialCheckResult`, and the probe now just calls it. The behaviour is unchanged: - A `ready` result reports ready. - `provider_not_found` reports `unknown`. - Anything else reports `auth_required`, with the same redacted message. **Verification (local):** - `eslint . --max-warnings 0` in `packages/api` passes with no warnings. - `tsc --noEmit` in `packages/api` passes, run after rebuilding core. - The agent health-check tests pass: 31 passed, 1 skipped, 0 failed. They only run with `PROPR_DEMO_MODE=true`; without it they exit early because GitHub auth isn't configured in this container. There are no visual previews because nothing visible changed. PR: #3847 Comment by: @propr-dev[bot] (ID: 7229300577) Comment by: @github-actions[bot] (ID: 7229301096) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
🔍 AI Code Review — astraOverall EvaluationPi is integrated across the agent image, task execution, repository scouting, settings, health checks, and goal resume. Significant corrections are needed before merge. The most serious issue is a root cleanup operation that can delete host credentials after repository setup has run. Goal execution also changes permissions on repository outputs, and the CLI can direct an operator to repair the wrong credential store. ✅ Scout tool isolation — The scout disables built-in tools, reloads only ✅ Live event identity — The live parser keys tool results by call ID and streamed blocks by message identity and content index. The retention tests compare incremental reads with full reads, including when Redis has trimmed the original tool announcement. The review is partial. The issue descriptions and historical follow-up logs contain truncation notices, and 26 changed files were omitted, including Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F33: 🔴 Root cleanup can delete host credentials
F34: 🔴 Goal privacy also restricts repository outputs
F35: 🔴 Managed credential recovery targets the host store
F36: 🔴 Live MCP tool names change on completion
F37: 🔴 Pi credential checks duplicate result parsing
SuggestionsThese are optional follow-ups and are not sent to S54: 🟢 Bound live delta buffering
ScoreThe image integration, scout controls, and retention coverage are substantial. The host credential deletion path and cross-UID goal regression require correction even though current-head CI reports no failures. Score: 4/10 🤖 Review Details
Files omitted from review diff26 files were omitted from the review diff. Large, binary, generated, and lockfile changes are deprioritized. Did not fit the review context budget
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
/fix F33 F34 F35 F36 F37 All five are confirmed against af58280. F33 and F34 matter most. Narrow fixes with a regression test each.
|
|
✅ Applied the requested follow-up changes in commit a9fabf4
Summary of ChangesAll five findings (F33–F37) are fixed, each with a regression test. The two Docker smoke cases are written but I couldn't run them: this container has no Docker and no user namespaces, so they need the image CI. Every other related suite passes: the Pi entrypoint, credential, auth-check, goal-session, agent and scout suites, the post-task suite, CLI validation, the live/stored parser suites and the smoke-script structure tests. Typecheck is clean for shared, core, cli and api. ESLint is clean for the touched core and api files; the CLI files aren't covered by any ESLint config, so they weren't linted. F33 (root cleanup could delete host credentials) –
F34 (umask on the whole Pi process)
F35 (recovery hint pointed at the host store)
F36 (live MCP tool names)
F37 (duplicated result parsing)
No visual previews: none of these changes shows up in the UI. Review digestRisk-tiered paths
Diff size: 15 files changed, +437/−178 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
All five findings (F33–F37) are fixed, each with a regression test. The two Docker smoke cases are written but I couldn't run them: this container has no Docker and no user namespaces, so they need the image CI. Every other related suite passes: the Pi entrypoint, credential, auth-check, goal-session, agent and scout suites, the post-task suite, CLI validation, the live/stored parser suites and the smoke-script structure tests. Typecheck is clean for shared, core, cli and api. ESLint is clean for the touched core and api files; the CLI files aren't covered by any ESLint config, so they weren't linted. **F33 (root cleanup could delete host credentials)** – `scripts/pi-entrypoint.sh` - The baseline read now runs as root inside `prepare_runtime_home`, before the handoff to `node`. So does removing a copy that has no baseline (new `record_seeded_auth`). Both act on root's own `0700` home in `/tmp`, which no `node` process can reach yet. - The handoff is now the last step. It chowns the agent dir first and the home itself last, so `node` can't get inside while `chown` walks the tree. - After the handoff, no root step names a path in the home. The "credentials imported" message now comes from root's recorded state, and the post-task read already ran as `node`. - Audit result: as root the entrypoint now refuses any home other than `/tmp/propr-pi-home`. Any other location could sit under a `node`-writable parent. Production always uses the standard path, and login mode doesn't use this home. The goal-store descriptor is a bind-mount point, which can't be renamed, so it was already safe. - Tests: - A unit test checks the ordering: baseline before handoff, and no root use of the home afterwards. - Another checks behaviour: a failed baseline drops only the run copy, and the host file is unchanged. - A new smoke case starts a `node` process that swaps `agent` for a symlink to the source. It asserts the swap happened and that the host `auth.json` and the source directory are unchanged. **F34 (umask on the whole Pi process)** - The goal-mode `umask 077` is gone, so the task keeps its normal umask. - The goal store is opened to `node` through group bits only (`0770`), never the "other" bits. If the store's group isn't one of `node`'s groups, root first sets it to `node`'s group, through the pinned descriptor. Afterwards it restores `0700` and the original group. - Session files are still made owner-only in the epilogue and again by the next run's prepare. - I updated the docs and the `piGoalSession.ts` comment to match. - Tests: - Unit tests check that worktree outputs keep normal modes (`644`/`755`) with and without a goal. - A killed run's session file is fixed to `600` by the next run's prepare. - The grant never uses the other bits. - The cross-UID smoke case checks the store's owner, group and mode during the run. The task creates a file and a nested directory in the worktree, and the worker UID then reads and lists them. **F35 (recovery hint pointed at the host store)** - `piCredentialRecoveryHint` offers `propr agent login pi --provider …` only when its destination (`HOST_PI_DIR`, or `~/.pi/agent` by default) is the store that was checked. - Otherwise it points to that agent's own login in Settings → Agents, by agent ID. - The local image check had the same wrong hint for a managed store, and it now uses this too. - The CLI test that asserted the old wrong hint now asserts the Settings hint. New cases check the host-dir agent (CLI hint) and the local check. **F36 (live MCP tool names)** - The live parser now names tools with the same `readablePiToolName` as the stored parser, which is now exported from `@propr/core`. - The live-vs-stored comparison now runs on the scout and codemode fixtures too. It decodes the call IDs, which the live view stores URL-encoded (`call_1%2F1`). **F37 (duplicated result parsing)** - `parsePiAuthCheckResult` and `interpretPiAuthCheckResult` now live in `packages/shared/src/piAuthStore.ts`, including the ANSI stripping. Both core's health check and the CLI use them. - Docker execution, CLI presentation and core's error messages stay where they were. - A new test runs colour-decorated output through core. That path had no ANSI stripping before. No visual previews: none of these changes shows up in the UI. PR: #3847 Comment by: @integry (ID: 7245535517) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
|
/review fable astra |
|
✅ AI Code Review Complete requested by @integry Posted 2 reviews: |
🔍 AI Code Review — fableOverall EvaluationThis epic adds Pi 1.6.1 as a sixth agent across the image, entrypoint, task and analysis runs, live and stored parsing, settings UI, CLI, health check, diagnostics and goals. I reviewed it by static trace only (no commands were run) and found no verified merge blocker. Seven current-head checks are still pending, including all four test shards and Validate Changes, so merge readiness is conditional on them finishing green. Three paths could not be confirmed from the supplied code and are worth a quick check before merge:
✅ Privileged steps are confined around the unprivileged task — ✅ Refresh write-back is narrow and fail-safe — ✅ Live and stored views are tested for parity on recorded traces — Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S55: 🟢 Confirm goal-store cleanup from the API
S56: 🟢 Restricted-network allowlist covers fewer providers than the UI offers
S57: 🟢 Analysis workspace readability for
|
🔍 AI Code Review — astraOverall EvaluationPR #3847 integrates Pi 1.6.1 into the agent image, task execution, analysis, live output, settings, and goals. Changes are needed before merge. The supplied code shows cases where a saved agent checks the wrong provider, stored output loses tool evidence visible during the run, and goal resume accepts a session path that Pi cannot reopen. ✅ Image and version checks agree — The Dockerfile verifies the pinned version and required CLI flags. The build script includes Pi’s version and runtime scripts in the bundle identity. ✅ Scout tools are explicitly restricted — The scout disables built-in tools, loads The review is partial. The issue descriptions and historical logs contain truncation notices, and 17 diff files were omitted, including Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F38: 🔴 API-key setup can save an unusable default
F39: 🔴 Stored output drops retained tool results
F40: 🔴 Goal resume follows session-file symlinks
F41: 🔴 Provider login defaults to an unsupported method
SuggestionsThese are optional follow-ups and are not sent to S63: 🟢 Share Pi record detection
S64: 🟢 Clarify host and managed loginThe new Pi paragraph in ScoreThe image integration and scout restrictions have concrete coverage. Four localized defects remain in credential selection, login, stored traces, and session resume, including two cases where the new tests accept an unusable configuration. Score: 6/10 🤖 Review Details
Files omitted from review diff17 files were omitted from the review diff. Large, binary, generated, and lockfile changes are deprioritized. Did not fit the review context budget
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
/fix F38 F39 F40 F41 All four are confirmed against a9fabf4. Small, narrow fixes, with a regression test each.
|
|
✅ Applied the requested follow-up changes in commit 9900bc8
Summary of ChangesI fixed all four findings, each with a regression test. 197 tests pass across the affected Pi, login, CLI, live-view and stored-output files, plus all 413 UI tests in the Settings page folder. Typecheck and zero-warning lint are clean on the changed files. F40: goal resume follows symlinks.
F39: stored output drops retained tool results. The stored parser (
I also moved the session case into its own method, because the new case pushed F41: login defaults to an unsupported method.
Tests: the API Google case now expects One behaviour to know: a key-only provider always uses F38: API-key setup saves an unusable default. A new Pi agent in API-key mode now saves a default model that the entered keys can use:
The OpenRouter-only form test now asserts the saved default is I checked the sibling setup paths in the CLI and local setup, and none of them choose a default model for API-key setup, so nothing else needed this fix. I didn't capture previews: the visible change is only a new error message in the form's existing error area. Review digestRisk-tiered paths
Diff size: 15 files changed, +230/−18 lines 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
I fixed all four findings, each with a regression test. 197 tests pass across the affected Pi, login, CLI, live-view and stored-output files, plus all 413 UI tests in the Settings page folder. Typecheck and zero-warning lint are clean on the changed files.
**F40: goal resume follows symlinks.** `findPiGoalSessionFile` now lists the directory with `readdirSync(..., { withFileTypes: true })` and keeps only entries that are themselves regular files. Symlinks are never followed, so a dangling link can't throw. Two new tests in `test/piGoalSession.test.ts`:
- A store holding only a symlink to a real file outside it: nothing is found, and the resume fails with the "missing" error.
- A valid file next to a dangling link that sorts after it: the valid file is resumed. The old code would have thrown here.
**F39: stored output drops retained tool results.** The stored parser (`PiOutputAccumulator`) now handles `turn_end`. Each `toolResults` entry goes through the same `addToolResult` deduplication as the other copies: it announces the call if needed, keeps `isError`, and uses the result's own timestamp. Two new parity tests in `packages/api/test/liveDetailsPiParser.test.ts`:
- A stream that starts at `turn_end` with a failed result: the live and stored views both show the call and the failed result, with its content.
- A full sequence ending in `turn_end`: still exactly one result.
I also moved the session case into its own method, because the new case pushed `add` over the lint complexity limit.
**F41: login defaults to an unsupported method.**
- **Shared logic:** a new `isPiKeyOnlyProvider` (a known provider without account login) and a new `resolveAgentLoginOptions` in `packages/shared`. When a known key-only provider is chosen, the method defaults to `--api-key`, and `buildAgentLoginCommand` uses this.
- **API:** `resolveLoginOptions` returns the resolved options, so the session reports the method the command actually uses.
- **CLI:** `propr agent login pi --provider google` gets `--api-key` from the same builder, and its help text says so.
Tests: the API Google case now expects `apiKey: true` and checks the docker command ends in `google --api-key`. The builder and `planAgentLogin` tests cover `google`, plus a provider outside the catalog that keeps `--no-browser`.
One behaviour to know: a key-only provider always uses `--api-key`, even if a caller explicitly asks for account login. The route, UI and CLI only ever send `apiKey: true` or nothing, so in practice this only applies when the method is omitted.
**F38: API-key setup saves an unusable default.** A new Pi agent in API-key mode now saves a default model that the entered keys can use:
- It keeps the chosen default if that provider's key was entered; otherwise it picks the first selected model whose provider has a key.
- If no selected model fits the entered keys, the form refuses to save with an error message.
- A provider outside the catalog counts as covered by any entered `*_API_KEY`/`*_TOKEN`, since ProPR doesn't know which variable Pi reads for it.
The OpenRouter-only form test now asserts the saved default is `pi-openrouter/mistralai/devstral-2512`. That assertion fails on the old code, which saved the Anthropic default. New tests cover the refusal and the default-selection helper.
I checked the sibling setup paths in the CLI and local setup, and none of them choose a default model for API-key setup, so nothing else needed this fix. I didn't capture previews: the visible change is only a new error message in the form's existing error area.
PR: #3847
Comment by: @integry (ID: 7246105267)
Model: Claude Opus 5.5
ProPR-Agent: claude/claude-opus-5-5
|
/review fable astra |
|
✅ AI Code Review Complete requested by @integry Posted 2 reviews: |
🔍 AI Code Review — fableOverall EvaluationThis epic adds Pi as a sixth coding agent: image stage and entrypoint, credential import and write-back, Three limits on this pass:
✅ Root steps finish before the disposable home is handed to node — ✅ Write-back is a per-entry compare-and-swap limited to refresh fields — ✅ Live event IDs do not depend on where a read starts — Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S65: 🟢 Check Pi
|
🔍 AI Code Review — astraOverall EvaluationPR #3847 integrates Pi 1.6.1 across the agent image, task execution, analysis, goal sessions, settings, and live output. It needs changes before merge. A retained Pi trace can lose an entire assistant response, and a successful goal deletion can leave its conversation on disk. ✅ Pinned runtime — The Docker build checks Pi’s exact version and all eight required help flags. Both bundle-content lists include the entrypoint and credential helper. ✅ Credential checks match task configuration — The stack health check selects the default model’s provider, forwards configured keys by environment-variable name, and runs with a read-only credential mount, This was a static review. The supplied diff omits 24 files, including Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F42: 🔴 Recover assistant responses from retained records
F43: 🔴 Keep failed goal cleanup retryable
F44: 🔴 Preserve tool-result timestamps in live replay
F45: 🔴 Use one Pi record discriminator
SuggestionsThese are optional follow-ups and are not sent to S73: 🟢 Explain restricted-network provider coverageThe settings picker offers providers including Mistral, DeepSeek, and Groq, while the Pi base egress list covers a smaller set. A brief hint beside provider selection could tell restricted-network operators when a deployment allowlist entry is needed. This is optional because the curated default models already use providers covered by the base list. ScoreThe image and health-check integration are well supported by the visible code. Lost replay data and non-retryable session cleanup affect requested behavior directly and warrant correction before merge. Score: 6/10 🤖 Review Details
Files omitted from review diff24 files were omitted from the review diff. Large, binary, generated, and lockfile changes are deprioritized. Did not fit the review context budget
Copy and edit to choose records from this review: 🤖 Review by ProPR |
✅ Epic merged: Pi coding agent supportEpic PR #3847 has been merged into main. 6 of 6 issues merged into main through this epic PR. All planned epic work is now merged. Posted automatically by ProPR |
I fixed the Shard 1/4 failure. The only failing file was `test/agentRunSpecStartsAsRoot.test.ts`, which now passes locally (10/10). I didn't run the rest of the shard or the other shards. **Cause:** the merge from main (#3847) brought in the new Pi agent type. This test requires every agent type to supply an `AgentRunSpec` (the structured run description from this epic), and Pi doesn't build one on this branch. It still assembles a raw `docker run` argument list and only runs on local Docker. So two tests failed: "every agent type has a task spec case", and the `pi` iteration, which had no spec builder to call. **Fix (test only, no source changes):** in `test/agentRunSpecStartsAsRoot.test.ts`: - Pi is now listed as one of the agent types that still build raw Docker arguments. The coverage check counts those types plus the ones with specs, so a new agent type added without a case still fails it. - A new Pi test checks: - its task arguments start as root (`--user 0:0`, before the image). - they don't drop the CHOWN capability. - they include the setup wrapper (`--entrypoint /bin/bash`). - The same test checks that Fly Machines and Sprites refuse Pi. Those are the runtimes where the clone root check matters, so this stays enforced: if either one ever accepts Pi before Pi builds a proper spec, the test fails. Moving Pi onto `AgentRunSpec` properly would be a bigger change than this request, so I left it out. That's why Pi is tested on its raw arguments for now. Nothing visible changed, so there are no previews. PR: #3774 Comment by: @propr-dev[bot] (ID: 7247150384) Model: Claude Opus 5.5 ProPR-Agent: claude/claude-opus-5-5
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
… 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>
Pi coding agent support
This Epic PR aggregates all changes for the plan: Pi coding agent support
Issues in this Epic
Auto-close
When this PR is merged, the following issues will be automatically closed:
Fixes #3831
Fixes #3832
Fixes #3833
Fixes #3834
Fixes #3835
Fixes #3836
Created automatically by ProPR