Skip to content

[Epic] Agents v1: Scheduled Autonomous Report Agents Platform - #2821

Merged
integry merged 26 commits into
mainfrom
2800-epic-agents-v1-y7t
Oct 7, 2026
Merged

integry merged 26 commits into
mainfrom
2800-epic-agents-v1-y7t

Conversation

@propr-dev

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

Copy link
Copy Markdown
Contributor

Agents v1: Scheduled Autonomous Report Agents Platform

This Epic PR aggregates all changes for the plan: Agents v1: Scheduled Autonomous Report Agents Platform

Issues in this Epic

Auto-close

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

Fixes #2800
Fixes #2801
Fixes #2802
Fixes #2803
Fixes #2804
Fixes #2805
Fixes #2806
Fixes #2807
Fixes #2808
Fixes #2809
Fixes #2810
Fixes #2811
Fixes #2812
Fixes #2813
Fixes #2814
Fixes #2815
Fixes #2816


Created automatically by ProPR

…issue #2800. The shared package builds, `npm run typecheck` is clean, and the new test file passes (21 of 21 tests).

To get the build and typecheck running I first had to install dependencies with `npm ci --ignore-scripts`, since this worktree had none. I also had to build `@propr/local-setup`: before that, typecheck failed in `packages/api/publicInstanceIdentity.ts` because it couldn't find that module. That error had nothing to do with this change.

`packages/shared/src/agentDefinitions.ts`
- Everything the issue lists, written in the same style as `goalCreation.ts`: plain functions that return a user-facing error string or `null`.
- `isUnattendedTrigger` returns `false` only for `manual`.
- Repository handles reuse `GOAL_REPOSITORY_PATTERN`.
- `AGENT_TYPES_SUPPORTING_PROPR_MCP` is `['claude', 'codex']`, with a small helper `agentTypeSupportsProprMcp`.
- `validateAgentDefinitionInput(input, { partial })` rejects every case in the acceptance criteria. As the issue specifies, it does not require `propr_mcp` for `auto`.
- My additions, beyond the spec:
  - The validator also rejects duplicate repositories or capabilities, and checks `enabled`, `agentId`, `model` and `previousReportCount` when they are given.
  - I added defaults (capabilities `['repository_read']`, autonomy `dry_run`) and type guards for each vocabulary list.

Limits I chose (the issue didn't give numbers, so adjust as you see fit):

| Limit | Value |
| --- | --- |
| Name | 100 characters |
| Description | 1,000 characters |
| Prompt | 32,768 characters |
| Repositories | 10 |
| Attachments | 10 |
| Previous reports | up to 5 (default 0), 50,000 characters combined |
| Schedule expression | 128 characters |

The interfaces also include fields of my own, such as `reportTaskId` and `actingTaskId` on `AgentRun`. Later issues may want to reshape them.

`packages/shared/src/cronSchedule.ts`
- `parseCronExpression` handles everything the issue lists. It also accepts both 0 and 7 as Sunday. When both day-of-month and day-of-week are set, a day matches if either one does, which is how standard cron behaves.
- `nextCronOccurrence` works in UTC only and steps minute by minute, skipping days and hours that can't match. It gives up and throws after 366 days.
- `validateAgentSchedule`:
  - Rejects malformed expressions and anything that fires more often than every 15 minutes. This includes gaps that cross midnight, such as 23:55 followed by 00:05.
  - Rejects schedules that never fire (`0 0 31 2 *`) and ones that fire less than once a year, such as `0 0 29 2 *`. Without that check the scheduler's 366-day search could throw on a schedule that validation had accepted.

Other changes
- Both modules are re-exported from `packages/shared/src/index.ts`.
- `test/agentDefinitionsContract.test.ts` covers every acceptance case: `*/15` after 10:07Z gives 10:15Z, `@daily` gives the next midnight, `0 9 * * 1-5` skips the weekend, and the validation rejections.

There's nothing visual in this change, so I didn't create any previews.
@propr-dev propr-dev Bot added the AI label Oct 6, 2026
propr-dev Bot and others added 9 commits October 6, 2026 13:43
…. The new test file passes (10 of 10), `npm run typecheck` is clean, and the migration applies and rolls back cleanly on a file database built from all the earlier migrations.

Migration (`packages/core/src/db/migrations/20261006000000_create_agent_definitions.js`)
- Creates `agent_definitions` and `agent_runs` with the columns, defaults and indexes the issue lists.
- Deleting a definition deletes its runs.
- `(definition_id, idempotency_key)` is unique. Rows with no key are never treated as duplicates.
- `down` drops `agent_runs` first, then `agent_definitions`.

Store (`packages/core/src/services/agents/agentDefinitionStore.ts`)
- It has the seven functions the issue lists. Each takes an optional `{ database, now }`, the same way `epicExecutionQueue` does, and every read, update and delete filters by owner. Another owner's definition comes back as `undefined` (or `false` from delete).
- Bad stored data: if a JSON column can't be read, it becomes an empty array. Unknown capabilities and attachments without an id are dropped, and an unknown autonomy mode falls back to `dry_run`. So one damaged row can't break the list page.
- Next run time: it's recalculated in UTC whenever the cron, the schedule switch or the enabled flag changes, and set on create. It stays empty unless the definition is enabled, scheduled and has a cron.
- Revisions: a stale `expectedRevision` throws an error with `status: 409`. The write also checks the revision it read, so two simultaneous edits can't both succeed.
- Store types: the store uses its own types, which match the database columns rather than the shared `AgentDefinition` contract from issue 1. The two use different names and units (for example epoch milliseconds here, ISO strings there), so they'll need mapping or aligning when the API is built.
- It's exported from `packages/core/src/index.ts`.

Choices the issue didn't settle:
- Attachments don't change the revision. `setAgentDefinitionAttachments` updates `updated_at` only, so uploading a file doesn't make an open edit fail with 409. Say if you'd rather it counted as an edit.
- Schedules are UTC only. The timezone column is always written as `'UTC'` and the store has no way to set it, matching issue 1's UTC-only scheduling.
- A bad cron is rejected with `status: 400` when the store has to calculate the next run time.
- Paging uses `{ limit, offset }` (default 50, at most 200), newest first, and returns `{ definitions, total, limit, offset }`.

Tests (`test/agentDefinitionStore.test.ts`) run the real migrations against an in-memory SQLite database. They cover each acceptance criterion, plus a damaged-JSON row, the 400 on a bad cron and the unique run key.

Rolling back the whole database in one step (all 79 migrations) failed in another migration's rollback. I didn't track down which one. Rolling back just this migration and reapplying it worked.

Nothing in this change is visible in the UI, so I didn't create any previews.
…y module that writes `agent_runs`, and exported it from `packages/core/src/index.ts`. The new tests pass (13 of 13) and `npm run typecheck` is clean. Like the earlier agent tests, they have to be run with `tsx`, which is how `npm run test:server` runs them. Plain `node --test` fails on an import path in the existing definition store.

How the store meets the issue
- Creating a run: `createAgentRun` ignores a duplicate `(definition_id, idempotency_key)` insert and returns the stored row. A replay with the same key gives `created: false` and the same run. Runs created without a key never count as duplicates. Each run keeps a copy of the definition as it was and its autonomy mode, so later edits don't change it.
- State changes: every change is a single update that only applies if the run is still in one of the allowed `from` states. It returns `null` if another process got there first or the run is missing. A late `cancelled → report_ready` returns `null` and the row is untouched.
- Illegal transitions: `AGENT_RUN_TRANSITIONS` lists the allowed moves exactly as in the issue. Asking for a pair it doesn't allow, or an empty `from` list, throws an error.
- Timestamps and counters: moving to `running` sets `started_at` the first time only, `report_ready` sets `reported_at`, and terminal states set `finished_at`. Moving to `deferred` requires `deferredUntil` and adds one to `deferrals`.
- Reports: a report is cut to `AGENT_REPORT_MAX_CHARS` when written and `report_truncated` is set.
- Reads: `getAgentRun` and `listAgentRuns` (newest first, paged like the definition store) only return the owner's runs; `getAgentRun(id, 'other')` returns `undefined`. `getAgentRunById` is the internal unscoped read. `listDueDeferredRuns` returns deferred runs whose time has passed, oldest due first.
- Previous reports: `listPreviousReports` returns `{ runId, reportedAt, report }` newest first, up to `limit`. It only includes runs in `report_ready`, `awaiting_approval`, `acting`, `completed` or `rejected`, so failed and skipped runs are left out.

Choices the issue didn't settle
- `AGENT_REPORT_MAX_CHARS` didn't exist, so I added it to the shared agent contract at 100,000 characters. Change the number if you want a different limit.
- `listPreviousReports` also takes an optional `excludeRunId`. `beforeCreatedAt` alone could still include the current run if another run was created in the same millisecond.
- A run can be created directly as `queued`, `deferred` (which needs `deferredUntil` and counts as one deferral) or `skipped` (which sets `finished_at`).
- The autonomy notes in the transition table, such as `completed (dry_run)`, are comments only. The store doesn't check the run's autonomy mode, so the callers in later issues have to choose the right next state.
- A stored state the store doesn't recognise is read back as `failed`, so the scheduler never picks that run up again.

Tests (`test/agentRunStore.test.ts`) run the real migrations on an in-memory SQLite database. They cover each acceptance criterion, plus report truncation, deferral, paging and a damaged row.

Nothing here is visible in the UI, so there are no previews.
…, schedule, API/MCP/CLI) will call, along with the agent-run job types and worker dispatch. Typecheck and lint are clean. The new `test/agentRunTrigger.test.ts`, the agent run store tests, `test/worker.test.ts` and `test/taskIntentWithdrawal.test.ts` all pass under `npm run test:server`. Plain `tsx --test` won't run these: the trigger and store tests need `NODE_ENV=test` to get past the GitHub-auth startup check, and the withdrawal test needs node's module-mock flag. The suite runner provides both.

What a trigger does (`packages/core/src/services/agents/agentRunTrigger.ts`):
1. Replay: if the idempotency key already has a run, that run comes back unchanged. Nothing is enqueued and the gate isn't asked again.
2. Disabled definition: throws 409 `AGENT_DISABLED`.
3. Runtime check fails: throws 400 `AGENT_INVALID`. Neither error creates a run.
4. Gate: if it says `skip` or `defer`, the run is created as `skipped` or `deferred` and nothing is enqueued.
5. Otherwise: the run is created as `queued` and the report phase is enqueued with `attempts: 1`.
6. Queue failure: the run is marked `failed` with a reason naming the job queue and the underlying error, and the error is rethrown.

Jobs use the ID `agent-run-<runId>-<phase>`, so BullMQ drops a second enqueue of the same phase. The queue, database and config loaders are all injectable, so the tests use a fake queue and an in-memory database with no Redis.

Choices beyond the issue text:
- Replay comes first. A replayed key returns the original run even if the definition has since been disabled or made invalid.
- Acting step needs a supported agent. Preview and auto runs always use `propr_mcp` in their acting step, so they need a supported agent type even if the capability isn't ticked.
- Synthetic agents with `propr_mcp`. They pass only if every enabled member of the chosen model routes to a supported type, because the router can pick any of them.
- No agent set. This passes, and the worker will use the default agent. A model with no agent is rejected.
- Defer reasons are only logged. The store has no column for them; skip reasons are saved in `skipReason`.
- New store helper. I added `getAgentRunByIdempotencyKey` to `agentRunStore.ts`, which stays the only module that writes `agent_runs`.

Worker: `processAgentRun` and `processAgentAction` are wired into `src/workerFactory.ts` and `src/worker.ts`. Until issues 7 and 10 land, their stand-in processors in `src/jobs/processAgentRunJob.ts` mark the run `failed` with "Not implemented" and then throw, so runs don't sit in `queued` or `acting`. I updated the worker dispatch test and the withdrawal test's processor map to include the two new names.

The job types and `agentRunTrigger.ts` are exported from `packages/core/src/index.ts`. Nothing visible changed, so there are no previews.
…15) under `node scripts/run-test-suite.mjs`, and typecheck and eslint are clean. I didn't boot the real server, so `assertNoDuplicateRoutes` hasn't actually run. A scan of the route tables in `server.ts` and `packages/api/routes/` found no duplicate method+path pairs.

What was added
- Routes: `packages/api/routes/agentDefinitionRoutes.ts` has all 12 routes from the issue, registered in `packages/api/server.ts` under `/api/agent-definitions` and `/api/agent-runs`.
- Delete guard: a small read helper, `hasAgentRunInStates`, in `agentRunStore.ts`. Delete uses it to refuse with 409 `AGENT_RUN_ACTIVE` while a run is `running` or `acting`.
- Tests: `packages/api/test/agentDefinitionRoutes.test.ts`.

How the rules are met
- Owner scoping: every route returns 401 without a user. Another user gets 404 on every route, never 403.
- Demo mode: confirmed that the existing global middleware already blocks every non-GET request under `/api`.
- Repository grant: checked on create, on update only when the repository set actually changes (ignoring case), and on every trigger. A repository the user can't read returns 404 `REPOSITORY_NOT_ACCESSIBLE`.
- Validation: `validateAgentDefinitionInput` runs first, then `validateAgentDefinitionRuntime`. On create the runtime check uses the would-be definition before it is saved. A failure returns 400 `AGENT_INVALID`.
- Trigger:
  - Returns 202 `{ run, created }`. A repeated `Idempotency-Key` returns 200 with the same run and nothing is enqueued again.
  - The trigger kind defaults to `manual` for a browser session and `api` otherwise. `cli` is accepted; `schedule` and `mcp` get 400.
  - A `gate` service hook is in place and defaults to undefined.
- Cancel: the run is marked `cancelled` first, so a late worker write can't bring it back. For a `running` run it then calls `stopTaskExecution(reportTaskId)`. If stopping the task fails, that is logged and the cancel still succeeds.
- Input files:
  - Uploads use the goal attachment multer, wrapped so a rejected file gets a JSON 400 instead of an HTML error.
  - Files are stored under `storage/agent-definitions/<definitionId>/`, with a limit of 10 files per agent.
  - Responses never include stored file paths.
  - Deleting an agent also removes its folder.
- Errors: core errors come back as `{ error, code }` with their own status.

Decisions you may want to review
- Field names don't match between request and response. Requests use the shared input names (`autonomy`, `schedule`, `agentId`, `model`, `previousReportCount`), but responses return the store's field names (`autonomyMode`, `scheduleCron`, `agentAlias`, …). I did this because the responses need `revision` and `attachments`, which the shared `AgentDefinition` type lacks. The UI work in #2814 will have to handle the mismatch, or we add a mapping to the shared shape.
- The default for previous reports follows the shared contract (0), not the store's default (1). On create, if `previousReportCount` is omitted, previous reports are off.
- Default trigger source: when the caller doesn't pass `source`, it is recorded as `user:<ownerId>`.
- Cancelling an `acting` run also stops its acting task, which goes slightly beyond the issue.
- Attachment uploads can race. Adding files reads the list and then writes it back, so two uploads at the same moment could lose one of them.

There are no visual previews because nothing in the UI changed.

The Gmail, Google Calendar and Google Drive connectors need authorizing in your claude.ai connector settings before they can be used. This task didn't need them.
…/agentRuns/reportPrompt.ts`. The new tests pass (13 of 13) under `node scripts/run-test-suite.mjs`, `npm run typecheck` is clean, and eslint reports no errors on the new module. The existing agent contract tests still pass.

`buildAgentReportPrompt(input)`
- Sections: it builds the six sections in the order the issue lists.
  - Role and boundaries: produce a report; don't modify files, commit or open pull requests. When `propr_mcp` is enabled, it adds that MCP tools are for reading context only and acting happens in a later step.
  - Capabilities: each of repository code, web and ProPR MCP is stated as available or not, with a line telling the model not to claim it used anything it doesn't have. Repository code counts as available only when the definition has `repository_read` *and* `workspace.repositoriesReadable` is true. When it is, the checkout paths are listed.
  - Task: the user's prompt inside `<agent-task>`, with the agent name and run info.
  - Input files: inside `<input-files>`, labelled as data, not instructions.
  - Previous reports: only when `includePreviousReports` is set. They are listed newest first, each inside `<previous-report run="…" reported-at="…">` and labelled as data. Long reports are cut with a `[truncated]` marker, and the "Compare with the previous report(s)…" instruction follows. If there are no previous reports yet, it says this is the first run.
  - Output: the Markdown report instructions. It asks for no JSON.
- Fence escaping: a closing tag such as `</previous-report>` inside user content becomes `<\/previous-report>`, including case and spacing variants, so it can't close its own fence. Run IDs and file names are cleaned so they can't break the tag attributes.
- Size limit: if the prompt would exceed 200,000 characters, the oldest previous reports are dropped first, then files are cut from the end of the list. Each cut is noted in the prompt.

`extractAgentReport(result)` uses `summary`, then the last assistant text in `conversationLog`, then `rawOutput`. It then runs the text through `sanitizeAgentReport` and `redactSecrets`.

Things to review:
- New constants. `AGENT_PREVIOUS_REPORT_MAX_CHARS` didn't exist, so I added it to `packages/shared/src/agentDefinitions.ts`. I set it to 10,000 per report: the existing 50,000 combined limit divided by the 5-report maximum. I also added `AGENT_REPORT_PROMPT_MAX_CHARS` (200,000) there.
- Import from `@propr/core`. The spec says the module should import nothing from `@propr/core`, but it also wants `extractAgentReport` in this file using core's sanitizer and redactor. So that one function imports from core, and the prompt builder itself uses nothing from core.
- Workspace fields are paths. I treated `primaryRepository` and `contextRepositories` as checkout paths inside the container, since the prompt has to say "available at `<path>`". The repository names from the definition are listed separately.
- Test cleanup. Importing `@propr/core` opens the shared database connection, which kept the test process from exiting. The test file closes it in an `after()` hook, as other tests here do.

There are no previews because nothing in the UI changed.

The Gmail, Google Calendar and Google Drive connectors need authorizing in your claude.ai connector settings before they can be used. This task didn't need them.
* The run is still going; I'll pick it up when it reports back.

* feat(ai): I fixed the two lint warnings that failed the Core Lint step of CI. `npx eslint src/ --max-warnings 0` now passes with no warnings, `npm run typecheck` is clean, and `test/processAgentRunJob.test.ts` passes. I didn't run the rest of the test suite. No previews, since nothing visible changed.

I fixed the two lint warnings that failed the Core Lint step of CI. `npx eslint src/ --max-warnings 0` now passes with no warnings, `npm run typecheck` is clean, and `test/processAgentRunJob.test.ts` passes. I didn't run the rest of the test suite. No previews, since nothing visible changed.

- **Too many parameters in `copyAgentInputFiles`** (`src/jobs/agentRuns/workspace.ts`): the optional `log` and `inputRoot` arguments are now one options object, `{ log?, inputRoot? }`. I updated the two calls in the same file and the two in `test/processAgentRunJob.test.ts` to match.
- **Complexity too high in `processAgentRun`** (`src/jobs/processAgentRunJob.ts`): I moved three pieces out into small helpers without changing how a run behaves:
  - `reportFromResult` throws if the agent failed or gave an empty report, otherwise returns the report.
  - `previousReportsFor` fetches earlier reports only when the definition asks for them.
  - `failRunningRun` holds what used to be the `catch` block: it works out the failure reason (including the usage-limit case), marks the run failed, and marks the task failed.

PR: #2839
Comment by: @propr-dev[bot] (ID: 6020576741)
Comment by: @github-actions[bot] (ID: 6020577591)
Model: Claude Opus 5.5

* feat(ai): I fixed both findings in `src/jobs/processAgentRunJob.ts`. The processor tests pass (20 of 20), and `npm run typecheck` and `npx eslint src/ --max-warnings 0` are clean. Against the previous processor code, 4 of the 5 new tests fail. The fifth, for a duplicate delivery, passes either way because the old code skipped every non-queued run. I didn't run the rest of the test suite. No previews, since nothing visible changed.

I fixed both findings in `src/jobs/processAgentRunJob.ts`. The processor tests pass (20 of 20), and `npm run typecheck` and `npx eslint src/ --max-warnings 0` are clean. Against the previous processor code, 4 of the 5 new tests fail. The fifth, for a duplicate delivery, passes either way because the old code skipped every non-queued run. I didn't run the rest of the test suite. No previews, since nothing visible changed.

**F1 – interrupted runs.** When a job is delivered again and its run is still `running`, the processor no longer ignores it:
- **Abandoned attempt:** the queue only delivers an active job again after its lock has lapsed, so the earlier attempt is treated as dead. The run is moved from `running` to `failed`, with the reason "The worker running this report stopped before it finished; trigger the agent again", and the task is marked failed. I chose not to re-execute, because if the old attempt were in fact still running, the agent would run twice.
- **Attempt still running in this worker:** the processor now tracks the runs it is executing. A delivery for one of those is skipped and leaves the run alone.
- **Run cancelled in the meantime:** if the move to `failed` loses to a cancel, the task follows the run's actual state instead.

**F2 – late cancellation.** When storing the report is rejected because the run is no longer `running`, the processor now reads the run's current state. It marks the task cancelled (or failed, if the run was failed as abandoned) instead of leaving it in post-processing. The task store never overwrites a task that has already finished, so a task the cancel endpoint did stop keeps the state it was given.

The same mistake existed on the error path. If the run was cancelled and the agent then failed (for example, its container was killed), the task was marked failed while the run said cancelled. That path now checks the run's state the same way.

New tests cover:
- a late report after a cancel the endpoint couldn't stop.
- a cancel followed by an agent failure.
- a delivery after an interrupted worker.
- an abandoned run that is cancelled while being recovered.
- a duplicate delivery while the run is still executing.

**What this can't prevent:**
- A worker on another machine that froze long enough to lose its lock may still be running the agent when its run is failed. Its later result is then discarded and its task ends as failed, but its container isn't stopped from here.
- The workspace of a worker that died isn't cleaned up. That was already the case and is outside these two findings.

The Gmail, Google Calendar and Google Drive connectors need to be authorized in claude.ai's connector settings before they can be used. I didn't need them for this.

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

* feat(ai): I fixed F3, F4 and F5. `test/processAgentRunJob.test.ts` and `test/agentRunTrigger.test.ts` pass (30 of 30). Root and `packages/core` typecheck are clean, and eslint reports no warnings on `src/` or the changed core file. I added 10 regression tests, and all 10 fail when run against the previous source. I didn't run the rest of the test suite. No previews, since nothing visible changed.

I fixed F3, F4 and F5. `test/processAgentRunJob.test.ts` and `test/agentRunTrigger.test.ts` pass (30 of 30). Root and `packages/core` typecheck are clean, and eslint reports no warnings on `src/` or the changed core file. I added 10 regression tests, and all 10 fail when run against the previous source. I didn't run the rest of the test suite. No previews, since nothing visible changed.

**F3 – a redelivery now finishes a run whose report is already stored** (`src/jobs/processAgentRunJob.ts`)
- When a delivery arrives for a `report_ready` or `completed` run that already has a report, the processor finishes the remaining steps without running the agent again. A dry run is moved to `completed`. Preview and auto runs stay in `report_ready`. In both cases the report task is marked completed.
- These steps are safe to repeat. A run that was already advanced isn't advanced again, and a task that already ended is left alone, so a duplicate delivery doesn't re-complete the task or send a second Inbox notification.
- The normal path and redeliveries share this code. If finishing fails after the report is stored, the error is now thrown so the next delivery can finish the run. Before, that failure marked a run with a stored report as `failed`.
- A delivery that overlaps a run still executing in the same process is skipped, as it already was for `running`.

**F4 – a failure that can't be saved now fails the delivery**
- When saving the `failed` state to the database throws, the processor now raises a new `AgentRunPersistenceError` instead of treating the run as settled. This covers the validation-failure, execution-failure and abandoned-run paths. A run that another writer had already moved on still returns `false` as before, so the two cases stay separate.
- That error is raised from inside the outer `catch`, so it is no longer turned into a normal `{ status: 'failed' }` result. Workspace cleanup still runs.
- **One change outside the processor:** `AGENT_RUN_JOB_OPTIONS` was `attempts: 1`, so a failed delivery would never be retried and these fixes would have nothing to act on. I changed it to `attempts: 3` with exponential backoff (5 s) in `packages/core/src/services/agents/agentRunTrigger.ts` and updated its test. A retry doesn't spend tokens twice: after the run has started, a retry either fails it as abandoned or finishes it from the stored report. Please check you're happy with that change.

**F5 – attachment and context-repo writes can't leave the workspace** (`src/jobs/agentRuns/workspace.ts`)
- A new `prepareReservedDirectory` checks the path from the workspace root down. Any symlink or file in the way, such as `.propr` itself, is unlinked; the place it points to is never touched. The final directory is always recreated empty, which also removes symlinks to individual files inside it. The function then confirms the directory really resolves inside the workspace.
- `copyAgentInputFiles` uses it for `.propr/agent-inputs`. `prepareRepositoryWorkspace` uses it for `.propr/context` before cloning the additional repositories into it.

**Other problems I found and left alone** (outside the selected findings):
- If marking the task failed or cancelled throws, the error is still swallowed. This happens in `failRunningRun`, `recoverAbandonedRun` and `settleTaskWithRun`. Once the run is `failed` or `cancelled`, a redelivery skips it, so the task can stay stuck in a processing state.
- If an interrupted run is retried after all 3 attempts are used up and saving still fails, the run stays `running`. Retries can't fix that; it would need a separate background sweep.

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

* feat(ai): I fixed F6, F7 and F8. The agent-run tests and the agent git-access tests pass (6 files). Root and `packages/core` typecheck are clean, and eslint reports no warnings on `src/` or the two changed core files. I added 14 regression tests; 12 of them fail when run against the previous source. The other 2 are guards that pass either way: one checks that a `repository_read` run still gets its credential, the other that an already-ended task is left alone. I didn't run the rest of the test suite. No previews, since nothing visible changed.

I fixed F6, F7 and F8. The agent-run tests and the agent git-access tests pass (6 files). Root and `packages/core` typecheck are clean, and eslint reports no warnings on `src/` or the two changed core files. I added 14 regression tests; 12 of them fail when run against the previous source. The other 2 are guards that pass either way: one checks that a `repository_read` run still gets its credential, the other that an already-ended task is left alone. I didn't run the rest of the test suite. No previews, since nothing visible changed.

**F6: repository access is now enforced when the container launches.**
- I added a `repositoryAccess: 'none'` option to `AgentTaskOptions`. When it's set, `prepareAgentGitAccess` returns an empty token and no mounts. It does this before it reads repository settings, mints a token or lists clones.
- Every adapter (Claude, Codex, the Codex app server, OpenCode, Vibe, Antigravity) prepares its launch through that function. Their Docker argument builders keep an empty mount list as it is, so no adapter falls back to the default clone mounts.
- The processor sets the option, and passes an empty token, unless the run has `repository_read` *and* the workspace actually checked out a repository. That also covers a run with `repository_read` but no repositories, which gets an empty scratch directory.
- The new core test sets up existing clones with no context restriction and checks that no token is minted and nothing is mounted.

**F7: a run cancelled during preparation no longer starts the agent.**
- Right before `executeTask`, after the task is moved to execution, the processor re-reads the run.
  - If the run is no longer `running`, it settles the task to match and returns without launching.
  - If the task was stopped directly while the run is still `running`, it cancels the run and returns.
- A cancel that lands during the launch itself is still left to the execution layer's existing handling.
- The two existing "cancel during execution" tests used to cancel at claim time, so with this check they would never have reached the agent. They now cancel from inside the agent call, so they still test cancellation during execution.

**F8: failed and cancelled runs no longer leave their task active.**
- If the task can't be updated to match the run, the delivery now fails with a new `AgentRunSettlementError` instead of logging and returning. This applies to ordinary failure, abandoned-run recovery and cancellation settlement, and BullMQ retries the delivery.
- When a job is redelivered for a `failed` or `cancelled` run, the processor now ends a task that still exists and is not finished yet. If the task doesn't exist or has already ended, it skips as before.

`toolPolicy` is still passed through unchanged; the repository restriction comes from the new launch option, not from `toolPolicy`.

Separately, the Gmail, Google Calendar and Google Drive connectors in this session need authorization in your claude.ai connector settings; they weren't needed for this work.

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

* feat(ai): I fixed F9 and F10 in `src/jobs/processAgentRunJob.ts`. The processor and trigger tests pass (65 of 65), root and `packages/core` typecheck are clean, and `npx eslint src/ --max-warnings 0` reports nothing. I added 7 regression tests; 6 of them fail against the previous processor code. I didn't run the rest of the test suite. No previews, since nothing visible changed.

I fixed F9 and F10 in `src/jobs/processAgentRunJob.ts`. The processor and trigger tests pass (65 of 65), root and `packages/core` typecheck are clean, and `npx eslint src/ --max-warnings 0` reports nothing. I added 7 regression tests; 6 of them fail against the previous processor code. I didn't run the rest of the test suite. No previews, since nothing visible changed.

**F9: stopping a task during execution.** After `executeTask` returns, the processor now checks whether the task was stopped directly. If it was, the run moves from `running` to `cancelled`, and the result is thrown away whether it succeeded or failed. The failure path makes the same check before marking the run failed. If that check itself errors (say, Redis is down), it logs and still records the failure, so the run doesn't stay `running`. All of these moves are guarded: if another writer already changed the run, the task follows whatever that writer stored.

- **Same defect in recovery:** a run whose worker died after its task was stopped used to be failed as abandoned. It is now cancelled.
- **Remaining gap:** a stop that lands between this check and storing the report is not caught. Tasks and runs live in different stores, so the check can't be atomic, and a run that already has its report can't be moved to `cancelled`.

**F10: losing the claim.** When the `queued → running` claim fails, the processor now rereads the run.
- If the run was cancelled or failed, the task is ended to match.
- In any other state, another delivery has claimed the run, so this delivery returns `skipped` and leaves the run and its task alone. It no longer goes through abandoned-run recovery.

**Tests:**
- One test for each F10 case: the stale delivery that loses the claim to a stalled-job redelivery (the claimant's task still completes), and a run failed before the claim.
- For F9, a task stopped during execution followed by a successful result, a failed result, and a thrown error. Plus the abandoned-run case.
- The guard that passes either way: when the task can't be read, the failure is still recorded.
- I rewrote the existing "cancelled between pickup and start" test so the run is actually cancelled. It used to fake a claim that returned null while the run stayed `queued`, which now correctly counts as someone else's claim.

To keep the file within its lint limits (400 lines, complexity 20), I moved the run error classes and `reportFromResult` into a new `src/jobs/agentRuns/runErrors.ts`. The error classes are still exported from the processor. I also added a few small helpers in the processor.

Separately, the Gmail, Google Calendar and Google Drive connectors need to be authorized in your claude.ai connector settings before they can be used.

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

* feat(ai): I fixed the shard 1 timeout in `test/processAgentRunJob.test.ts`. The test file passes (48 of 48 in 2.4s) both normally and with a simulated CI `sudo`; I haven't confirmed it on a real CI runner yet.

I fixed the shard 1 timeout in `test/processAgentRunJob.test.ts`. The test file passes (48 of 48 in 2.4s) both normally and with a simulated CI `sudo`; I haven't confirmed it on a real CI runner yet.

**Cause:** the workspace test calls the real setup code, which runs `sudo chown -R 1000:1000` on the scratch workspace. My local container has no `sudo`, so the call fails, the code logs a warning and the test finishes. GitHub runners have passwordless `sudo`, so there the chown succeeds. The test process then has to clean up a directory owned by another user, and the file hung until the 180s limit killed it. To reproduce this, I used a fake `sudo` that makes the workspace read-only, and the file hung the same way.

**Fix (test-only):**
- At the top of the test file, I put a stub `sudo` that does nothing first on `PATH`. `test/worktreeStartRevision.test.ts` already handles the same problem this way.
- The `after` hook now closes the database connection in a `finally`, so a failed cleanup can't keep the process alive.

With the fix, the file passes against both the fake read-only `sudo` and the normal environment. No other test calls this workspace setup. ESLint ignores files under `test/`, so lint doesn't cover this change. I didn't run the rest of the suite. Nothing visible changed, so there are no previews.

PR: #2839
Comment by: @github-actions[bot] (ID: 6021809239)
Model: Claude Opus 5.5

* feat(ai): I fixed F11 and F12. The processor and trigger tests pass (68 of 68), the root and `packages/core` typechecks are clean, and `npx eslint src/ --max-warnings 0` reports nothing. I added 3 regression tests; the 2 that cover these bugs fail when run against the previous source. I didn't run the rest of the test suite. No previews, since nothing visible changed.

I fixed F11 and F12. The processor and trigger tests pass (68 of 68), the root and `packages/core` typechecks are clean, and `npx eslint src/ --max-warnings 0` reports nothing. I added 3 regression tests; the 2 that cover these bugs fail when run against the previous source. I didn't run the rest of the test suite. No previews, since nothing visible changed.

**F11 – a cancel during the "storing report" update no longer ends as a completed run**
- In `src/jobs/processAgentRunJob.ts`, after the `POST_PROCESSING` task update, the processor now reads the task again through `followCancelledTask` before storing the report. If the task was cancelled, the run is cancelled too and the report is dropped.
- The check has to come before the report is stored: once a run has a stored report (`report_ready`), the run store won't let it become cancelled.
- I looked for the same defect elsewhere. Every other point where the processor waits on something and then changes the run already re-checks for a cancelled task first. The recovery paths for runs with a stored report only pick up runs that already have one, so this check covers them as well.
- A small gap remains between that read and storing the report. The tasks and the runs live in two separate stores, so a cancel landing in that moment can't be fully excluded. The unchecked wait on the update itself is gone.
- **Regression test:** the task is cancelled during the `POST_PROCESSING` update. The test checks that the run ends `cancelled` with no report, is never marked `report_ready` or `completed`, the task stays `cancelled`, and the workspace is cleaned up.

**F12 – runs that don't read repositories no longer need GitHub sign-in**
- I added `definitionReadsRepositories()` to `src/jobs/agentRuns/workspace.ts`: true only when the definition has `repository_read` and at least one repository.
- The workspace setup, the GitHub sign-in and the agent's repository access now all use that same check. GitHub credentials are fetched only when it's true; otherwise the workspace gets an empty token and no GitHub client, and the agent launches without repository access.
- **Regression tests:**
  - The GitHub-access step throws for three kinds of definition: no capability and no repositories, repositories but no `repository_read`, and `repository_read` with no repositories. In all three the run completes, GitHub access is never requested, and the agent gets no repository access.
  - A guard test checks that a run which does read repositories still fails cleanly when GitHub access fails.

**Unrelated change:** moving the GitHub-access decision into the processor took it over two eslint limits (function complexity and file length). To stay under them, I moved the agent launch options into a new `src/jobs/agentRuns/agentTaskOptions.ts`, along with the `AgentRunToolPolicy` type. `processAgentRunJob.ts` still exports that type, so existing imports keep working.

The Gmail, Google Calendar and Google Drive connectors need authorizing in your claude.ai connector settings before they can be used. I didn't need them for this.

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

* feat(ai): I fixed F13: before a report run clones any additional repository, it now checks the primary repository's `contextRepositories` setting and rejects any repository the setting doesn't allow. In the reported case (`acme/web` set to `'none'`, run selecting `['acme/web', 'acme/api']`), the run fails before anything is cloned, with a message naming `acme/api` and how to fix the setting. The processor, trigger and git-access tests pass (92 of 92), both typechecks are clean, and eslint reports no warnings on `src/` or the two changed core files. I didn't run the rest of the test suite. No previews, since nothing visible changed.

I fixed F13: before a report run clones any additional repository, it now checks the primary repository's `contextRepositories` setting and rejects any repository the setting doesn't allow. In the reported case (`acme/web` set to `'none'`, run selecting `['acme/web', 'acme/api']`), the run fails before anything is cloned, with a message naming `acme/api` and how to fix the setting. The processor, trigger and git-access tests pass (92 of 92), both typechecks are clean, and eslint reports no warnings on `src/` or the two changed core files. I didn't run the rest of the test suite. No previews, since nothing visible changed.

**What changed**
- **One shared policy rule** (`packages/core/src/agents/agentGitAccess.ts`): I moved the policy calculation out of `prepareAgentGitAccess` into a new exported function, `resolveEffectiveContextRepositories`. It reads every monitored entry for the repository and keeps only repositories that all of them allow, so conflicting entries never widen access. `prepareAgentGitAccess` now calls it, so the agent's token scope and the workspace checkout can't disagree. It is exported from `@propr/core`.
- **Check before cloning** (`src/jobs/agentRuns/workspace.ts`): the new `assertContextRepositoriesAllowed` runs in `prepareRepositoryWorkspace` before the primary checkout and any extra clone. Names are compared ignoring case, and a setting of `'all'` (or none at all) allows everything, as the adapter does. The workspace input takes an optional `resolveContextPolicy` so tests can supply a policy; by default it uses the repository settings.

I checked for other code that copies repositories into the workspace: `cloneContextRepository` is the only one, so this was the only occurrence of the defect.

**Regression tests (3)**
- In `test/processAgentRunJob.test.ts`, a restrictive policy with two repositories is rejected before any clone. This test fails when the check is removed.
- Also in that file, the check itself: `'all'` and no setting allow everything, names match regardless of case, `'none'` leaves only the primary repository, and every excluded repository is named.
- In `test/agentGitAccess.test.ts`, conflicting entries narrow the policy, `'none'` gives just the primary repository, and `'all'` gives no restriction.

One thing to watch: the settings are read when the workspace is prepared and read again at agent launch. If someone tightens them in between, the checkout reflects the older setting while the token follows the newer one. Settings can't be read atomically across both steps, so I left that window as it is.

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

* feat(ai): I fixed F14 and F15. The tests for the processor, trigger and worker credentials pass (74 of 74). The root and `packages/core` typechecks are clean, and `npx eslint src/ --max-warnings 0` reports nothing. I added 3 regression tests, and all 3 fail when run against the previous source. I didn't run the rest of the test suite. There are no previews, since nothing visible changed.

I fixed F14 and F15. The tests for the processor, trigger and worker credentials pass (74 of 74). The root and `packages/core` typechecks are clean, and `npx eslint src/ --max-warnings 0` reports nothing. I added 3 regression tests, and all 3 fail when run against the previous source. I didn't run the rest of the test suite. There are no previews, since nothing visible changed.

**F14: context clones exposed the worker token.** `cloneContextRepository` in `src/jobs/agentRuns/workspace.ts` now clones from the plain `https://github.com/<owner>/<repo>.git` URL. The token is passed only in the git command's own environment, as an auth header. This is the same helper (`configureGitAuthentication`) that the shared repository clones already use. So the token never appears in the clone URL or in `.git/config`, not even while the clone is running, and the follow-up `remote set-url` step is gone. I exported that helper from `@propr/core` (`packages/core/src/index.ts`).
- **Regression test:** it puts a fake `git` on the path that records each command and writes the clone URL into `.git/config` the way real git does. The test checks that the token is never passed on the command line or written to the config, and that it reaches git only through the header.
- **Same pattern elsewhere:** the only other repository fetch in the report-run path is the primary checkout through `ensureRepoCloned`, and it already authenticates this way.

**F15: validation retries could leave a task stuck.** When a definition fails validation, the run is still marked failed first. After that, a new helper `settleExistingTask` in `src/jobs/processAgentRunJob.ts` ends any report task an earlier attempt already created, using the existing ended-run handling. If there is no task, none is created. If the task can't be read or updated, the error is passed up so the job is retried, and the retry finishes ending it. `reconcileEndedRun` now uses the same helper.
- **Regression tests:**
  - The exact reported sequence: the claim fails during a database outage, the definition becomes invalid, and the retry fails both the run and its existing task without executing anything.
  - Ending the task fails once: the delivery is rejected, and the retry finishes the job.
- **Unchanged:** the existing test where an invalid definition has no task still passes with no task calls.

I found no other problems while checking these paths.

The Gmail, Google Calendar and Google Drive connectors need authorizing in your claude.ai connector settings before they can be used. They weren't needed for this fix.

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

* feat(ai): I fixed F16. A report run whose result says the provider stopped it early (for example on the turn limit or a timeout) now fails, even if it reported success and returned text. Before, that text was stored as a finished report.

I fixed F16. A report run whose result says the provider stopped it early (for example on the turn limit or a timeout) now fails, even if it reported success and returned text. Before, that text was stored as a finished report.

**Fix:** `reportFromResult` in `src/jobs/agentRuns/runErrors.ts` now checks why the run stopped before it accepts the report. It does this with the existing `resolveAgentTerminationReason`, so it covers both a `terminationReason` set on the result and termination signs in the result's other fields. If a reason is found, it throws an `AgentRunReportError` with the message `Agent execution stopped before completion: <description>`. That error goes through the processor's existing failure handling: the run and its task are marked failed, the reason is saved, and the workspace is cleaned up. Because no report is saved, a later run can't pick up the partial text as a previous report.

I didn't use the existing `isIncompleteAgentExecution` helper because it only applies when `success === false`, which is exactly the case this bug slipped through. `reportFromResult` is called in only one place (the report step in `processAgentRunJob.ts`), so there were no other copies of the same mistake in this PR's changes.

**Tests:** I added 2 regression tests to `test/processAgentRunJob.test.ts`. Each returns a successful, non-empty result with `terminationReason` set to `max_turns` or `timeout`, then checks that:
- the run ends as `failed`.
- no report is saved.
- the failure reason explains why.
- the task is failed and the workspace is cleaned up.

**Verification:**
- The processor and trigger tests pass (75 of 75).
- Both new tests fail when run against the previous `runErrors.ts`.
- `tsc --noEmit` is clean and `npx eslint src/ --max-warnings 0` reports nothing.
- I didn't run the rest of the test suite.
- The test files only run with `PROPR_DEMO_MODE=true` and `--experimental-test-module-mocks`. Without the first, startup exits because GitHub auth isn't configured. I also rebuilt `packages/shared` and `packages/core` before running them.

No previews, since nothing visible changed.

The Gmail, Google Calendar and Google Drive connectors need authorizing in your claude.ai connector settings before they can be used. They weren't needed for this fix.

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

---------

Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>
… and Codex now block web access and attach the `propr` MCP server using their own CLI switches, and the token is never placed in the command line.

Testing:
- The new `test/agentToolPolicy.test.ts` passes (18 of 18).
- These existing agent and agent-run test files still pass unchanged: antigravity, opencode, vibe, goal execution, goal launch git access, native goal, scout runtime, context analysis, reasoning level and `processAgentRunJob`.
- `npm run typecheck` is clean.
- Eslint didn't check most of the changed files. It reported them as ignored by its config, so they have not been linted.
- `test/redactSecrets.test.ts` has 3 failures, and they are the same with my change reverted. Two can't write to `/tmp/claude-logs` because that directory is owned by root in this sandbox, and the third fails on a missing bearer-redaction placeholder in a completion-comment test.
- Nothing ran against a real Claude or Codex CLI. In particular, I haven't confirmed that Claude expands `${PROPR_MCP_BEARER_TOKEN}` inside an inline `--mcp-config`, or that this Codex version honours `tools.web_search=false`. The tests only check the arguments we build.

What changed:
- Option and builders: `AgentTaskOptions` has an optional `toolPolicy`. When it's absent the arguments are the same as before. The builders in `packages/core/src/agents/agentToolPolicy.ts` produce these switches:
  - Claude, web off: `--disallowedTools WebFetch WebSearch`.
  - Claude, MCP: an inline `--mcp-config` whose `Authorization` header is `Bearer ${PROPR_MCP_BEARER_TOKEN}`.
  - Codex: `-c tools.web_search=false`, plus `-c mcp_servers.propr.url=…` and `-c mcp_servers.propr.bearer_token_env_var=…`.

  The token is only ever in the returned env map. Invalid server or env-var names are rejected.
- Passing the token: the containers get `-e PROPR_MCP_BEARER_TOKEN` with no value, and Docker copies the value from its own environment. `executeDockerCommand` already declared an `extraEnvVars` option but never used it. I wired it into the spawn environment, so the token stays out of the argument list and nothing is written to the worktree.
- Other runtimes: Antigravity, OpenCode and Vibe get a "web access is not allowed" notice added to the prompt. This is best effort only, as the issue intends.
- Mapping for agent runs: the stub from issue 7 was never added as `src/jobs/agentRuns/toolPolicy.ts`; it was the `{ capabilities, readOnly }` placeholder in `agentTaskOptions.ts`. I created the real file:
  - Report phase: web is allowed only if the definition has the `web` capability. The MCP is attached only when `propr_mcp` is enabled and a grant was issued.
  - Action phase: the MCP is always attached once a grant exists, and web follows the definition.

  `agentTaskOptions` now accepts an optional `mcpGrant` for issue 9 to fill in. I updated the one assertion in `test/processAgentRunJob.test.ts` that expected the old placeholder shape.
- Redaction: `redactSecrets` already stripped bearer tokens, but only those of 20 characters or more, so `Authorization: Bearer abc.def` got through. It now strips any token after an `Authorization: Bearer` header, including in JSON, and any value assigned to `PROPR_MCP_BEARER_TOKEN=`.

The `codex app-server` builder, which is only used for goal mode, doesn't pass these switches through. That doesn't affect agent runs, which use task mode.

There's no visual change, so I didn't create a preview.
…oPR MCP grant for their own run, and the worker revokes it in `finally` when the run ends. All the tests I ran pass: the new ones, the processor tests, and the existing MCP OAuth, delegation and Connected-apps tests, plus the CORS, route-authorization, desktop-boundary and status-route tests (which cover the auth boundary). Typecheck and `eslint --max-warnings 0` are clean for `src/` and the new API files.

Not verified: I didn't boot the real server or run a real agent container. So nothing has confirmed that a container can actually reach `http://api:4000/api/mcp`, or that a call shows up in the live MCP access log. Grants are ordinary MCP grants with the label "ProPR Agent: <name>", so they go through the same logging path as other clients. The tests check the label and the Connected-apps listing, not the log itself.

What was added
- `packages/api/mcp/agentRunGrants.ts`
  - `issueAgentRunGrant` returns `{ grantId, accessToken, expiresAt }` and `revokeAgentRunGrant(grantId)` uses the same revocation as the Connected apps "Revoke" button.
  - Report grants get `read`; action grants get `read`, `plan` and `execute`. Grants last 2 hours and are tagged `membershipSource: 'agent_run'`.
  - It fails with `MCP_DISABLED` or `GITHUB_AUTHORIZATION_REQUIRED` as specified.
  - The grant id is stored in `mcp_records` as `agent_run_grant` / `<runId>:<phase>` so the issue-12 sweep can find it.
  - The `propr-agent-runs` client has no redirect URIs, so it can't be used for browser OAuth.
- `McpOAuthProvider.issueDelegatedGrant` (in `oauth.ts`) saves the grant and access token the same way browser consent does. There's no refresh token, and the access token lives exactly as long as the grant.
- Internal routes (`routes/agentRunInternalRoutes.ts`), registered in `server.ts` before the session guard with the discovery rate limiter:
  - `POST /api/internal/agent-runs/:runId/mcp-grants` and `.../revoke`.
  - Requests are checked with an HMAC over `runId:phase:ts`, and the timestamp must be within 5 minutes.
  - Owner and repositories always come from the run snapshot, never the request body.
  - Bad or expired signature returns 401, a run in the wrong state returns 409, a missing run returns 404. Revoke works in any state, so crash recovery can use it.
- Shared signer: `signAgentRunGrantRequest` lives in `@propr/core`, so the API and the worker can't disagree on the format.
- Worker client (`src/jobs/agentRuns/mcpGrantClient.ts`) calls `PROPR_INTERNAL_API_URL` (default `http://api:4000`). Containers get `PROPR_AGENT_MCP_URL` (default `<internal API>/api/mcp`).
- Executor: when the definition has `propr_mcp`, the report phase requests a grant and passes it into the tool policy. A failed revoke is only logged; expiry and the sweep are the backstop.

Behaviour you might not expect
- Admin scope ceiling: grants are narrowed to the instance's MCP scope ceiling. On the default ceiling (`read`, `plan`, `review`), action-phase grants lose `execute` unless an admin raises it. That would block `create_task` in issue 10.
- Grant failure stops the run: if a `propr_mcp` report can't get a grant, the run fails before the agent starts. It does not run without MCP.
- Retried phase: a retry revokes the previous grant for that phase. A revoke that names an old grant id leaves the newer grant alone.
- Revoke signature signature: `revokeAgentRunMcpGrant` takes `(runId, { grantId, phase })` rather than `(runId, grantId)`, because the signed revoke request needs the phase.
- Action phase not wired yet: that phase is still the issue-10 placeholder, so only the report phase uses grants for now.

Tests added: `packages/api/test/agentRunGrants.test.ts` (7 tests), `test/agentRunMcpGrantClient.test.ts` (3), and 4 new cases in `test/processAgentRunJob.test.ts`. They cover:
- forged, expired and phase-swapped signatures, plus a 409 for a `completed` run.
- the token authenticating through `McpPolicy.authenticate` with only the run's repositories.
- an instance repo outside the definition being denied, even with GitHub write access.
- a report token failing with "requires execute".
- the token being rejected after revoke.
- the "ProPR Agent: Nightly triage" entry on `/mcp/apps`.

There's no visual change, so I didn't create a preview.
* The broader regression run is still going. I'll report once it finishes.

* feat(ai): I fixed F1. An approval that gets interrupted can now be recovered by approving again, and the approver's note is saved with the approval so the retry still uses it.

I fixed F1. An approval that gets interrupted can now be recovered by approving again, and the approver's note is saved with the approval so the retry still uses it.

**What changed**
- **The note is saved on the run.** There is a new `operator_note` column, added to this PR's own `agent_runs` migration since that migration isn't on main yet. The approval step writes `approvedBy` and the note in the same update that moves the run to `acting`.
- **Approving again finishes the handoff** (`packages/api/routes/agentDefinitionRoutes.ts`). If an approved run is still `acting` and its acting step hasn't been picked up (`actionTaskId` is null), approving again returns 200 and enqueues the acting step again, using the saved note. The job id is fixed per run, so a retry can't create a second job, and the existing claim on `actionTaskId` stops the step running twice. An approval whose step was already picked up still gets 409. So does an auto-mode run in `acting`, since it has no approver.
- **Every enqueue path uses the saved note.** `enqueueAgentRunActionOrFail` now takes the note from the run by default. That also covers the existing recovery path in `processAgentRunJob` (`resumeActing`). The action worker reads `run.operatorNote` first and only falls back to the note in the job data.

**One behaviour change:** a double-clicked Approve used to give 200 and 409. Now both clicks return 200. The run still moves once, only the first click's note is saved, and both clicks enqueue the same job id. I rewrote the existing test to match.

**New tests**
- The note is saved on approval.
- After a simulated crash (run committed as approved, nothing enqueued), approving again enqueues the acting step with the saved note.
- An approval whose step was already picked up returns 409.
- An auto-mode `acting` run is not started by Approve.
- The action worker uses the saved note when the job data has none.

**Verification:** the agent autonomy, action, run-processor, run-store, trigger, definition-route and grant suites all pass. `npm run typecheck` is clean, and eslint reports nothing on the changed source files when run from their package directories. Nothing visual changed, so there are no previews.

**Found separately, not fixed:**
- Recovery depends on the user approving again. There is no background sweep that restarts an approved run stuck in `acting` on its own.
- If an action job already failed all its retries before it was picked up, BullMQ keeps it and ignores a new job with the same id. A retried approval would then return 200 without anything running. This was already the case before this change and is outside F1.

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

* feat(ai): I fixed F2 and F3. The new tests and the related suites pass, `npm run typecheck` is clean, and eslint reports nothing on the changed core files.

I fixed F2 and F3. The new tests and the related suites pass, `npm run typecheck` is clean, and eslint reports nothing on the changed core files.

**F2: upgrade migration for `operator_note`**
- I added a new migration, `20261006010000_add_agent_run_operator_note.js`, which adds the nullable `operator_note` column to `agent_runs`. It skips the change if the column already exists, so installations that ran the edited original migration aren't affected.
- I took the column back out of `20261006000000_create_agent_definitions.js`. Old installations and new databases now get the column the same way, from the new migration.
- **New test:** it rolls back only the new migration, which leaves the schema an existing installation has today. It checks the column is gone, then migrates to latest, creates a run and approves it with a note. The note is saved.

**F3: a failed redispatch no longer fails a run the worker has claimed**
- I added `failUnclaimedAgentRunAction` in `agentRunStore.ts`. It marks a run failed in a single update, and only if the run is still `acting` with no `action_task_id`. If the update matches nothing, it returns null.
- `enqueueAgentRunActionOrFail` now uses it when an enqueue fails, and returns the run as stored when the guard doesn't match. The shared helper serves approval, auto mode and the report-phase recovery path (`resumeActing` in `processAgentRunJob`), so all three are covered.
- The helper's `transitionRun` option is replaced by `failUnclaimedAction`. I updated `autonomy.ts` and the in-memory test store to match.
- **New tests:**
  - Two approvals where the worker claims the run between the first enqueue and the second one failing: the second still returns the run in `acting` with the worker's claim and no failure reason, and the worker can still complete it with its summary.
  - A failed enqueue on a run no worker has claimed still fails it with the reason.
  - Report-phase recovery: the claim lands after recovery read the run as unclaimed, then the enqueue fails. The run stays untouched.

Two cases are still possible and can't be closed: the worker can claim the run just after the guarded update commits, or the run is failed first and its job was already queued. Either way the database update is the only thing that decides the outcome, and the worker's own claim, which uses the same condition, then finds nothing to claim. No external action runs on a run that has already been marked failed.

There's nothing visual in this change, so I didn't make previews.

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

---------

Co-authored-by: propr-dev[bot] <1316198+propr-dev[bot]@users.noreply.github.com>
@integry

integry commented Oct 6, 2026

Copy link
Copy Markdown
Owner

/merge

@propr-dev

propr-dev Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Resolved merge conflicts from main into 2800-epic-agents-v1-y7t in commit 26f7514

Conflicting Files

  • packages/core/src/index.ts

Resolution Summary

I resolved the merge conflict, and the packages/core typecheck (npx tsc --noEmit) passes with no errors.

The conflict: The only conflict was in packages/core/src/index.ts, the file that re-exports everything in the core package. Both branches added new export lines at the same spot:

  • This PR exported the agents services: agentDefinitionStore, agentRunStore and agentRunTrigger.
  • main exported taskPlanning/epicQueueHumanMerge and reviewScoreStore.

How I resolved it: I kept all five export lines, with the PR's agents exports first and main's two after them.

Why: Each side added different features, so they don't actually clash. The PR's agents work still needs its exports, and main's code needs its own. Dropping either side would break code that imports from the core package. All five target files exist, and the typecheck shows no duplicate export names from combining them.

A search of the whole repo found no other conflict markers.

The Gmail, Google Calendar and Google Drive connectors need to be authorized in your claude.ai connector settings before they can be used. They weren't needed for this task.


🤖 Resolution Details

  • Model: Claude Opus 5.5
  • Time: 1m 41s

View Task Execution


System-triggered merge conflict resolution

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

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

propr-dev Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: CodeQL

Please investigate and fix this CI failure.

Failure evidence

packages/api/test/agentRunGrants.test.ts:84 — Missing rate limiting
This route handler performs authorization, but is not rate-limited.

packages/api/test/agentRunGrants.test.ts:85 — Missing rate limiting
This route handler performs authorization, but is not rate-limited.

@propr-dev

propr-dev Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 5767210

Processed 2 comments:

  • Comment 1 by @github-advanced-security[bot] (ID: 4201323271✓)
  • Comment 2 by @github-advanced-security[bot] (ID: 4201323286✓)

Summary of Changes

I fixed both CodeQL "Missing rate limiting" alerts on packages/api/test/agentRunGrants.test.ts. Both point at test routes, not production code. In packages/api/server.ts:344-345, the real grant routes already go through createDiscoveryRequestRateLimiter().

The test server set up both routes without any rate limiting, which is what CodeQL flagged. It now uses createRequestRateLimiter({ identifier: 'agent-run-grants-test-fixture', limit: 100, windowMs: 60_000 }) before express.json(), the same way demoMode.test.ts does. That one setting covers both routes (issue and revoke). It's a two-line change to that file only.

All 10 tests in the file pass and the type check is clean. The tests need PROPR_DEMO_MODE=true set, because without GitHub auth the file fails to load. Lint has nothing to check because ESLint is set to ignore this file.

No preview: this change has no visible effect.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @github-advanced-security[bot]
  • Time: 5m 20s
  • Tokens: 442,260 (440,077 in / 2,183 out)
  • Cost: $0.30
  • Subscription usage: Session +3%, Weekly +1%

Undo Changes • View Task Execution


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

🤖 Generated by ProPR
Processing comment IDs: 4201323271✓, 4201323286✓

…ages/api/test/agentRunGrants.test.ts`. Both point at test routes, not production code. In `packages/api/server.ts:344-345`, the real grant routes already go through `createDiscoveryRequestRateLimiter()`.

I fixed both CodeQL "Missing rate limiting" alerts on `packages/api/test/agentRunGrants.test.ts`. Both point at test routes, not production code. In `packages/api/server.ts:344-345`, the real grant routes already go through `createDiscoveryRequestRateLimiter()`.

The test server set up both routes without any rate limiting, which is what CodeQL flagged. It now uses `createRequestRateLimiter({ identifier: 'agent-run-grants-test-fixture', limit: 100, windowMs: 60_000 })` before `express.json()`, the same way `demoMode.test.ts` does. That one setting covers both routes (issue and revoke). It's a two-line change to that file only.

All 10 tests in the file pass and the type check is clean. The tests need `PROPR_DEMO_MODE=true` set, because without GitHub auth the file fails to load. Lint has nothing to check because ESLint is set to ignore this file.

No preview: this change has no visible effect.

PR: #2821
Comment by: @github-advanced-security[bot] (ID: 4201323271)
Comment by: @github-advanced-security[bot] (ID: 4201323286)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 76f8cca

Summary of Changes

The CodeQL failure was on commit 26f7514f. The commit after it (5767210ea, the current HEAD) already tried to fix it by adding a rate limiter to the test server with app.use('/api', limiter, express.json()). I can't confirm CodeQL accepts that version: the bot token gets a 403 on the code-scanning alerts API, and CodeQL hasn't run on HEAD yet.

To make it more likely to pass, I changed packages/api/test/agentRunGrants.test.ts so the limiter sits directly on each of the two flagged routes. That's how production does it in packages/api/server.ts:344-345, and CodeQL doesn't flag those routes there:

const rateLimiter = createRequestRateLimiter({ identifier: 'agent-run-grants-test-fixture', limit: 100, windowMs: 60_000 });
app.use(express.json());
app.post('/api/internal/agent-runs/:runId/mcp-grants', rateLimiter, routes.issueGrant);
app.post('/api/internal/agent-runs/:runId/mcp-grants/revoke', rateLimiter, routes.revokeGrant);

The test file is the only change; production code is untouched. All 10 tests in the file pass (run with PROPR_DEMO_MODE=true), and the type check showed no errors. Whether CodeQL clears both alerts will only show on the next CI run.

No preview: nothing visible changed.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-dev[bot]
  • Time: 3m 46s
  • Tokens: 207,064 (204,963 in / 2,101 out)
  • Cost: $0.24
  • Subscription usage: Session +1%

Undo Changes • View Task Execution


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

🤖 Generated by ProPR
Processing comment ID: 6027180909✓

…er it (`5767210ea`, the current HEAD) already tried to fix it by adding a rate limiter to the test server with `app.use('/api', limiter, express.json())`. I can't confirm CodeQL accepts that version: the bot token gets a 403 on the code-scanning alerts API, and CodeQL hasn't run on HEAD yet.

The CodeQL failure was on commit `26f7514f`. The commit after it (`5767210ea`, the current HEAD) already tried to fix it by adding a rate limiter to the test server with `app.use('/api', limiter, express.json())`. I can't confirm CodeQL accepts that version: the bot token gets a 403 on the code-scanning alerts API, and CodeQL hasn't run on HEAD yet.

To make it more likely to pass, I changed `packages/api/test/agentRunGrants.test.ts` so the limiter sits directly on each of the two flagged routes. That's how production does it in `packages/api/server.ts:344-345`, and CodeQL doesn't flag those routes there:

```ts
const rateLimiter = createRequestRateLimiter({ identifier: 'agent-run-grants-test-fixture', limit: 100, windowMs: 60_000 });
app.use(express.json());
app.post('/api/internal/agent-runs/:runId/mcp-grants', rateLimiter, routes.issueGrant);
app.post('/api/internal/agent-runs/:runId/mcp-grants/revoke', rateLimiter, routes.revokeGrant);
```

The test file is the only change; production code is untouched. All 10 tests in the file pass (run with `PROPR_DEMO_MODE=true`), and the type check showed no errors. Whether CodeQL clears both alerts will only show on the next CI run.

No preview: nothing visible changed.

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

propr-dev Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: Validate Changes

Please investigate and fix this CI failure.

Failure evidence

.github:18
Process completed with exit code 1.

.github:370
Process completed with exit code 1.

.github:425 — 🎭 Playwright Run Summary
216 passed (10.5m)

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

Checks Failed

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

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

--- GitHub Actions workflow lint ---

--- Release shell script lint ---

--- Toolchain ---
v22.23.2
10.9.8

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

added 1132 packages, and audited 1141 packages in 34s

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

9 high severity vulnerabilities

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

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

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

Run `npm audit` for details.

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

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


> @propr/[email protected] build
> tsc


> @propr/[email protected] build
> tsc


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

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

Staged [email protected] at /var/lib/propr-ci/worker1/work/propr/propr/dist-publish/propr-cli
npm notice
npm notice package: [email protected]
npm notice Tarball Contents
npm notice 26.3kB README.md
npm notice 36.3kB dist/agentSkill.js
npm notice 754B dist/api/agentRuntime.js
npm notice 7.1kB dist/api/agents.js
npm notice 2.6kB dist/api/agentTank.js
npm notice 11.7kB dist/api/client.js
npm notice 5.0kB dist/api/errors.js
npm notice 16.6kB dist/api/goals.js
npm notice 6.0kB dist/api/implement.js
npm notice 2.4kB dist/api/index.js
npm notice 1.9kB dist/api/logs.js
npm notice 5.7kB dist/api/plans.js
npm notice 4.2kB dist/api/relay.js
npm notice 11.3kB dist/api/repos.js
npm notice 13.1kB dist/api/settings.js
npm notice 775B dist/api/stats.js
npm notice 1.6kB dist/api/syntheticPools.js
npm notice 1.8kB dist/api/system.js
npm notice 5.8kB dist/api/tasks.js
npm notice 2.9kB dist/api/todos.js
npm notice 86B dist/api/types.js
npm notice 313B dist/api/visualPreviewAuth.js
npm notice 26.3kB dist/assets/env.example.txt
npm notice 5.7kB dist/auth/githubLogin.js
npm notice 19.4kB dist/commands/agentCommands.js
npm notice 4.2kB dist/commands/agentPoolCommands.js
npm notice 4.3kB dist/commands/agentSkillCommands.js
npm notice 29.5kB dist/commands/agentValidation.js
npm notice 66.6kB dist/commands/checkCommands.js
npm notice 8.9kB dist/commands/configCommands.js
npm notice 14.6kB dist/commands/connectCommand.js
npm notice 5.5kB dist/commands/githubAppApi.js
npm notice 27.7kB dist/commands/githubAppCommands.js
npm notice 57.9kB dist/commands/goalCommands.js
npm notice 2.4kB dist/commands/imageCommands.js
npm notice 8.0kB dist/commands/implementCommands.js
npm notice 1.7kB dist/commands/index.js
npm notice 7.3kB dist/commands/initCommands.js
npm notice 14.1kB dist/commands/initStack.js
npm notice 6.1kB dist/commands/logCommands.js
npm notice 24.9kB dist/commands/planCommands.js
npm notice 8.4kB dist/commands/relayCommands.js
npm notice 34.4kB dist/commands/repoCommands.js
npm notice 2.7kB dist/commands/repoValidate.js
npm notice 7.5kB dist/commands/runtimeCommands.js
npm notice 17.3kB dist/commands/settingCommands.js
npm notice 4.0kB dist/commands/setup/agentHostActions.js
npm notice 123B dist/commands/setup/agents.js
npm notice 4.5kB dist/commands/setup/engine.js
npm notice 51B dist/commands/setup/github.js
npm notice 15.3kB dist/commands/setup/hostActions.js
npm notice 27.3kB dist/commands/setup/sequential.js
npm notice 51B dist/commands/setup/state.js
npm notice 51B dist/commands/setup/types.js
npm notice 10.7kB dist/commands/setupCommand.js
npm notice 4.4kB dist/commands/stackCommands.js
npm notice 1.4kB dist/commands/startCommand.js
npm notice 3.7kB dist/commands/statsCommands.js
npm notice 13.5kB dist/commands/systemCommands.js
npm notice 3.5kB dist/commands/tankCommands.js
npm notice 45.5kB dist/commands/taskCommands.js
npm notice 29.6kB dist/commands/todoCommands.js
npm notice 31.0kB dist/commands/tunnelCommand.js
npm notice 2.7kB dist/commands/uiDocsCommands.js
npm notice 8.3kB dist/completion.js
npm notice 20.0kB dist/config/ConfigManager.js
npm notice 276B dist/config/index.js
npm notice 989B dist/config/rootKey.js
npm notice 345B dist/config/types.js
npm notice 42.9kB dist/connectIdentity.js
npm notice 25.0kB dist/connectRootAuthority.js
npm notice 32.5kB dist/connectWindowsAuthority.js
npm notice 2.2kB dist/desktopDiscovery.js
npm notice 12.4kB dist/desktopLocalSetup.js
npm notice 16.8kB dist/index.js
npm notice 4.5kB dist/native/darwin-authority-broker.c
npm notice 8.9kB dist/native/directory-operations.c
npm notice 50.1kB dist/native/prebuilds/darwin-arm64/connect-authority-broker
npm notice 54.2kB dist/native/prebuilds/darwin-arm64/directory-operations.node
npm notice 17.1kB dist/native/prebuilds/darwin-x64/connect-authority-broker
npm notice 24.3kB dist/native/prebuilds/darwin-x64/directory-operations.node
npm notice 28.9kB dist/native/prebuilds/linux-arm64/directory-operations.node
npm notice 17.4kB dist/native/prebuilds/linux-x64/directory-operations.node
npm notice 1.2kB dist/native/README.md
npm notice 3.1kB dist/orchestrator/format.js
npm notice 13.4kB dist/orchestrator/index.js
npm notice 302B dist/orchestrator/manifest.json
npm notice 119.1kB dist/orchestrator/orchestrator.mjs
npm notice 408B dist/orchestrator/types.js
npm notice 237B dist/skill/propr/agents/openai.yaml
npm notice 8.7kB dist/skill/propr/SKILL.md
npm notice 4.5kB dist/tui/AgentTableApp.js
npm notice 4.5kB dist/tui/app.js
npm notice 11.6kB dist/tui/CheckApp.js
npm notice 5.1kB dist/tui/render.js
npm notice 32.5kB dist/tui/SetupApp.js
npm notice 18.4kB dist/tui/SetupApp.test.js
npm notice 8.2kB dist/tui/StartApp.js
npm notice 3.6kB dist/utils/apiErrorPresentation.js
npm notice 12.0kB dist/utils/directoryDescriptor.js
npm notice 739B dist/utils/dockerPort.js
npm notice 5.0kB dist/utils/envFile.js
npm notice 520B dist/utils/index.js
npm notice 5.7kB dist/utils/io.js
npm notice 1.5kB dist/utils/nativeArtifact.js
npm notice 544B dist/utils/parseState.js
npm notice 417B dist/utils/positiveInteger.js
npm notice 4.5kB dist/utils/privateFilesystem.js
npm notice 4.2kB dist/utils/resolveProject.js
npm notice 7.2kB dist/vendor/local-setup/agents.js
npm notice 62.7kB dist/vendor/local-setup/engine.js
npm notice 5.0kB dist/vendor/local-setup/envFile.js
npm notice 9.1kB dist/vendor/local-setup/github.js
npm notice 188B dist/vendor/local-setup/index.js
npm notice 27.0kB dist/vendor/local-setup/publicInstanceIdentity.js
npm notice 14.6kB dist/vendor/local-setup/state.js
npm notice 2.8kB dist/vendor/local-setup/types.js
npm notice 1.0kB dist/vendor/shared/accountStatusTimestamp.js
npm notice 7.6kB dist/vendor/shared/activityEvents.js
npm notice 8.9kB dist/vendor/shared/agentDefinitions.js
npm notice 3.4kB dist/vendor/shared/agentLogin.js
npm notice 3.1kB dist/vendor/shared/agentTank.js
npm notice 1.8kB dist/vendor/shared/analyticsTimeframe.js
npm notice 2.0kB dist/vendor/shared/antigravityCompatibility.js
npm notice 5.1kB dist/vendor/shared/apiOrigin.js
npm notice 8.5kB dist/vendor/shared/connectDiscovery.js
npm notice 9.2kB dist/vendor/shared/cronSchedule.js
npm notice 254B dist/vendor/shared/demoMode.js
npm notice 4.3kB dist/vendor/shared/desktopPairing.js
npm notice 481B dist/vendor/shared/desktopTokenRevocation.js
npm notice 8.9kB dist/vendor/shared/events.js
npm notice 2.5kB dist/vendor/shared/githubAppManifest.js
npm notice 1.6kB dist/vendor/shared/githubAuthMode.js
npm notice 2.0kB dist/vendor/shared/githubEventIntakeMode.js
npm notice 11.6kB dist/vendor/shared/goalBlockers.js
npm notice 6.0kB dist/vendor/shared/goalCheckpoints.js
npm notice 4.0kB dist/vendor/shared/goalCreation.js
npm notice 4.9kB dist/vendor/shared/goalWait.js
npm notice 12.2kB dist/vendor/shared/index.js
npm notice 214B dist/vendor/shared/instanceAuthorization.js
npm notice 54B dist/vendor/shared/instanceCatalog.js
npm notice 4.0kB dist/vendor/shared/intakeModePrerequisites.js
npm notice 2.9kB dist/vendor/shared/labelUtils.js
npm notice 16.6kB dist/vendor/shared/modelDefinitions.js
npm notice 3.5kB dist/vendor/shared/notificationLinks.js
npm notice 51.3kB dist/vendor/shared/notifications.js
npm notice 866B dist/vendor/shared/projectSlug.js
npm notice 3.8kB dist/vendor/shared/proprCompatibility.js
npm notice 13.0kB dist/vendor/shared/proprServiceUrls.js
npm notice 16.6kB dist/vendor/shared/prTemplate.js
npm notice 2.2kB dist/vendor/shared/publishedVisualPreviews.js
npm notice 2.6kB dist/vendor/shared/reasoningLevels.js
npm notice 1.2kB dist/vendor/shared/repositoryIcon.js
npm notice 1.4kB dist/vendor/shared/repositoryIconUrl.js
npm notice 3.7kB dist/vendor/shared/repositoryPresentation.js
npm notice 9.5kB dist/vendor/shared/reviewContextBudget.js
npm notice 5.8kB dist/vendor/shared/reviewFeedbackIds.js
npm notice 1.7kB dist/vendor/shared/reviewPrompt.js
npm notice 907B dist/vendor/shared/runCostCap.js
npm notice 861B dist/vendor/shared/sessionSecret.js
npm notice 603B dist/vendor/shared/statusKeys.js
npm notice 7.5kB dist/vendor/shared/syntheticAgents.js
npm notice 2.2kB dist/vendor/shared/taskIdentifiers.js
npm notice 1.8kB dist/vendor/shared/taskLifecycle.js
npm notice 733B dist/vendor/shared/taskReplacement.js
npm notice 957B dist/vendor/shared/text.js
npm notice 5.6kB dist/vendor/shared/usageTips.js
npm notice 335B dist/vendor/shared/usageTypes.js
npm notice 1.1kB dist/vendor/shared/userWhitelist.js
npm notice 758B dist/vendor/shared/validateRelayUrl.js
npm notice 2.2kB dist/vendor/shared/validateRoutingUrl.js
npm notice 7.1kB dist/vendor/shared/visualPreviewCapacity.js
npm notice 9.3kB dist/vendor/shared/voice.js
npm notice 222B dist/vendor/shared/workEvidence.js
npm notice 622B package.json
npm notice Tarball Details
npm notice name: propr-cli
npm notice version: 0.9.0
npm notice filename: propr-cli-0.9.0.tgz
npm notice package size: 439.8 kB
npm notice unpacked size: 1.8 MB
npm notice shasum: 7f283b3a06d144109d32ecca9786bad560eadcac
npm notice integrity: sha512-+vpuaj3o/851q[...]PFZFsKqNb60hg==
npm notice total files: 175
npm notice
propr-cli-0.9.0.tgz

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

--- Core Service: Lint & Build ---
❌ Core Lint FAILED

> [email protected] lint
> eslint src/ --max-warnings 0


/var/lib/propr-ci/worker1/work/propr/propr/src/worker.ts
  473:1  warning  File has too many lines (401). Maximum allowed is 400  max-lines

✖ 1 problem (0 errors, 1 warning)

ESLint found too many warnings (maximum: 0).

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

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

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

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

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

View Workflow

@propr-dev

propr-dev Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit f23ba80

Summary of Changes

I fixed the Validate Changes failure, and both npx eslint src/worker.ts --max-warnings 0 and the full npm run lint now pass locally.

Cause: Only the "Core Service" lint check failed; every other build and lint check passed. src/worker.ts was 401 lines when counted by ESLint's max-lines rule, and the limit is 400. This branch added the processAgentRunJob and processAgentActionJob imports, which pushed the file one line over. With --max-warnings 0, that one warning failed the step.

Fix: In src/worker.ts, I combined two separate imports from @propr/core into one line:

import { generateCorrelationId, logger, reconcileEpicExecutionQueues } from '@propr/core';

This matches how the branch already combined the loadSettings imports. No behaviour changes.

There's nothing visual to show, so I didn't create a preview.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-dev[bot]
  • Time: 2m 41s
  • Tokens: 495,146 (493,237 in / 1,909 out)
  • Cost: $0.36

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

…int src/worker.ts --max-warnings 0` and the full `npm run lint` now pass locally.

I fixed the **Validate Changes** failure, and both `npx eslint src/worker.ts --max-warnings 0` and the full `npm run lint` now pass locally.

**Cause:** Only the "Core Service" lint check failed; every other build and lint check passed. `src/worker.ts` was 401 lines when counted by ESLint's `max-lines` rule, and the limit is 400. This branch added the `processAgentRunJob` and `processAgentActionJob` imports, which pushed the file one line over. With `--max-warnings 0`, that one warning failed the step.

**Fix:** In `src/worker.ts`, I combined two separate imports from `@propr/core` into one line:
```ts
import { generateCorrelationId, logger, reconcileEpicExecutionQueues } from '@propr/core';
```
This matches how the branch already combined the `loadSettings` imports. No behaviour changes.

There's nothing visual to show, so I didn't create a preview.

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

propr-dev Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

ℹ️ Analyzed the follow-up request by @github-actions[bot]

Analysis Summary

I didn't change anything: this failure is from an older commit, and the current branch already passes the check.

  • Why it's stale: The log flags src/worker.ts at line 473 with 401 counted lines. That matches the file at 76f8cca20, which was 473 lines long. The latest commit, f23ba80c9, already fixed it by merging two @propr/core imports into one line. At HEAD the file is 472 lines, which is exactly 400 counted lines, the maximum allowed.
  • Checked locally on HEAD: npx eslint src/ --max-warnings 0 exits 0 with no warnings, the same command as CI's Core Lint step. main has no changes to src/worker.ts since this branch split off, so merging in main won't push it back over.

Re-running the checks on the current HEAD should clear Core Lint. Every other step in this run already passed. The file is now exactly at the limit, so the next line added to it will trigger the warning again.

There's nothing visual here, so I didn't create a preview.

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


🤖 Analysis Details

  • Model: Claude Opus 5.5 (medium)
  • Time: 2m 25s
  • Tokens: 275,080 (273,611 in / 1,469 out)
  • Cost: $0.26

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

propr-dev Bot added 5 commits October 7, 2026 06:33
…, API, MCP and CLI runs and `auto` acting steps now check provider usage before spending tokens. One part of the issue isn't wired yet: the deferred-run retry belongs to issue 12, which isn't on this branch. The gate already handles the 6-deferral limit when a retry passes in the existing run, and a test simulates that path.

All six acceptance criteria are covered by `test/agentRunCostGate.test.ts` (20 tests, passing). The existing agent, settings and Agent Tank test files I ran also pass. Typecheck is clean for the root, `packages/core` and `packages/api`, and eslint is clean on everything I touched.

The threshold setting. There was no instance-wide "pause at % of subscription usage" control; synthetic pools only have per-member limits. So I added `agent_run_usage_pause_percent` (whole number 50–100, default 90). It is validated on save, returned by the settings endpoint, listed in `SETTINGS_CATALOG`, and readable and writable through `get/update_execution_settings`. I regenerated `docs/docs/operations/settings-locations.md` to include it. It has no Settings UI field yet, so it can only be changed through MCP or the API.

The gate (`packages/core/src/services/agents/agentRunCostGate.ts`):
- Manual "Run now" always proceeds.
- No usage data (Agent Tank disabled, unreachable or no recent snapshot): the run proceeds. This is logged once per provider until data comes back.
- Weekly usage at or over the threshold: the run is skipped.
- Session usage at or over the threshold: the run is deferred until 2 minutes after the session resets, or 30 minutes at most. Once a run has been deferred 6 times, the next check skips it.
- Synthetic pools: every enabled member is checked, and the pool counts as near its limit only if all members are.
- Reasons: every skip and defer reason is a full sentence, e.g. "Weekly subscription usage for claude is at 95% (pause threshold 90%), so this run was skipped; …".
- Snapshots: the gate only reads the cached snapshot and never triggers a refresh. It accepts snapshots up to 1 hour old, longer than the 5 minutes used for pool routing.
- Future escalation: the module header states that any future escalation path must call this gate.

Wiring:
- REST trigger: uses this gate by default.
- Deferred runs now store their reason in `skipReason`. Before, it was only saved for skipped runs.
- `auto` acting step: if the gate holds back an unattended run, the run moves to `awaiting_approval` with "Acting paused: …", and the owner gets the same Inbox notification as preview runs.
- New route: `GET /api/agent-definitions/:id/capacity` returns `{ capacity, threshold }` for the UI warning.
- Usage snapshots now include when the session window resets (from Agent Tank's `resetsInSeconds`), which the deferral time is based on.

Existing tests I changed: I added the new setting to four expected settings responses in `test/configRoutes.followup.test.ts`. The existing auto-mode autonomy tests and the route tests now inject a gate that always lets runs through, so they don't read real config.

There's no visible UI change, so I didn't capture previews.
…res scheduled agents once per slot, retries deferred runs, fails stuck runs, and revokes leftover MCP grants. The 15 new tests in `test/agentRunScheduler.test.ts` pass, and so do the existing agent run tests I re-ran. Typecheck and eslint (`--max-warnings 0`) are clean.

What's in `src/agentRunScheduler.ts`

- Schedule sweep (`runAgentScheduleSweep`):
  - It picks up to 50 due definitions and claims each slot by moving `next_run_at` off the exact value it read.
  - It then fires through `triggerAgentRun` with the cost gate and the idempotency key `schedule:<slot ISO>`.
  - If the daemon missed several slots, one run is created for the latest due slot, and `next_run_at` moves to the next future slot.
  - If the owner is no longer a member, the schedule is turned off and no run is created.
  - If the definition no longer validates (`AGENT_INVALID`), a `skipped` run records the reason via a new `recordSkippedRun` helper.
  - Each definition has its own try/catch and logs one line with `definitionId`, `slot`, `runId` and `decision`.
- Deferred retry: this reuses `retryDueDeferredAgentRuns`, which was already on the branch, with the same cost gate as the schedule sweep.
- Stuck runs: `running`/`acting` runs whose task has been terminal in `task_history` for over 10 minutes are marked `failed` with "The worker stopped before recording the result."
- Grant cleanup (every 10 minutes): revokes `agent_run_grant` records whose run has ended or is gone, or whose record has expired. It goes through the signed internal revoke route, and a failed revoke is retried on the next pass.
- `scheduleAgentRunSweeps(intervalMs = 60_000)`: runs everything once at start, then on its interval, and never overlaps itself. It replaces `startDeferredAgentRunRetry` in `src/daemon.ts`. Shutdown clears both intervals and waits for any sweep still running.

New core store helpers: `listDueScheduledAgentDefinitions`, `claimAgentDefinitionScheduleSlot` and `disableAgentDefinitionSchedule`. I removed `startDeferredAgentRunRetry` from core because nothing else used it.

Where I differed from the issue

- No `rescheduleDeferredRun`: the existing `redeferAgentRun` already does the guarded "stay deferred, count one more" update.
- Revoke without a grant id: `revokeAgentRunMcpGrant` now accepts a call with no grant id, which the sweep needs because it only knows the run and phase.

Decisions for you

- Membership check: an owner counts as a member if they have an `instance_members` row or are in `PROPR_ADMIN_USERS`, and are allowed by the GitHub user whitelist if one is set. Users who log in without a membership row are not counted, so their schedules get turned off on the first due slot. That follows the issue's wording, but if those users are meant to keep scheduled agents, the check needs to include them.
- Grant cleanup needs config: it only works if the daemon has `SYSTEM_TASK_SECRET` and can reach the API at `PROPR_INTERNAL_API_URL`. Without them it logs a warning for each leftover grant every 10 minutes and revokes nothing.

There's nothing visual in this change, so I made no previews.
…es/api/mcp/toolsAgentRuns.ts`, registered in the tool catalog. The 7 new tests in `packages/api/test/mcpAgentRuns.test.ts` pass, and so do the existing MCP, agent-definition-route, run-grant and docs-manifest tests I re-ran. Typecheck and eslint (`--max-warnings 0`) are clean.

The tools
- Read scope: `list_agent_definitions`, `get_agent_definition`, `get_agent_definition_contract`, `list_agent_runs` and `get_agent_run`.
  - `list_agent_definitions` is paged, takes an optional `repository` filter, and leaves out prompts to keep pages small.
  - `get_agent_run` cuts reports over 200 KB, sets `reportTruncated: true`, and returns a `url` of the form `/agents/:definitionId/runs/:runId`. That path comes from the web UI issue (#2815), which isn't on this branch yet, so the link won't open until that UI lands.
- Execute scope:
  - `trigger_agent_run` starts the run with trigger kind `mcp`, passes `'mcp:' + idempotencyKey` and goes through the cost gate. It returns `{ runId, state, created, continuation: { agentRunId } }` with status 202.
  - `approve_agent_run` (optional `note`) and `reject_agent_run` reuse the existing HTTP route logic, so a double approval still moves the run only once. Approving a run that isn't in preview mode fails with `AGENT_RUN_NOT_PREVIEW`.

The rules from the issue
- Repository access: every tool checks every repository of the definition, plus the repositories saved with the run. A definition with one repository the grant can't access is left out of lists. Calling a tool on it directly gives `REPOSITORY_FORBIDDEN`. Another user's definition or run gives `NOT_FOUND`.
- No recursion: a token issued to an agent run gets `AGENT_RECURSION_FORBIDDEN` from trigger, approve and reject. It can still read.
- `get_operation`: trigger and approve receipts now report the run's `state`, `reportedAt` and `finishedAt`. The receipt shows `running` once the run starts. It becomes `completed` when the run completes, is rejected or is skipped, and `failed` (code `AGENT_RUN_FAILED`) when the run fails.

Changes outside the new module
- New `authorize` hook on tools (`packages/api/mcp/toolExecution.ts`): it runs before the receipt is written. Without it, a recursion or repository denial would be stored as a failed receipt instead of being returned as the standard error.
- Test hook: `ToolDeps` has a new optional `agentRuns` field so tests can supply their own trigger, cost gate and acting step.
- Cancelled runs: the issue doesn't say what a cancelled run should do to its receipt. I chose to mark the receipt `cancelled`.
- Docs: I added a row to `docs/mcp-coverage.md` and a "Run a saved agent" section to `docs/mcp.md`.
- Existing test changed: `mcpObservableSurface.test.ts` checks every backticked word in `docs/mcp.md`. I added the new ones it flagged to its allowed list (`deferred`, `awaiting_approval`, `dry_run`, `preview`, `auto`, `note`, `created`).

Acceptance criteria
- Covered by tests: the same key returns the same receipt and creates one run; a grant missing a repository can't read or trigger; an agent-run token is refused; `get_operation` reaches `completed`.
- Partly covered: the scope check filters the catalog the same way `tools/list` does, but doesn't call the MCP server's `tools/list` itself.

There's nothing visible to capture, so I made no previews.
…ions`) for issue #2813. All 19 new tests pass, as do the 59 existing goal, index, completion and API-error tests I re-ran. `npm run typecheck` is clean. The CLI package has no eslint config, so the linter skips these files and I couldn't lint them. Nothing ran against a live server, so the server-side acceptance criteria are covered only by tests with stubbed HTTP responses.

Client functions (`packages/cli/src/api/automations.ts`)
- The eight requested functions call `/api/agent-definitions` and `/api/agent-runs`.
- The trigger sends `Idempotency-Key` and `{ trigger: 'cli', source }`, and retries transient failures with the same key. It reuses the `mutate` helper from `goals.ts`, which I exported for this.
- Approve, reject and cancel are sent once, without retries. The server checks the run's state before changing it, so a blind retry after a lost reply would just get a 409.

Commands (`packages/cli/src/commands/automationCommands.ts`)
- Subcommands: `list`, `show`, `run`, `runs`, `report`, `approve --note`, `reject` and `cancel`.
- Key and `created`: `run` prints the run id, state, `created: true/false` and the key. If you don't pass a key, it generates `cli-<uuid>` and prints it. A failed command also prints the retry hint with that key.
- `--wait`: polls every 5 s. Run metadata and state changes go to stderr; the report goes to stdout.
- Exit codes: 0 completed, 2 timed out, 3 skipped or deferred (reason on stderr), 4 awaiting approval, and 1 for failed, rejected, cancelled or error.
- `report`: writes only the Markdown to stdout. It exits 1 if the run has no report yet.
- Errors: handled with `classifyApiError` / `presentApiError`. A 404 prints `Agent not found` (`Agent run not found` for run ids).
- JSON: `--json` prints `{ version: 1, kind: ... }` documents, with kind `automation-run` for run results.
- Help: the `run` help text includes a GitHub Actions example.

Registration and docs
- The group is registered in `commands/index.ts` and `index.ts`, and listed under "Command Groups" in `propr --help`. `propr agent` itself is unchanged.
- I added an "Agents (saved automations)" section to `docs/docs/features/propr-cli.md`.

Choices that differ slightly from the issue:
- `--wait` stops on `deferred` (exit 3). A deferred run can wait hours for provider capacity, so polling would otherwise just run to the timeout.
- `run` without `--wait` uses the same exit codes. A trigger that is deferred straight away exits 3, which is what the acceptance criterion describes.
- Rejected and cancelled runs exit 1. The issue doesn't list them.
- Help labels changed. The two group lines in `propr --help` are now labelled "Automations … (Agents: saved automations)" and "Agents … (coding-agent configurations)" so the two concepts don't get confused.

No preview images were made, since this is a CLI-only change.
…client, the `/agents` routes, the sidebar entry, the list, and the create/edit form. The 10 new tests pass, as does the full UI suite (2043 tests). UI typecheck and lint are clean, and so is typecheck for the root and `packages/api`. Everything ran against stubbed API responses, never a live server, so the "edit in two tabs" check is only simulated.

What's in place
- API client (`propr-ui/src/api/agentDefinitionsApi.ts`): all 14 wrappers. Failed requests keep their HTTP status, so the editor can tell a 409 conflict from other errors.
- Routes and sidebar: `/agents`, `/agents/new`, `/agents/:definitionId` and `/agents/:definitionId/runs/:runId`, loaded as their own chunk. Agents sits after Goals with the `Workflow` icon; "Coding Agents" is unchanged.
- Page (`AgentsPage.tsx`): from 1280px wide, the list stays on the left and the selected agent opens beside it (Esc or ✕ closes it). Below that, the list and the agent are separate pages with a "Back to list" link.
- List (`AgentList.tsx`): each row shows the name, autonomy badge, short repo names, model, schedule ("Daily 09:00 UTC · next in 3h" or "Manual") and last run state. It has search, a "New agent" button, a skeleton while loading, and an empty state explaining what an agent is.
- Editor (`AgentEditor.tsx`, split into section files, each under 300 lines):
  - All the requested fields: repo multi-select (max 10), prompt, input files, previous reports, model, capabilities, schedule and autonomy.
  - The schedule has the four presets, a live "Next run" in UTC and inline errors from `validateAgentSchedule`.
  - Saving checks with `validateAgentDefinitionInput` first and sends nothing if invalid.
  - Saving sends `expectedRevision`; a 409 shows "Changed elsewhere — reload" with a Reload button and blocks Save.
  - Delete asks for confirmation, and a 409 shows as an error.
  - In demo mode the form is read-only and Run/Save are disabled.

Changes and choices you should know about
- Server change: the instance catalog had no agent type, so the UI couldn't tell an OpenCode agent from a Claude one. I added an optional `type` to catalog entries for direct agents (`packages/shared/src/instanceCatalog.ts`, `packages/api/routes/instanceCatalogRoutes.ts`) and updated the three existing tests that compare the exact catalog output. Pooled agents still have no type, so the UI allows `propr_mcp` for them and leaves the check to the server.
- Autonomy is also locked: for an unsupported agent like OpenCode, Preview and Auto are disabled as well as `propr_mcp`, because the server rejects those for agents without ProPR tools.
- Last run state costs one request per agent: the list endpoint doesn't return it, so the page fetches the latest run for each agent separately. Adding it to the list endpoint would be cheaper.
- Run detail isn't built yet: `/agents/:id/runs/:runId` currently just shows the agent editor until issue 16 adds the run view. "Run now" starts a run and shows a short notice rather than opening it.

Screenshots of the split view, the locked OpenCode toggles and the narrow-screen cron error are attached as previews.
@integry

integry commented Oct 7, 2026

Copy link
Copy Markdown
Owner

/merge

@propr-dev

propr-dev Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Resolved merge conflicts from main into 2800-epic-agents-v1-y7t in commit b1af025

Conflicting Files

  • CHANGELOG.md
  • packages/api/routes/taskHelpers.ts
  • packages/api/server.ts
  • packages/api/test/mcpObservableSurface.test.ts
  • src/daemon.ts

Resolution Summary

All five conflicts are resolved and no conflict markers remain. The root typecheck is clean and gen:openapi:check and check:client-contract pass. The 63 tests I re-ran all pass (route coverage, OpenAPI conformance, route authorization, the OpenAPI reference page, MCP observable surface, agent definition routes and task helpers). The files still show as unmerged in git only because they haven't been staged yet.

The conflicts

1. CHANGELOG.md. Both branches added an entry at the top of ### Added: this PR's Agents (v1) entry and main's HTTP API reference / @propr/client entry. I kept both, PR first. They describe separate features, so neither replaces the other.

2. packages/api/test/mcpObservableSurface.test.ts. Both branches added words to the same allowlist: this PR's agent-run words (awaiting_approval, dry_run, propr_mcp, …) and main's words for the repository search and read tools (caveat, freshness, semantic, …). I kept both groups, since each side's tests need its own words.

3. src/daemon.ts. Both branches added an import on the same line: this PR's scheduleAgentRunSweeps and main's scheduleUltrafixResumeSweep. Both are used later in the file, so I kept both.

4. packages/api/routes/taskHelpers.ts. Both branches made the attention lookup take a clock, written as { now: query.now } here and { now } on main. I took main's version, since now is already pulled out of query and the behaviour is identical. Git had also merged in two copies of the now?: Date field on the query type, which broke the typecheck. I removed the second copy.

5. packages/api/server.ts. This was the only real structural conflict. Main moved the inline operationalRoutes list into createOperationalRouteEntries() in routeRegistry.ts, which the new OpenAPI generator reads. This PR had added the agent definition and agent run routes to the old inline list. To keep this PR's routes while following main's design:

  • I used main's createOperationalRouteEntries({...}) call and passed in agentDefinitionRoutes and agentDefinitionAttachmentUpload.
  • I added both to the function's inputs in routeRegistry.ts, plus the 15 /api/agent-definitions and /api/agent-runs routes, placed after the goal routes as before.
  • I dropped the now-unused createTaskDeleteRouteEntries import from server.ts, since main's registry already includes those routes. I kept this PR's createAgentRunInternalRoutes import.

Extra changes needed for main's API spec checks

Once the agent routes were in the registry, main's spec generator and route coverage test failed. I made three small changes so the merged branch passes main's pull request checks:

  • packages/api/openapi/buildSpec.ts: added an "Agent definitions" tag for /api/agent-definitions, /api/agent-runs and /api/internal/agent-runs. Without it the generator throws No OpenAPI tag covers /api/agent-definitions.
  • packages/api/openapi/directRoutes.ts: listed the PR's two /api/internal/agent-runs/:runId/mcp-grants routes. They are registered straight on the app, which main's coverage test requires to be listed. I marked them auth: 'public' because they check a request signed with SYSTEM_TASK_SECRET rather than a login or token. You may want a different label there.
  • Regenerated docs/static/openapi/propr-api.yaml with npm run gen:openapi. It now lists 253 routes; the new ones are marked x-undocumented like most existing routes.

ESLint couldn't check the files I touched, because there is no ESLint config that covers them.


🤖 Resolution Details

  • Model: Claude Opus 5.5
  • Time: 6m 13s

View Task Execution


System-triggered merge conflict resolution

Automatically resolved merge conflicts after merging target branch into PR branch.
Resolved conflicts in:
- CHANGELOG.md
- packages/api/routes/taskHelpers.ts
- packages/api/server.ts
- packages/api/test/mcpObservableSurface.test.ts
- src/daemon.ts

PR: #2821
Model: Claude Opus 5.5
@integry

integry commented Oct 7, 2026

Copy link
Copy Markdown
Owner

/ultrafix

@propr-dev propr-dev Bot added the ultrafix label Oct 7, 2026
@propr-dev

propr-dev Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

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

First action: /review

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

@propr-dev

propr-dev Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

This PR adds saved Agents across shared contracts, storage, execution, scheduling, REST, MCP, CLI, and UI. It needs changes before merge: MCP approval rejects auto runs paused for approval, and report sizing can exceed the MCP response limit.

✅ Shared validation — Definition limits, capability vocabulary, and UTC scheduling rules are centralized and exercised by boundary tests.

✅ Grant lifecycle — Phase grants use restricted scopes, transactional replacement, and grant-specific revocation that protects newer credentials from stale cleanup.

✅ UI response ordering — Version checks prevent older polling responses from overwriting newly recorded run state.

This review is partial because 22 files were explicitly omitted, including the scheduler, REST routes, stores, and report executor. No commands or tests were run. The supplied authoritative check summary reports no blocking failures.

Merge blockers

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

F1: 🔴 Allow approval of paused auto runs

  • Required behavior: Auto runs paused by the cost gate must remain approvable through the supported approval surfaces.

  • Evidence: packages/api/mcp/toolsAgentRuns.ts, approve_agent_run.authorize; src/jobs/agentRuns/autonomy.ts, advanceAfterReport.

    1. A scheduled definition with autonomyMode: 'auto' finishes its report.
    2. The cost gate returns defer or skip. advanceAfterReport moves the run to awaiting_approval, preserving its snapshotted auto autonomy.
    3. The owner calls approve_agent_run.
    4. Its authorization hook rejects every run whose autonomy is not preview, returning AGENT_RUN_NOT_PREVIEW before invoking the approval route.

    The owner cannot approve this explicitly supported waiting state through MCP. Ownership and repository authorization do not prevent the failure; the subsequent autonomy check causes it. static trace: the producer of the waiting state and the rejecting consumer are both visible in the supplied diff.

  • Minimum fix: Permit approval of auto runs placed in awaiting_approval, retaining ownership, repository, recursion, and guarded state-transition checks.

F2: 🔴 Bound the entire MCP run response

  • Required behavior: Valid stored reports and action summaries must remain readable within the MCP response-size limit.

  • Evidence: packages/api/mcp/toolsAgentRuns.ts, boundReport and runDetail; src/jobs/agentRuns/runErrors.ts, actionSummaryFromResult.

    1. A run produces a report containing 100,000 three-byte Unicode characters and an action summary containing 20,000 such characters. Both satisfy the respective stored character limits.
    2. get_agent_run calls runDetail, which bounds only the JSON-encoded report to approximately 204,800 bytes.
    3. The unchanged action summary adds approximately 60,000 bytes, before the remaining receipt fields and JSON envelope.
    4. The resulting response exceeds the stated 256 KiB MCP result bound, preventing the tool from returning the run detail successfully.

    The report’s reserved headroom is smaller than a valid summary alone. Character limits and report-only truncation therefore do not protect this combination. static trace: these sizes follow from the supplied limits and serialization logic; no test was executed. The size-enforcement implementation itself is outside the supplied diff.

  • Minimum fix: Budget the complete serialized run response, including the action summary, metadata, and envelope; truncate displayed text with explicit indicators as necessary.

Suggestions

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

S1: 🟢 Cache cron validation results

validateAgentSchedule scans 146,097 days per call. The editor validates during rendering, and nextScheduledRun repeats validation. Caching by expression would avoid repeated calendar scans during unrelated edits. This is an optional performance improvement; no measured responsiveness failure was established.

S2: 🟢 Reuse the accessible confirmation dialog

AgentDeleteDialog lacks the focus trapping, background inertness, and focus restoration already implemented in AgentConfirmDialog. Reusing that component would make keyboard interaction consistent without changing deletion behavior. This is a non-blocking accessibility follow-up.

Score

The implementation has substantial defensive logic and targeted coverage, but two verified MCP correctness defects remain. Explicitly omitted files also limit confidence in the complete execution lifecycle.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 23s
  • Tokens: 197,090 (195,621 in / 1,469 out)
  • Cost: $1.92
  • Review scope: Partial — 22 files were omitted by the review context budget.

View Task

Files omitted from review diff

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

Did not fit the review context budget

  • packages/core/src/services/agents/agentDefinitionStore.ts
  • packages/core/src/services/agents/agentRunStore.ts
  • packages/api/test/mcpAgentRuns.test.ts
  • propr-ui/src/components/Agents/AgentEditor.test.tsx
  • packages/api/test/agentDefinitionRoutes.test.ts
  • packages/cli/src/commands/automationCommands.ts
  • src/agentRunScheduler.ts
  • packages/api/routes/agentDefinitionRoutes.ts
  • test/agentRunCostGate.test.ts
  • src/jobs/processAgentRunJob.ts
  • test/agentRunScheduler.test.ts
  • test/processAgentRunJob.test.ts
  • docs/docs/operations/agent-tank.md
  • docs/docs/operations/configuration-reference.md
  • docs/docs/features/propr-cli.md
  • docs/mcp.md
  • docs/mcp-coverage.md
  • docs/docs/features/web-ui.md
  • docs/docs/operations/settings-locations.md
  • docs/docs/features/execution-safety.md
  • docs/static/openapi/propr-api.yaml
  • docs/docs/features/agents.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 F1 F2 S1 S2

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit e4b50fa

Addressed 1 AI review comment (IDs: 6045447036)

Addressed findings F1, F2

Summary of Changes

I fixed F1 and F2. All 12 tests in packages/api/test/mcpAgentRuns.test.ts pass, including two new ones, and the packages/api typecheck is clean. ESLint skips these files because no lint config covers them, so they aren't linted. This is backend-only, so there are no previews.

F1: approving paused auto runs. approve_agent_run now refuses only dry_run runs, which never wait for approval; that refusal keeps the AGENT_RUN_NOT_PREVIEW code. Auto runs that the cost gate moved to awaiting_approval can now be approved. The ownership, repository and recursion checks are unchanged. Whether a run is still waiting is decided by the route's existing guarded state change, so approving an auto run that isn't waiting fails with AGENT_RUN_NOT_AWAITING_APPROVAL.

I checked the other places that make the same assumption. The web UI and CLI already decide by the run's state, not its autonomy mode. reject_agent_run never had the check, so I only updated its description.

New test: an auto run paused by the cost gate can be approved, including repeating the same approval (the acting step starts once). It can also be rejected. An auto run that isn't waiting is refused, and its acting step isn't started.

F2: whole-response budget for get_agent_run. runDetail in packages/api/mcp/toolsAgentRuns.ts now fits the entire response under the 256 KiB limit, keeping 4 KiB free for the response wrapper. It sizes everything except the free-text fields first, then gives those fields the remaining room in this order:

  • Short fields: trigger source, skip reason, failure reason and operator note, up to 16 KiB each.
  • Action summary: up to 64 KiB. A summary at its 20,000-character limit in three-byte characters (about 60 KB) comes back whole.
  • Report: whatever room is left, up to the existing 200 KB.

The report still sets reportTruncated: true when cut. Any other field that gets cut now carries its own flag, such as actionSummaryTruncated: true.

New test: every field at its stored limit in three-byte characters (the review's scenario) fits under the limit with the summary whole and the report cut. A second case uses characters that grow to six bytes when JSON-encoded; the summary and failure reason are then cut and flagged.

I updated the get_agent_run, approve_agent_run and reject_agent_run tool descriptions to match. I also changed one line each in docs/docs/features/agents.md (the truncation limits) and docs/docs/features/mcp.md (which runs can be approved).

I found nothing else outside these two findings.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 6m 16s
  • Tokens: 1,415,068 (1,401,026 in / 14,042 out)
  • Cost: $0.93

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

…entRuns.test.ts` pass, including two new ones, and the `packages/api` typecheck is clean. ESLint skips these files because no lint config covers them, so they aren't linted. This is backend-only, so there are no previews.

I fixed F1 and F2. All 12 tests in `packages/api/test/mcpAgentRuns.test.ts` pass, including two new ones, and the `packages/api` typecheck is clean. ESLint skips these files because no lint config covers them, so they aren't linted. This is backend-only, so there are no previews.

**F1: approving paused auto runs.** `approve_agent_run` now refuses only `dry_run` runs, which never wait for approval; that refusal keeps the `AGENT_RUN_NOT_PREVIEW` code. Auto runs that the cost gate moved to `awaiting_approval` can now be approved. The ownership, repository and recursion checks are unchanged. Whether a run is still waiting is decided by the route's existing guarded state change, so approving an auto run that isn't waiting fails with `AGENT_RUN_NOT_AWAITING_APPROVAL`.

I checked the other places that make the same assumption. The web UI and CLI already decide by the run's state, not its autonomy mode. `reject_agent_run` never had the check, so I only updated its description.

New test: an auto run paused by the cost gate can be approved, including repeating the same approval (the acting step starts once). It can also be rejected. An auto run that isn't waiting is refused, and its acting step isn't started.

**F2: whole-response budget for `get_agent_run`.** `runDetail` in `packages/api/mcp/toolsAgentRuns.ts` now fits the entire response under the 256 KiB limit, keeping 4 KiB free for the response wrapper. It sizes everything except the free-text fields first, then gives those fields the remaining room in this order:
- **Short fields:** trigger source, skip reason, failure reason and operator note, up to 16 KiB each.
- **Action summary:** up to 64 KiB. A summary at its 20,000-character limit in three-byte characters (about 60 KB) comes back whole.
- **Report:** whatever room is left, up to the existing 200 KB.

The report still sets `reportTruncated: true` when cut. Any other field that gets cut now carries its own flag, such as `actionSummaryTruncated: true`.

New test: every field at its stored limit in three-byte characters (the review's scenario) fits under the limit with the summary whole and the report cut. A second case uses characters that grow to six bytes when JSON-encoded; the summary and failure reason are then cut and flagged.

I updated the `get_agent_run`, `approve_agent_run` and `reject_agent_run` tool descriptions to match. I also changed one line each in `docs/docs/features/agents.md` (the truncation limits) and `docs/docs/features/mcp.md` (which runs can be approved).

I found nothing else outside these two findings.

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

propr-dev Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

⏳ Ultrafix is waiting for CI before the next /review.

These blocking checks on e4b50fa are holding the loop back:

  • Windows Connect Discovery (ordinary user, Node 22) — not finished
  • CLI Agent Skill (Node 22) — not finished
  • CLI Agent Skill (Darwin arm64, Node 22) — not finished
  • CLI Agent Skill (Node 24) — not finished
  • CLI Agent Skill (Linux x64, glibc 2.31, Node 22) — not finished
  • Connect Discovery and Darwin ACL (Node 22) — not finished
  • Project options (Node 24) — not finished
  • Project options (Node 22) — not finished
  • Validate Changes — not finished

Checks matching this repository's non-blocking checks never gate Ultrafix. The loop continues automatically once the blocking checks pass; if they have not settled within 2 hours, Ultrafix stops.

@propr-dev

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

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

This PR adds saved Agents across contracts, storage, execution, scheduling, API, MCP, CLI, and UI. It needs a localized correction before merge.

✅ Separate acting phase — Report generation and acting use separate tasks, prompts, and phase-specific MCP grants.

✅ Guarded state changes — The supplied transitions and tests protect cancelled runs from late completion writes and prevent duplicate action claims.

✅ Credential handling — MCP tokens travel through process environment variables rather than command arguments, with explicit redaction coverage.

This review is static and partial: 23 files were explicitly omitted, including the scheduler, report executor, stores, and REST handlers. No commands were run. The authoritative checks show 32 passed, none failed, and one pending.

Merge blockers

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

F3: 🔴 Apply the production acting cost gate

  • Required behavior: Issue Agents v1 (11/17): Agent Tank usage / cost gate for scheduled and unattended runs #2810 requires checking subscription capacity before an automatic acting step starts.

  • Evidence: src/jobs/processAgentActionJob.ts, defaultAgentActionProcessorDeps and preflightFailure; src/jobs/agentRuns/autonomy.ts, advanceAfterReport.

    1. An unattended auto run finishes its report while subscription usage is below the pause threshold.
    2. advanceAfterReport checks capacity, transitions the run to acting, and enqueues its action job.
    3. Before the worker consumes that job, other work raises usage above the threshold. Queue delay makes this an ordinary reachable sequence.
    4. The production processor calls deps.gate?.(...), but defaultAgentActionProcessorDeps supplies no gate, and processAgentActionJob is constructed without overrides.
    5. The acting container therefore starts and spends additional subscription capacity despite the threshold.

    The earlier check protects admission to the queue, not execution after the queue delay. The test named “the cost gate is re-checked before acting” injects a gate explicitly, so it does not cover the production dependency wiring. static trace: verified through the supplied autonomy, processor defaults, preflight, and exported processor construction.

  • Minimum fix: Wire the production cost gate into action preflight for automatic, unapproved acting steps. Preserve the intended manual and human-approval exceptions, and return capacity-blocked automatic actions to an approval-waiting state before creating a task or container.

Suggestions

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

S3: 🟢 Exercise runtime tests in CI

The native tool-policy tests skip unless the exact pinned CLI versions are installed. A dedicated CI job with those versions would make their behavioral checks dependable. This is optional validation improvement; the supplied check summary does not establish whether these particular tests executed.

S4: 🟢 Reuse the accessible confirmation dialog

AgentDeleteDialog implements Escape handling but lacks the focus management and background isolation already implemented in AgentConfirmDialog. Reusing that component would improve keyboard accessibility and reduce duplicate modal code.

Score

The supplied implementation shows substantial defensive work and focused tests, but the production acting cost gate remains incomplete. Explicitly omitted execution and persistence files also limit review confidence.

Score: 6/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 1m 15s
  • Tokens: 196,699 (195,502 in / 1,197 out)
  • Cost: $1.90
  • Review scope: Partial — 23 files were omitted by the review context budget.

View Task

Files omitted from review diff

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

Did not fit the review context budget

  • packages/core/src/services/agents/agentDefinitionStore.ts
  • packages/core/src/services/agents/agentRunStore.ts
  • propr-ui/src/components/Agents/AgentEditor.test.tsx
  • packages/api/test/agentDefinitionRoutes.test.ts
  • packages/cli/src/commands/automationCommands.ts
  • src/agentRunScheduler.ts
  • packages/api/test/mcpAgentRuns.test.ts
  • packages/api/routes/agentDefinitionRoutes.ts
  • test/agentRunCostGate.test.ts
  • src/jobs/processAgentRunJob.ts
  • test/agentRunScheduler.test.ts
  • test/processAgentRunJob.test.ts
  • CHANGELOG.md
  • docs/docs/operations/agent-tank.md
  • docs/docs/operations/configuration-reference.md
  • docs/docs/features/propr-cli.md
  • docs/mcp.md
  • docs/mcp-coverage.md
  • docs/docs/features/web-ui.md
  • docs/docs/operations/settings-locations.md
  • docs/docs/features/execution-safety.md
  • docs/static/openapi/propr-api.yaml
  • docs/docs/features/agents.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 F3 S3 S4

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 6148762

Addressed 1 AI review comment (IDs: 6045847062)

Addressed finding F3

Summary of Changes

I fixed F3: the acting step now re-checks the production cost gate when its queued job starts. All 267 tests in the related agent suites pass, including the new ones, and the root and packages/core typechecks are clean. This is backend-only, so there are no previews.

What changed

  • src/jobs/processAgentActionJob.ts: the processor's defaults now include the real cost gate (createAgentRunCostGate()), and it can no longer be left out.
    • Any acting step no human approved is checked against the gate after preflight. Approved steps are not checked, and the gate itself still lets "Run now" (manual) runs through.
    • If the gate skips or defers the step, the run goes back to Awaiting approval with an "Acting paused: …" reason. This happens before any task, workspace, MCP grant or container is created. The owner gets an Inbox item on a best-effort basis, the same way the after-report path does it.
    • A capacity hold no longer fails the run as "Acting step not started", which is what the old injected-gate code did.
  • packages/core/src/services/agents/agentRunStore.ts: a new pauseUnclaimedAgentRunAction moves a run from acting to awaiting_approval. It only does so while no action job has claimed the run and no one has approved it, so it can't override a run another delivery claimed, or a cancel or failure. I also added this acting → awaiting_approval step to AGENT_RUN_TRANSITIONS and its comment.
  • src/jobs/agentRuns/autonomy.ts: the "Acting paused: …" wording is now a shared helper (actingPausedReason), so both places that pause a run produce the same message.

Tests

  • test/processAgentActionJob.test.ts: by default the test setup now passes every run through the gate. New tests cover:
    • a skip and a defer each returning the run to Awaiting approval without creating a task, grant or container.
    • an approved run not consulting the gate.
    • a run that left acting in the meantime not being paused.
    • a failed Inbox notification not undoing the pause.
    • the production defaults actually including a gate.
  • test/agentRunStore.test.ts: the new store function moves only runs that are unclaimed and unapproved.

The production-defaults test only proves a gate is wired in and that manual runs pass it. It doesn't run the over-threshold path against real Agent Tank data. The gate's threshold logic is covered separately in test/agentRunCostGate.test.ts.

The checks between the gate and the claim are still not one atomic step. If usage rises just after the gate passes, the step still starts. The pause and the claim are both conditional database updates, so whichever runs first wins and the other does nothing. ESLint only checked the two src/jobs files, which pass. It skips the store and test files because no lint config covers them. The existing Agents guide already describes this behavior, so I left the docs alone.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-ultrafix
  • Time: 6m 25s
  • Tokens: 1,549,654 (1,537,232 in / 12,422 out)
  • Cost: $0.90

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

…st gate when its queued job starts. All 267 tests in the related agent suites pass, including the new ones, and the root and `packages/core` typechecks are clean. This is backend-only, so there are no previews.

I fixed F3: the acting step now re-checks the production cost gate when its queued job starts. All 267 tests in the related agent suites pass, including the new ones, and the root and `packages/core` typechecks are clean. This is backend-only, so there are no previews.

**What changed**
- **`src/jobs/processAgentActionJob.ts`:** the processor's defaults now include the real cost gate (`createAgentRunCostGate()`), and it can no longer be left out.
  - Any acting step no human approved is checked against the gate after preflight. Approved steps are not checked, and the gate itself still lets "Run now" (`manual`) runs through.
  - If the gate skips or defers the step, the run goes back to **Awaiting approval** with an "Acting paused: …" reason. This happens before any task, workspace, MCP grant or container is created. The owner gets an Inbox item on a best-effort basis, the same way the after-report path does it.
  - A capacity hold no longer fails the run as "Acting step not started", which is what the old injected-gate code did.
- **`packages/core/src/services/agents/agentRunStore.ts`:** a new `pauseUnclaimedAgentRunAction` moves a run from `acting` to `awaiting_approval`. It only does so while no action job has claimed the run and no one has approved it, so it can't override a run another delivery claimed, or a cancel or failure. I also added this `acting → awaiting_approval` step to `AGENT_RUN_TRANSITIONS` and its comment.
- **`src/jobs/agentRuns/autonomy.ts`:** the "Acting paused: …" wording is now a shared helper (`actingPausedReason`), so both places that pause a run produce the same message.

**Tests**
- `test/processAgentActionJob.test.ts`: by default the test setup now passes every run through the gate. New tests cover:
  - a skip and a defer each returning the run to Awaiting approval without creating a task, grant or container.
  - an approved run not consulting the gate.
  - a run that left `acting` in the meantime not being paused.
  - a failed Inbox notification not undoing the pause.
  - the production defaults actually including a gate.
- `test/agentRunStore.test.ts`: the new store function moves only runs that are unclaimed and unapproved.

The production-defaults test only proves a gate is wired in and that manual runs pass it. It doesn't run the over-threshold path against real Agent Tank data. The gate's threshold logic is covered separately in `test/agentRunCostGate.test.ts`.

The checks between the gate and the claim are still not one atomic step. If usage rises just after the gate passes, the step still starts. The pause and the claim are both conditional database updates, so whichever runs first wins and the other does nothing. ESLint only checked the two `src/jobs` files, which pass. It skips the store and test files because no lint config covers them. The existing Agents guide already describes this behavior, so I left the docs alone.

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

propr-dev Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

⏳ Ultrafix is waiting for CI before the next /review.

These blocking checks on 6148762 are holding the loop back:

  • CLI Agent Skill (Node 24) — not finished
  • Validate Changes — not finished
  • CLI Agent Skill (Node 22) — not finished
  • CLI Agent Skill (Darwin arm64, Node 22) — not finished
  • Connect Discovery and Darwin ACL (Node 22) — not finished
  • Windows Connect Discovery (ordinary user, Node 22) — not finished
  • CLI Agent Skill (Linux x64, glibc 2.31, Node 22) — not finished
  • Project options (Node 24) — not finished
  • Project options (Node 22) — not finished

Checks matching this repository's non-blocking checks never gate Ultrafix. The loop continues automatically once the blocking checks pass; if they have not settled within 2 hours, Ultrafix stops.

@integry integry removed the ultrafix label Oct 7, 2026
@integry

integry commented Oct 7, 2026

Copy link
Copy Markdown
Owner

/review fable

@propr-dev

propr-dev Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — fable

Overall Evaluation

This PR delivers the complete Agents v1 epic (issues #2800–#2816): a shared contract and UTC cron evaluator, durable definition/run stores with a compare-and-set state machine, a single trigger primitive shared by REST/MCP/CLI/schedule, a report executor and a separate acting executor built on the existing task/worktree/container pipeline, native tool-policy enforcement for Claude/Codex (prompt-only elsewhere), run-scoped delegated MCP grants signed with SYSTEM_TASK_SECRET, an Agent Tank cost gate with deferral/skip semantics, daemon sweeps (schedule, deferred retry, stuck-run recovery, grant cleanup), MCP tools, a propr automation CLI group, a master-detail web UI, and documentation. The approach stays faithful to the "no new engine" principle, and the concurrency-sensitive paths (slot claims, deferred retry fencing, action claim via action_task_id, grant replacement under a locked phase record, cancel-then-stop ordering) are consistently guarded and covered by targeted regression tests. I traced the trigger → report → autonomy → acting → grant revocation path, the cancel/stop interleavings, the scheduler's pending-slot obligation, and the deferred-retry dispatch obligation and found no reachable incorrect outcome in the changed code. Pending "Validate Changes" and checksum jobs are still in progress; no current check has failed.

✅ Guarded state machine applied uniformly — Every writer to agent_runs goes through applyAgentRunTransition's WHERE state IN (from) with RETURNING, and callers in processAgentRunJob.ts, processAgentActionJob.ts, agentDefinitionRoutes.ts and agentRunScheduler.ts treat null as "another writer got there first" and reconcile the task from the stored run rather than overwriting it.

✅ Token never enters the argument list — agentToolPolicy.ts emits -e NAME only, values travel via extraEnvVars into the docker process environment (dockerExecutor.ts), the Claude config uses ${PROPR_MCP_BEARER_TOKEN} expansion, secretRedaction.ts covers the env-var echo and short Authorization headers, and test/agentToolPolicy.test.ts / test/dockerExecutorEnvironment.test.ts assert the token is absent from args and process.env is untouched.

✅ Obligations survive process death — The schedule slot stays pending until the receipt exists and is dispatched (fireClaimedSlot), admitted deferred runs keep deferred_until until markRetriedAgentRunDispatched, and a redelivered report job finishes a stored report without re-executing the agent (recoverReportedRun), each with a matching test in test/agentRunScheduler.test.ts, test/agentRunCostGate.test.ts and test/processAgentRunJob.test.ts.

The PR is merge-ready within scope, conditional on the in-progress checks completing green.

Merge blockers

No merge blockers.

Suggestions

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

S5: 🟢 Cron validation is a 146k-day scan per call

validateAgentSchedule in packages/shared/src/cronSchedule.ts calls matchingDayIndexes, which constructs ~146,097 Date objects. AgentScheduleSection.tsx invokes it on every render (once for the error, once more through nextScheduledRun), and scheduleSummary in agentPresentation.ts calls it per list row whenever a stored nextRunAt has passed. Typing in any editor field will therefore cost tens of milliseconds per keystroke. Memoising by expression (a small Map), or using a cheaper interval check for the common */step shapes before falling back to the full scan, would remove the lag without changing semantics. Correctness is unaffected, so this is optional.

S6: 🟢 Internal grant request signature does not cover a nonce or body

agentRunInternalRoutes.ts signs only runId:phase:ts and accepts the same signature for five minutes. A captured issue request replayed inside that window revokes the live grant and issues a fresh one (issueAgentRunGrant revokes the predecessor), which would break an executing agent's MCP access. This requires an attacker on the internal network who could equally capture the response token, so it is not a blocker, but adding a random nonce to the signed payload and rejecting reuse (or binding grantId/expiredBy into the HMAC) would close the replay cheaply.

S7: 🟢 Internal grant endpoints share the discovery rate limiter

server.ts mounts the grant issue/revoke routes behind createDiscoveryRequestRateLimiter(), sized for desktop discovery (default PROPR_DISCOVERY_RATE_LIMIT_MAX=60). The daemon's cleanupAgentRunGrants pages through up to 200 leftover records per pass and revokes each via this endpoint, and a busy worker with propr_mcp/acting runs issues and revokes two grants per run. Hitting the limit surfaces as "ProPR MCP grant request failed (429)" and a failed run. A dedicated limiter with a limit derived from worker concurrency would avoid false throttling.

S8: 🟢 Confirm the MCP mount accepts the internal URL

Agent containers call PROPR_AGENT_MCP_URL (default http://api:4000/api/mcp) while the delegated grant records resource: config.resource (the public origin). test/agentToolPolicyRuntime.test.ts validates the CLI side against a stand-in server, and packages/api/test/agentRunGrants.test.ts authenticates via policy.authenticate directly, so no test exercises the real mountMcp handler receiving a request on a different host. If the mount validates the request origin/resource against MCP_PUBLIC_ORIGIN, every agent MCP call would be rejected in a default Compose deployment. A short integration test (or documenting that PROPR_AGENT_MCP_URL must be the public origin when such validation applies) would settle this.

S9: 🟢 Normalise an empty agent selection to null in the form

formToInput in propr-ui/src/components/Agents/agentEditorForm.ts sends agentId: form.agentId as-is. If AgentModelSelector reports the "Select Agent" option as '' rather than null, validateAgentDefinitionInput rejects the save with "agentId must be a non-empty string", which is an unhelpful message for "use the default agent". agentId: form.agentId || null (and the same for model) is a one-line hardening regardless of the selector's behaviour.

S10: 🟢 Minor documentation inaccuracies

docs/docs/features/agents.md says a deferred/skipped run returns "the reason in error", but the REST body carries it in run.skipReason. The same page and docs/mcp.md list a publish scope among those the acting grant never receives; if no such scope exists in McpScope, drop it to avoid confusing readers of the scope ceiling.

S11: 🟢 Repository-free runs launch with an empty owner/repo

agentRunIssueRef in src/jobs/processAgentRunJob.ts yields repoOwner: ''/repoName: '' for definitions without repositories, so the task row stores repository: '/' and the adapters receive issueRef with empty components. The unit tests mock executeTask, so the real Claude/Codex paths (LLM log attribution, usage-delta bookkeeping, the repo strings in logs) are not exercised for this shape. A sentinel such as agent/<definitionId> or an end-to-end check with a real adapter would reduce the risk of a downstream helper choking on the empty repository.

S12: 🟢 No per-definition active-run guard for manual triggers

Each Run now click sends a fresh Idempotency-Key, so repeated clicks queue several concurrent runs of the same definition. The scheduler coalesces slots but likewise does not skip when a previous run is still active (the fixture string "previous run active" in test/agentRunStore.test.ts hints such a rule was considered). If one-active-run-per-definition is the intended product behaviour, a guard in triggerAgentRun would be a small addition; if not, this is simply worth stating in the docs.

S13: 🟢 Silent scope narrowing for action grants

issueDelegatedGrant filters requested scopes by the instance ceiling. If an administrator's ceiling excludes plan or execute, an acting step is issued a read-only grant and will "complete" with a summary explaining it could not create anything. Failing the acting step up front with a clear reason (or warning on the definition when preview/auto is selected) would make the misconfiguration visible instead of producing a no-op acting run.

Score

A very large, well-structured feature with consistent compare-and-set guards, careful secret handling, broad regression coverage for the interleavings that matter, and no verified blockers in the changed code; the score is held just short of exceptional because two validation checks are still pending and a few integration seams (internal MCP URL, repository-free adapter path) are not exercised end-to-end.

Score: 8/10


🤖 Review Details

  • Model: Claude Fable 5.1
  • Time: 6m 35s
  • Tokens: 568,042 (539,274 in / 28,768 out)
  • Cost: $8.18

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

🤖 Review by ProPR

@integry

integry commented Oct 7, 2026

Copy link
Copy Markdown
Owner

/merge

@propr-dev

propr-dev Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Resolved merge conflicts from main into 2800-epic-agents-v1-y7t in commit 4c0dec3

Conflicting Files

  • CHANGELOG.md
  • docs/static/openapi/propr-api.yaml
  • packages/api/mcp/toolsManagement.ts
  • packages/api/routes/configSettings.ts
  • src/worker.ts

Resolution Summary

All five conflicted files are resolved and no conflict markers remain anywhere in the repo. The root and packages/api typechecks pass, and npm run gen:openapi:check reports the spec and client types are up to date (255 routes). Git still lists the five files as unmerged because the git index is read-only here, so git add failed; the file contents themselves are resolved.

  1. CHANGELOG.md

    • Conflict: both branches added a new bullet in the same spot under ### Added. The PR added Agents (v1) and main added Restricted network egress for agent containers.
    • Resolution: I kept both entries, the PR's first and then main's.
    • Why: they describe separate features, so neither replaces the other.
  2. packages/api/routes/configSettings.ts

    • Conflict: both branches changed the same @propr/core import line. The PR added AGENT_RUN_USAGE_PAUSE_PERCENT_MIN and AGENT_RUN_USAGE_PAUSE_PERCENT_MAX, and main added validateAgentNetworkSetting.
    • Resolution: I merged them into one import with all five names.
    • Why: the file body uses both: the usage-pause check is at line 184 and the network-setting check at line 212. Dropping either import would break the build.
  3. src/worker.ts

    • Conflict: both branches changed the @propr/core import. main added startEgressProxySweeper and moved generateCorrelationId onto its own line.
    • Resolution: a single import of generateCorrelationId, logger, reconcileEpicExecutionQueues and startEgressProxySweeper.
    • Why: the worker calls generateCorrelationId() (line 194) and startEgressProxySweeper() (line 411), so it needs all four names.
  4. packages/api/mcp/toolsManagement.ts

    • Conflict: both branches edited the one-line settingsShape object behind the MCP execution-settings tools. The PR added agent_run_usage_pause_percent, and main added four network settings: agent_network_mode, agent_network_mode_enforced, agent_network_allow and agent_network_ignore_repository_allow.
    • Resolution: I started from main's line and put the PR's agent_run_usage_pause_percent entry back right after default_max_cost_usd, where the PR had it.
    • Why: this shape controls which settings get_execution_settings and update_execution_settings read and write. It needs both branches' settings or one feature's settings can't be managed over MCP.
  5. docs/static/openapi/propr-api.yaml

    • Conflict: the generated route counts in x-route-coverage differed (PR: 253 total; main: 238 total). Neither number was right after the merge, because it now has both branches' routes.
    • Resolution: I reran npm run gen:openapi on the merged code. It produced total: 255, documented: 38, undocumented: 217, plus the spec entries for routes from both branches.
    • Why: the file is generated, so regenerating it is the only way to get correct numbers.

🤖 Resolution Details

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

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/mcp/toolsManagement.ts
- packages/api/routes/configSettings.ts
- src/worker.ts

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

propr-dev Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: Validate Changes

Please investigate and fix this CI failure.

Failure evidence

.github:8
Process completed with exit code 1.

.github:401
Process completed with exit code 1.

.github:461 — 🎭 Playwright Run Summary
242 passed (11.3m)

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Checks Failed

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

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

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

--- Release shell script lint ---

--- Toolchain ---
v22.23.3
10.9.9

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

added 1137 packages, and audited 1146 packages in 14s

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

8 high severity vulnerabilities

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

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

Run `npm audit` for details.

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

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


> @propr/[email protected] build
> tsc


> @propr/[email protected] build
> tsc


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

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

Staged [email protected] at /home/runner/work/propr/propr/dist-publish/propr-cli
npm notice
npm notice 📦  [email protected]
npm notice Tarball Contents
npm notice 26.3kB README.md
npm notice 36.3kB dist/agentSkill.js
npm notice 754B dist/api/agentRuntime.js
npm notice 7.1kB dist/api/agents.js
npm notice 2.6kB dist/api/agentTank.js
npm notice 4.0kB dist/api/automations.js
npm notice 11.7kB dist/api/client.js
npm notice 5.0kB dist/api/errors.js
npm notice 16.6kB dist/api/goals.js
npm notice 6.0kB dist/api/implement.js
npm notice 2.4kB dist/api/index.js
npm notice 1.9kB dist/api/logs.js
npm notice 5.7kB dist/api/plans.js
npm notice 4.2kB dist/api/relay.js
npm notice 11.3kB dist/api/repos.js
npm notice 14.4kB dist/api/settings.js
npm notice 775B dist/api/stats.js
npm notice 1.6kB dist/api/syntheticPools.js
npm notice 1.8kB dist/api/system.js
npm notice 5.8kB dist/api/tasks.js
npm notice 2.9kB dist/api/todos.js
npm notice 86B dist/api/types.js
npm notice 313B dist/api/visualPreviewAuth.js
npm notice 26.9kB dist/assets/env.example.txt
npm notice 5.7kB dist/auth/githubLogin.js
npm notice 19.4kB dist/commands/agentCommands.js
npm notice 4.2kB dist/commands/agentPoolCommands.js
npm notice 4.3kB dist/commands/agentSkillCommands.js
npm notice 29.5kB dist/commands/agentValidation.js
npm notice 27.1kB dist/commands/automationCommands.js
npm notice 66.6kB dist/commands/checkCommands.js
npm notice 8.9kB dist/commands/configCommands.js
npm notice 14.6kB dist/commands/connectCommand.js
npm notice 5.5kB dist/commands/githubAppApi.js
npm notice 27.7kB dist/commands/githubAppCommands.js
npm notice 57.9kB dist/commands/goalCommands.js
npm notice 2.4kB dist/commands/imageCommands.js
npm notice 8.0kB dist/commands/implementCommands.js
npm notice 1.8kB dist/commands/index.js
npm notice 7.3kB dist/commands/initCommands.js
npm notice 14.1kB dist/commands/initStack.js
npm notice 6.1kB dist/commands/logCommands.js
npm notice 24.9kB dist/commands/planCommands.js
npm notice 8.4kB dist/commands/relayCommands.js
npm notice 34.4kB dist/commands/repoCommands.js
npm notice 2.7kB dist/commands/repoValidate.js
npm notice 7.5kB dist/commands/runtimeCommands.js
npm notice 17.9kB dist/commands/settingCommands.js
npm notice 4.0kB dist/commands/setup/agentHostActions.js
npm notice 123B dist/commands/setup/agents.js
npm notice 4.5kB dist/commands/setup/engine.js
npm notice 51B dist/commands/setup/github.js
npm notice 15.3kB dist/commands/setup/hostActions.js
npm notice 27.3kB dist/commands/setup/sequential.js
npm notice 51B dist/commands/setup/state.js
npm notice 51B dist/commands/setup/types.js
npm notice 10.7kB dist/commands/setupCommand.js
npm notice 4.4kB dist/commands/stackCommands.js
npm notice 1.4kB dist/commands/startCommand.js
npm notice 3.7kB dist/commands/statsCommands.js
npm notice 13.5kB dist/commands/systemCommands.js
npm notice 3.5kB dist/commands/tankCommands.js
npm notice 45.5kB dist/commands/taskCommands.js
npm notice 29.6kB dist/commands/todoCommands.js
npm notice 31.0kB dist/commands/tunnelCommand.js
npm notice 2.7kB dist/commands/uiDocsCommands.js
npm notice 8.3kB dist/completion.js
npm notice 20.0kB dist/config/ConfigManager.js
npm notice 276B dist/config/index.js
npm notice 989B dist/config/rootKey.js
npm notice 345B dist/config/types.js
npm notice 42.9kB dist/connectIdentity.js
npm notice 25.0kB dist/connectRootAuthority.js
npm notice 32.5kB dist/connectWindowsAuthority.js
npm notice 2.2kB dist/desktopDiscovery.js
npm notice 12.4kB dist/desktopLocalSetup.js
npm notice 17.1kB dist/index.js
npm notice 4.5kB dist/native/darwin-authority-broker.c
npm notice 8.9kB dist/native/directory-operations.c
npm notice 50.1kB dist/native/prebuilds/darwin-arm64/connect-authority-broker
npm notice 54.2kB dist/native/prebuilds/darwin-arm64/directory-operations.node
npm notice 17.1kB dist/native/prebuilds/darwin-x64/connect-authority-broker
npm notice 24.3kB dist/native/prebuilds/darwin-x64/directory-operations.node
npm notice 28.9kB dist/native/prebuilds/linux-arm64/directory-operations.node
npm notice 17.4kB dist/native/prebuilds/linux-x64/directory-operations.node
npm notice 1.2kB dist/native/README.md
npm notice 3.1kB dist/orchestrator/format.js
npm notice 13.4kB dist/orchestrator/index.js
npm notice 302B dist/orchestrator/manifest.json
npm notice 119.5kB dist/orchestrator/orchestrator.mjs
npm notice 408B dist/orchestrator/types.js
npm notice 237B dist/skill/propr/agents/openai.yaml
npm notice 8.7kB dist/skill/propr/SKILL.md
npm notice 4.5kB dist/tui/AgentTableApp.js
npm notice 4.5kB dist/tui/app.js
npm notice 11.6kB dist/tui/CheckApp.js
npm notice 5.1kB dist/tui/render.js
npm notice 32.5kB dist/tui/SetupApp.js
npm notice 18.4kB dist/tui/SetupApp.test.js
npm notice 8.2kB dist/tui/StartApp.js
npm notice 3.6kB dist/utils/apiErrorPresentation.js
npm notice 12.0kB dist/utils/directoryDescriptor.js
npm notice 739B dist/utils/dockerPort.js
npm notice 5.0kB dist/utils/envFile.js
npm notice 520B dist/utils/index.js
npm notice 5.7kB dist/utils/io.js
npm notice 1.5kB dist/utils/nativeArtifact.js
npm notice 544B dist/utils/parseState.js
npm notice 417B dist/utils/positiveInteger.js
npm notice 4.5kB dist/utils/privateFilesystem.js
npm notice 4.2kB dist/utils/resolveProject.js
npm notice 7.2kB dist/vendor/local-setup/agents.js
npm notice 62.7kB dist/vendor/local-setup/engine.js
npm notice 5.0kB dist/vendor/local-setup/envFile.js
npm notice 9.1kB dist/vendor/local-setup/github.js
npm notice 188B dist/vendor/local-setup/index.js
npm notice 27.0kB dist/vendor/local-setup/publicInstanceIdentity.js
npm notice 14.6kB dist/vendor/local-setup/state.js
npm notice 2.8kB dist/vendor/local-setup/types.js
npm notice 1.0kB dist/vendor/shared/accountStatusTimestamp.js
npm notice 7.6kB dist/vendor/shared/activityEvents.js
npm notice 8.9kB dist/vendor/shared/agentDefinitions.js
npm notice 3.4kB dist/vendor/shared/agentLogin.js
npm notice 3.1kB dist/vendor/shared/agentTank.js
npm notice 1.8kB dist/vendor/shared/analyticsTimeframe.js
npm notice 2.0kB dist/vendor/shared/antigravityCompatibility.js
npm notice 5.1kB dist/vendor/shared/apiOrigin.js
npm notice 8.5kB dist/vendor/shared/connectDiscovery.js
npm notice 9.2kB dist/vendor/shared/cronSchedule.js
npm notice 254B dist/vendor/shared/demoMode.js
npm notice 4.3kB dist/vendor/shared/desktopPairing.js
npm notice 481B dist/vendor/shared/desktopTokenRevocation.js
npm notice 8.9kB dist/vendor/shared/events.js
npm notice 2.5kB dist/vendor/shared/githubAppManifest.js
npm notice 1.6kB dist/vendor/shared/githubAuthMode.js
npm notice 2.0kB dist/vendor/shared/githubEventIntakeMode.js
npm notice 11.6kB dist/vendor/shared/goalBlockers.js
npm notice 6.0kB dist/vendor/shared/goalCheckpoints.js
npm notice 4.0kB dist/vendor/shared/goalCreation.js
npm notice 4.9kB dist/vendor/shared/goalWait.js
npm notice 12.2kB dist/vendor/shared/index.js
npm notice 214B dist/vendor/shared/instanceAuthorization.js
npm notice 54B dist/vendor/shared/instanceCatalog.js
npm notice 4.0kB dist/vendor/shared/intakeModePrerequisites.js
npm notice 2.9kB dist/vendor/shared/labelUtils.js
npm notice 16.6kB dist/vendor/shared/modelDefinitions.js
npm notice 3.5kB dist/vendor/shared/notificationLinks.js
npm notice 51.3kB dist/vendor/shared/notifications.js
npm notice 866B dist/vendor/shared/projectSlug.js
npm notice 3.8kB dist/vendor/shared/proprCompatibility.js
npm notice 13.0kB dist/vendor/shared/proprServiceUrls.js
npm notice 16.6kB dist/vendor/shared/prTemplate.js
npm notice 2.2kB dist/vendor/shared/publishedVisualPreviews.js
npm notice 2.6kB dist/vendor/shared/reasoningLevels.js
npm notice 1.2kB dist/vendor/shared/repositoryIcon.js
npm notice 1.4kB dist/vendor/shared/repositoryIconUrl.js
npm notice 3.7kB dist/vendor/shared/repositoryPresentation.js
npm notice 9.5kB dist/vendor/shared/reviewContextBudget.js
npm notice 5.8kB dist/vendor/shared/reviewFeedbackIds.js
npm notice 1.7kB dist/vendor/shared/reviewPrompt.js
npm notice 907B dist/vendor/shared/runCostCap.js
npm notice 861B dist/vendor/shared/sessionSecret.js
npm notice 603B dist/vendor/shared/statusKeys.js
npm notice 7.5kB dist/vendor/shared/syntheticAgents.js
npm notice 2.2kB dist/vendor/shared/taskIdentifiers.js
npm notice 1.8kB dist/vendor/shared/taskLifecycle.js
npm notice 733B dist/vendor/shared/taskReplacement.js
npm notice 957B dist/vendor/shared/text.js
npm notice 5.6kB dist/vendor/shared/usageTips.js
npm notice 335B dist/vendor/shared/usageTypes.js
npm notice 1.1kB dist/vendor/shared/userWhitelist.js
npm notice 758B dist/vendor/shared/validateRelayUrl.js
npm notice 2.2kB dist/vendor/shared/validateRoutingUrl.js
npm notice 7.1kB dist/vendor/shared/visualPreviewCapacity.js
npm notice 9.3kB dist/vendor/shared/voice.js
npm notice 222B dist/vendor/shared/workEvidence.js
npm notice 622B package.json
npm notice Tarball Details
npm notice name: propr-cli
npm notice version: 0.9.0
npm notice filename: propr-cli-0.9.0.tgz
npm notice package size: 449.2 kB
npm notice unpacked size: 1.9 MB
npm notice shasum: d98d7e64e406517b13a07d01374b43cd0b84f307
npm notice integrity: sha512-ubaCJFNOi6/aM[...]gAQKoRwAanx0Q==
npm notice total files: 177
npm notice
propr-cli-0.9.0.tgz

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

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

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

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

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

/home/runner/work/propr/propr/packages/core/src/services/agents/agentRunStore.ts
  559:1  warning  File has too many lines (410). Maximum allowed is 400  max-lines

✖ 1 problem (0 errors, 1 warning)

ESLint found too many warnings (maximum: 0).

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

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

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

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

View Workflow

@propr-dev

propr-dev Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 26f1c39

Processed 2 comments:

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

Summary of Changes

I fixed the CI failure. It was a lint error, not a test failure: packages/core/src/services/agents/agentRunStore.ts had grown to 410 lines, over the 400-line max-lines limit, and the Core Package Lint step allows zero warnings.

What changed:

  • New file packages/core/src/services/agents/agentRunReports.ts: I moved the previous-report lookup there unchanged — listPreviousReports plus its PreviousAgentReport and ListPreviousReportsOptions types. It only reads agent_runs, so agentRunStore.ts is still the only module that writes run rows. The new file depends on agentRunStore.ts, but not the other way round.
  • packages/core/src/index.ts: it now exports the new module too, so code that imports from @propr/core, such as src/jobs/processAgentRunJob.ts, needed no changes.
  • test/agentRunStore.test.ts: it now imports listPreviousReports from the new file.

Checks:

  • ESLint on the agents folder with zero warnings allowed passes.
  • The packages/core and root typechecks are clean.
  • All 81 tests in test/agentRunStore.test.ts and test/processAgentRunJob.test.ts pass.

This is backend-only, so there are no previews.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-dev[bot], @github-actions[bot]
  • Time: 2m 51s
  • Tokens: 391,622 (388,937 in / 2,685 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 IDs: 6046750676✓, 6046751207✓

…lure: `packages/core/src/services/agents/agentRunStore.ts` had grown to 410 lines, over the 400-line `max-lines` limit, and the Core Package Lint step allows zero warnings.

I fixed the CI failure. It was a lint error, not a test failure: `packages/core/src/services/agents/agentRunStore.ts` had grown to 410 lines, over the 400-line `max-lines` limit, and the Core Package Lint step allows zero warnings.

**What changed:**
- **New file `packages/core/src/services/agents/agentRunReports.ts`:** I moved the previous-report lookup there unchanged — `listPreviousReports` plus its `PreviousAgentReport` and `ListPreviousReportsOptions` types. It only reads `agent_runs`, so `agentRunStore.ts` is still the only module that writes run rows. The new file depends on `agentRunStore.ts`, but not the other way round.
- **`packages/core/src/index.ts`:** it now exports the new module too, so code that imports from `@propr/core`, such as `src/jobs/processAgentRunJob.ts`, needed no changes.
- **`test/agentRunStore.test.ts`:** it now imports `listPreviousReports` from the new file.

**Checks:**
- ESLint on the agents folder with zero warnings allowed passes.
- The `packages/core` and root typechecks are clean.
- All 81 tests in `test/agentRunStore.test.ts` and `test/processAgentRunJob.test.ts` pass.

This is backend-only, so there are no previews.

PR: #2821
Comment by: @propr-dev[bot] (ID: 6046750676)
Comment by: @github-actions[bot] (ID: 6046751207)
Model: Claude Opus 5.5
@integry
integry marked this pull request as ready for review October 7, 2026 21:27
@integry
integry merged commit 33bda2e into main Oct 7, 2026
58 checks passed
@integry
integry deleted the 2800-epic-agents-v1-y7t branch October 7, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants