Skip to content

[3617 by Claude Opus 5.5] API: JSON errors for malformed bodies and unknown routes, bounded /api/activity paging, basic security headers - #3635

Merged
integry merged 5 commits into
3616-epic-0-9-d8bfrom
3617/claude-opus-5-5-api-json-errors-for-malfo-20261117-0149-myt
Nov 17, 2026
Merged

integry merged 5 commits into
3616-epic-0-9-d8bfrom
3617/claude-opus-5-5-api-json-errors-for-malfo-20261117-0149-myt

Conversation

@propr-dev

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

Copy link
Copy Markdown
Contributor

AI Implementation Summary

Closes #3617

Branch: 3617/claude-opus-5-5-api-json-errors-for-malfo-20261117-0149-myt
Commits: ✅ Changes committed (4606293)


AI Processing Completed

Execution Details:

Summary:
I've implemented all seven points of #3617. The new tests and the affected existing suites pass, except three suites that fail here for environment reasons and fail the same way with the old code.

What changed, by issue point

  1. Bad request bodies and other errors return JSON. A new module, packages/api/apiErrorBoundary.ts, does three things:
    • An error handler right after the JSON parser in server.ts answers 400 (INVALID_JSON, or INVALID_REQUEST_BODY for a body that won't decompress), 413 (PAYLOAD_TOO_LARGE) and 415 (UNSUPPORTED_MEDIA_TYPE) before authentication.
    • It replaces Express's HTML final handler for the whole app. That covers unhandled errors (500 INTERNAL_ERROR, logged on the server only) and errors from the 7 MB archive parser and file uploads.
    • No response contains a message, stack or file path from the original error, whatever NODE_ENV is.
  2. Unknown routes return a JSON 404 (NOT_FOUND). I hooked this into Express's final handler rather than adding a last route, because the MCP browser routes under /mcp are mounted after startup and a catch-all would have blocked them.
  3. /api/activity paging is validated. limit must be 1–200 (default 50) and offset a non-negative integer; anything else, including an empty value, is 400 INVALID_PAGINATION.
  4. GitHub branches/workflows routes check owner and repo names. Invalid ones, including .., . and encoded slashes, get 400 INVALID_REPOSITORY.
  5. /api/agent-definitions/templates works. The alias is now registered before /:id, so templates is no longer read as an id.
  6. Headers:
    • X-Powered-By is off.
    • Every response has X-Content-Type-Options: nosniff.
    • Access-Control-Allow-Credentials is only sent when the request has an allowed Origin; the CORS origin rules themselves are unchanged.
    • Every 401 gets WWW-Authenticate: Bearer, unless the handler set its own (MCP keeps its resource_metadata challenge).
  7. Unknown task ids return 404 TASK_NOT_FOUND from history, live-details and file-changes. A task counts as known if it has a task row, a history row, live worker state or a queued job (new helper routes/taskExistence.ts). This check only runs when nothing else was found, so normal requests make no extra queries.

Web UI and CLI

  • The web UI already shows the error message when a task fails to load, and the CLI task commands already handle 404.
  • One CLI change: implement polling now keeps waiting for up to 60 s if a just-accepted task isn't known yet, instead of stopping on the first 404.

OpenAPI and changelog: I added the new 404s to the task route docs and regenerated the spec, which also picks up the templates alias. gen:openapi:check passes. I added an entry under Fixed in CHANGELOG.md.

Tests

  • New: apiErrorBoundaryServer.test.ts runs every point against the real server wiring; it fails against the old server.ts. apiErrorBoundary.test.ts and apiTaskNotFound.test.ts are unit tests for the helpers and task routes.
  • Updated: agentDefinitionRoutes, openapiRouteCoverage and openapiResponseConformance asserted the old behaviour (no templates alias; 200 with empty history for an unknown task). I changed them to expect the new behaviour.
  • Unrelated failures: extensionServerStartup (symlink module resolution), taskFollowupDestination and mcpWorkflows (follow-up comment posting) fail here and fail the same way with the old source files swapped back in.
  • file-changes is covered only by the unit test. In the full-server test it hangs, because core's file-changes cache read tries to reach Redis, which isn't running in this container.

The /api/mcp endpoint's own error responses are still { "error": "INVALID_REQUEST" } with no code, because an existing test pins that exact shape. The MCP consent pages also still return their intentional HTML 403s.

This is an API-only change with nothing visual, so I made no previews.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk (12 files)
    • packages/api/apiErrorBoundary.ts (added, +133/−0)
    • packages/api/mcp/tools.ts (+1/−1)
    • packages/api/openapi/routeDocsTasks.ts (+10/−2)
    • packages/api/routeRegistry.ts (+2/−0)
    • packages/api/routes/fileChangesRoutes.ts (+11/−0)
    • packages/api/routes/githubRoutes.ts (+15/−4)
    • packages/api/routes/liveDetailsRoutes.ts (+4/−1)
    • packages/api/routes/queueRoutes.ts (+28/−2)
    • packages/api/routes/taskExistence.ts (added, +33/−0)
    • packages/api/routes/taskHistoryRoutes.ts (+5/−1)
    • packages/api/server.ts (+12/−3)
    • packages/cli/src/commands/implementCommands.ts (+16/−1)
  • Low risk (8 files)
    • CHANGELOG.md (+15/−0)
    • docs/static/openapi/propr-api.yaml (+32/−5)
    • packages/api/test/agentDefinitionRoutes.test.ts (+5/−6)
    • packages/api/test/apiErrorBoundary.test.ts (added, +74/−0)
    • packages/api/test/apiErrorBoundaryServer.test.ts (added, +146/−0)
    • packages/api/test/apiTaskNotFound.test.ts (added, +101/−0)
    • packages/api/test/openapiResponseConformance.test.ts (+7/−4)
    • packages/api/test/openapiRouteCoverage.test.ts (+1/−6)

Validation evidence

  • No repository validation commands ran.

Diff size: 20 files changed, +651/−36 lines

Detailed Logs:

  • Conversation: 317 messages
  • Session: 6071e916-e9c0-46ea-988e-83b39a24c8dd

Log files stored at:

  • conversation: /usr/src/app/logs/executions/issue-3617-2026-11-17T03-04-19-894Z-conversation.json
  • output: /usr/src/app/logs/executions/issue-3617-2026-11-17T03-04-19-894Z-output.txt
Latest Conversation Messages
ASSISTANT: [content unavailable]

ASSISTANT: I've implemented all seven points of #3617. The new tests and the affected existing suites pass, except three suites that fail here for environment reasons and fail the same way with the old code.

**...


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


💡 Need changes?

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

…ected existing suites pass, except three suites that fail here for environment reasons and fail the same way with the old code.

What changed, by issue point

1. Bad request bodies and other errors return JSON. A new module, `packages/api/apiErrorBoundary.ts`, does three things:
   - An error handler right after the JSON parser in `server.ts` answers 400 (`INVALID_JSON`, or `INVALID_REQUEST_BODY` for a body that won't decompress), 413 (`PAYLOAD_TOO_LARGE`) and 415 (`UNSUPPORTED_MEDIA_TYPE`) before authentication.
   - It replaces Express's HTML final handler for the whole app. That covers unhandled errors (500 `INTERNAL_ERROR`, logged on the server only) and errors from the 7 MB archive parser and file uploads.
   - No response contains a message, stack or file path from the original error, whatever `NODE_ENV` is.
2. Unknown routes return a JSON 404 (`NOT_FOUND`). I hooked this into Express's final handler rather than adding a last route, because the MCP browser routes under `/mcp` are mounted after startup and a catch-all would have blocked them.
3. `/api/activity` paging is validated. `limit` must be 1–200 (default 50) and `offset` a non-negative integer; anything else, including an empty value, is 400 `INVALID_PAGINATION`.
4. GitHub `branches`/`workflows` routes check owner and repo names. Invalid ones, including `..`, `.` and encoded slashes, get 400 `INVALID_REPOSITORY`.
5. `/api/agent-definitions/templates` works. The alias is now registered before `/:id`, so `templates` is no longer read as an id.
6. Headers:
   - `X-Powered-By` is off.
   - Every response has `X-Content-Type-Options: nosniff`.
   - `Access-Control-Allow-Credentials` is only sent when the request has an allowed `Origin`; the CORS origin rules themselves are unchanged.
   - Every 401 gets `WWW-Authenticate: Bearer`, unless the handler set its own (MCP keeps its `resource_metadata` challenge).
7. Unknown task ids return 404 `TASK_NOT_FOUND` from `history`, `live-details` and `file-changes`. A task counts as known if it has a task row, a history row, live worker state or a queued job (new helper `routes/taskExistence.ts`). This check only runs when nothing else was found, so normal requests make no extra queries.

Web UI and CLI
- The web UI already shows the error message when a task fails to load, and the CLI `task` commands already handle 404.
- One CLI change: `implement` polling now keeps waiting for up to 60 s if a just-accepted task isn't known yet, instead of stopping on the first 404.

OpenAPI and changelog: I added the new 404s to the task route docs and regenerated the spec, which also picks up the templates alias. `gen:openapi:check` passes. I added an entry under Fixed in `CHANGELOG.md`.

Tests
- New: `apiErrorBoundaryServer.test.ts` runs every point against the real server wiring; it fails against the old `server.ts`. `apiErrorBoundary.test.ts` and `apiTaskNotFound.test.ts` are unit tests for the helpers and task routes.
- Updated: `agentDefinitionRoutes`, `openapiRouteCoverage` and `openapiResponseConformance` asserted the old behaviour (no templates alias; 200 with empty history for an unknown task). I changed them to expect the new behaviour.
- Unrelated failures: `extensionServerStartup` (symlink module resolution), `taskFollowupDestination` and `mcpWorkflows` (follow-up comment posting) fail here and fail the same way with the old source files swapped back in.
- `file-changes` is covered only by the unit test. In the full-server test it hangs, because core's file-changes cache read tries to reach Redis, which isn't running in this container.

The `/api/mcp` endpoint's own error responses are still `{ "error": "INVALID_REQUEST" }` with no `code`, because an existing test pins that exact shape. The MCP consent pages also still return their intentional HTML 403s.

This is an API-only change with nothing visual, so I made no previews.
@propr-dev

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

/ultrafix goal=8 max=6
Triggered automatically by the requested execution settings.

@propr-dev

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

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

First action: /review

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

@propr-dev

propr-dev Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

🔀 Resolved merge conflicts from 3616-epic-0-9-d8b into 3617/claude-opus-5-5-api-json-errors-for-malfo-20261117-0149-myt in commit 37bb7b2

Conflicting Files

  • docs/static/openapi/propr-api.yaml

Resolution Summary

I resolved the merge conflict. docs/static/openapi/propr-api.yaml was the only file with conflict markers; a search of the whole repository found none anywhere else.

What the conflict was about: The two sides disagreed only on the info.x-route-coverage counts near the top of the file. Git merged the rest of the spec without trouble.

  • This PR: total: 327, documented: 88, undocumented: 239. It adds one route, the new plan-issue list endpoint, which is not annotated yet.
  • 3616-epic-0-9-d8b: total: 326, documented: 89, undocumented: 237. It documents one more existing route and changes other routes so that two fewer are undocumented.

How I resolved it: Neither set of numbers is right for the merged code, because each counts only one side's changes. This file is generated from the route sources, so I regenerated it with npm run gen:openapi instead of choosing one side. The merged code gives total: 327, documented: 89, undocumented: 238: this PR's extra route plus the epic's documentation work.

Why: Regenerating means the file matches the merged sources exactly. Apart from the counts, the regenerated file is identical to the merged text with the markers removed. The generated client types (packages/client/src/generated/apiTypes.ts) did not change.

Checks:

  • No conflict markers are left in any file.
  • npm run gen:openapi:check says the spec and client types are up to date and valid: 327 routes, 89 documented, 238 undocumented.
  • The OpenAPI route-coverage and response-conformance tests pass (25 of 25).

🤖 Resolution Details

  • Model: Claude Opus 5.5
  • Time: 5m 46s

View Task Execution


System-triggered merge conflict resolution

…-5-5-api-json-errors-for-malfo-20261117-0149-myt

Automatically resolved merge conflicts after merging target branch into PR branch.
Resolved conflicts in:
- docs/static/openapi/propr-api.yaml

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

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: Full Test Suite Shard 2/4

Please investigate and fix this CI failure.

  • Check: Full Test Suite Shard 2/4
  • Result: failure
  • Commit: 37bb7b201c45 (37bb7b201c4589bf341e121c1069e0b0e7b55c03)
  • Details: View CI failure

Failure evidence

.github:11
Process completed with exit code 1.

.github:46947
Process completed with exit code 1.

.github:2
Node.js 20 is deprecated. The following actions target Node.js 20 but are being forced to run on Node.js 24: actions/checkout@11d5960. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/

@propr-dev

propr-dev Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit a0aa067

Summary of Changes

I fixed the Shard 2/4 failure: the new test file packages/api/test/apiErrorBoundary.test.ts never exited, so the runner killed it at its 180 s limit.

Cause: All four of its tests passed in CI. But the file imports routes/queueRoutes.js and routes/githubRoutes.js, and importing those opens core's SQLite connection. Nothing closed that connection, so the test process stayed alive until the runner killed it. The other two new API suites already close it in an after hook.

Fix: I added the same cleanup to this file: an after hook that imports @propr/core and calls closeConnection(). No production code changed.

Verification, using the same runner CI uses (scripts/run-test-suite.mjs):

  • Old file: timed out after 180 s, the same failure as CI.
  • New file: passes in 2.7 s, 4 of 4 tests.
  • ESLint on the file reports no warnings.

I only ran this one file, not the full Shard 2/4. One of my runs failed to start because the container's disk was full; it passed once space freed up.

There was nothing visual in this change, so I made no previews.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk: none
  • Low risk (1 file)
    • packages/api/test/apiErrorBoundary.test.ts (+4/−1)

Validation evidence

  • No repository validation commands ran.

Diff size: 1 file changed, +4/−1 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-dev[bot]
  • Time: 8m 52s
  • Tokens: 1,329,464 (1,325,276 in / 4,188 out)
  • Cost: $0.62

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

@propr-dev

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: Run Full Test Suite

Please investigate and fix this CI failure.

Failure evidence

.github:67
Process completed with exit code 1.

.github:66
Full test suite shards finished with result 'failure'.

.github:4
Node.js 20 is deprecated. The following actions target Node.js 20 but are being forced to run on Node.js 24: actions/checkout@11d5960, actions/download-artifact@018cc2c. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/

…api/test/apiErrorBoundary.test.ts` never exited, so the runner killed it at its 180 s limit.

I fixed the Shard 2/4 failure: the new test file `packages/api/test/apiErrorBoundary.test.ts` never exited, so the runner killed it at its 180 s limit.

**Cause:** All four of its tests passed in CI. But the file imports `routes/queueRoutes.js` and `routes/githubRoutes.js`, and importing those opens core's SQLite connection. Nothing closed that connection, so the test process stayed alive until the runner killed it. The other two new API suites already close it in an `after` hook.

**Fix:** I added the same cleanup to this file: an `after` hook that imports `@propr/core` and calls `closeConnection()`. No production code changed.

**Verification**, using the same runner CI uses (`scripts/run-test-suite.mjs`):
- Old file: timed out after 180 s, the same failure as CI.
- New file: passes in 2.7 s, 4 of 4 tests.
- ESLint on the file reports no warnings.

I only ran this one file, not the full Shard 2/4. One of my runs failed to start because the container's disk was full; it passed once space freed up.

There was nothing visual in this change, so I made no previews.

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

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: Validate unsigned darwin-x64 package

Please investigate and fix this CI failure.

  • Check: Validate unsigned darwin-x64 package
  • Result: failure
  • Commit: a0aa06753c99 (a0aa06753c9950b90d0da4039462ea373c1caf6a)
  • Details: View CI failure

Failure evidence

.github:9598
Process completed with exit code 1.

@propr-dev

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: Finalize unsigned validation checksums

Please investigate and fix this CI failure.

  • Check: Finalize unsigned validation checksums
  • Result: failure
  • Commit: a0aa06753c99 (a0aa06753c9950b90d0da4039462ea373c1caf6a)
  • Details: View CI failure

Failure evidence

.github:42
Process completed with exit code 1.

.github:41
Unsigned packaging matrix finished with result 'failure'.

@propr-dev

propr-dev Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 3f1a4fd

Summary of Changes

I fixed the failing Validate unsigned darwin-x64 package check by giving one timing-sensitive desktop test more time. The cause wasn't this PR, which doesn't touch the desktop app; the test file is the same on main.

What failed: one test out of 1,444, nonzero exit escalates against a TERM-ignoring descendant before releasing the guard in apps/desktop/scripts/run-bounded-darwin-command.test.mjs. In that test, a child process starts a second Node process and waits for it to write its process id to a file. Then it exits with code 23. If the file doesn't appear in time, it exits with 24 instead. The wait was only 1 second, and the busy macOS runner took longer than that to start the second process. The CI log shows the process ended with a non-zero exit but not with 23, which matches.

The change (only in that test file):

  • The wait for the file is now 10 seconds, and the overall time limit for the run is now 20 seconds (was 2). The test still checks the same things: the run fails with exit code 23, and the second process, which ignores the normal stop signal, still gets killed.
  • The single pass/fail check became separate assertions, so a future failure shows the actual exit code (24 means the file never appeared) instead of "validation function returned false".

Checks:

  • With the wait set to 0, the test fails with expected: 23, actual: 24, the same failure as in CI.
  • With the fix, all 14 tests in the file pass.

These runs were on Linux. Whether the macOS job passes will show on the next CI run.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk: none
  • Low risk (1 file)
    • apps/desktop/scripts/run-bounded-darwin-command.test.mjs (+11/−5)

Validation evidence

  • No repository validation commands ran.

Diff size: 1 file changed, +11/−5 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-dev[bot]
  • Time: 5m 37s
  • Tokens: 580,253 (576,676 in / 3,577 out)
  • Cost: $0.40

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

…* check by giving one timing-sensitive desktop test more time. The cause wasn't this PR, which doesn't touch the desktop app; the test file is the same on `main`.

I fixed the failing **Validate unsigned darwin-x64 package** check by giving one timing-sensitive desktop test more time. The cause wasn't this PR, which doesn't touch the desktop app; the test file is the same on `main`.

**What failed:** one test out of 1,444, `nonzero exit escalates against a TERM-ignoring descendant before releasing the guard` in `apps/desktop/scripts/run-bounded-darwin-command.test.mjs`. In that test, a child process starts a second Node process and waits for it to write its process id to a file. Then it exits with code 23. If the file doesn't appear in time, it exits with 24 instead. The wait was only 1 second, and the busy macOS runner took longer than that to start the second process. The CI log shows the process ended with a non-zero exit but not with 23, which matches.

**The change** (only in that test file):
- The wait for the file is now 10 seconds, and the overall time limit for the run is now 20 seconds (was 2). The test still checks the same things: the run fails with exit code 23, and the second process, which ignores the normal stop signal, still gets killed.
- The single pass/fail check became separate assertions, so a future failure shows the actual exit code (24 means the file never appeared) instead of "validation function returned false".

**Checks:**
- With the wait set to 0, the test fails with `expected: 23, actual: 24`, the same failure as in CI.
- With the fix, all 14 tests in the file pass.

These runs were on Linux. Whether the macOS job passes will show on the next CI run.

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

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

❌ ProPR could not start on the follow-up

The ProPR worker refused the job because the disk that holds its working copies is nearly full. Nothing was changed on this pull request. Once space has been freed on the worker host, post the command again.

@propr-dev

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

CI failed: Full Test Suite Shard 2/4

Please investigate and fix this CI failure.

  • Check: Full Test Suite Shard 2/4
  • Result: failure
  • Commit: 3f1a4fd0ffa8 (3f1a4fd0ffa878d166abd321d0f5adae7540e1b4)
  • Details: View CI failure

Failure evidence

.github:11
Process completed with exit code 1.

.github:47232
Process completed with exit code 1.

propr-ui/src/pages/SettingsPage/AgentExtensionsOAuth.test.tsx:89 — src/pages/SettingsPage/AgentExtensionsOAuth.test.tsx > OAuth MCP servers in Skills & MCP servers > Reconnect keeps refreshing after a return to Settings before consent, until the new connection is shown
AssertionError: expected 1 to be 2 // Object.is equality

Ignored nodes: comments, script, style

Skills & MCP servers

Give agents extra tools for a task. An MCP server is a service the agent can call while it works, such as a documentation search or an issue tracker. A skill is a folder of instructions, with a

      <code
        class="text-[11px]"
      >
        SKILL.md
      </code>
       and optional scripts, that the agent reads when it is relevant. Only Claude and Codex runs can use extensions.
       
      <a
        class="font-medium text-primary-600 underline hover:text-primary-700"
        href="https://docs.propr.dev/docs/features/agent-extensions"
        rel="noopener noreferrer"
        target="_blank"
      >
        Skills & MCP servers docs
      </a>
    </p>
    <div
      class="max-w-4xl space-y-5"…

@propr-dev

propr-dev Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Applied the requested follow-up changes in commit 540b80b

Processed 2 comments:

Summary of Changes

I made the failing Shard 2/4 test wait properly, but I couldn't make the original failure happen here, so I haven't shown that this change prevents it.

Shard 2/4. The failing test is AgentExtensionsOAuth.test.tsx, a Settings UI test. This PR doesn't touch that file or the code it tests, which are the same on main. The test clicks Reconnect, waits for the "Finish signing in…" notice, then fires a window focus event and expects one more library read.

The problem is a race in the test:

  • React adds the focus listener in an effect that runs just after the notice appears.
  • On a busy CI runner, that effect may not have run yet when the test fires focus.
  • With no listener, nothing happens, so the test sees 1 read instead of 2. That is the reported "expected 1 to be 2".

The test's last step, which checks that the listeners are gone, has the same race in reverse: the effect cleanup may not have run yet.

The fix is in propr-ui/src/pages/SettingsPage/AgentExtensionsOAuth.test.tsx. Before each of those two focus events, the test now runs await act(async () => {}), which makes React finish pending effects. What the test checks is unchanged, and the app code is untouched.

That file passes all 9 tests. The whole Settings page folder passed 297 of 297 tests in each of 3 runs, and lint with zero warnings is clean on the file.

Finalize unsigned validation checksums. That failure is on the older commit a0aa067. It only reports that the unsigned packaging job failed, which was the darwin-x64 check, and the latest commit 3f1a4fd already fixed that. I made no change for it.

Review digest

Risk-tiered paths

  • High risk: none
  • Normal risk: none
  • Low risk (1 file)
    • propr-ui/src/pages/SettingsPage/AgentExtensionsOAuth.test.tsx (+4/−1)

Validation evidence

  • No repository validation commands ran.

Diff size: 1 file changed, +4/−1 lines


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-dev[bot]
  • Time: 5m 19s
  • Tokens: 460,221 (456,976 in / 3,245 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 IDs: 6938161878✓, 6937760542✓

…dn't make the original failure happen here, so I haven't shown that this change prevents it.

I made the failing Shard 2/4 test wait properly, but I couldn't make the original failure happen here, so I haven't shown that this change prevents it.

**Shard 2/4.** The failing test is `AgentExtensionsOAuth.test.tsx`, a Settings UI test. This PR doesn't touch that file or the code it tests, which are the same on `main`. The test clicks Reconnect, waits for the "Finish signing in…" notice, then fires a window `focus` event and expects one more library read.

The problem is a race in the test:
- React adds the focus listener in an effect that runs just after the notice appears.
- On a busy CI runner, that effect may not have run yet when the test fires `focus`.
- With no listener, nothing happens, so the test sees 1 read instead of 2. That is the reported "expected 1 to be 2".

The test's last step, which checks that the listeners are gone, has the same race in reverse: the effect cleanup may not have run yet.

The fix is in `propr-ui/src/pages/SettingsPage/AgentExtensionsOAuth.test.tsx`. Before each of those two `focus` events, the test now runs `await act(async () => {})`, which makes React finish pending effects. What the test checks is unchanged, and the app code is untouched.

That file passes all 9 tests. The whole Settings page folder passed 297 of 297 tests in each of 3 runs, and lint with zero warnings is clean on the file.

**Finalize unsigned validation checksums.** That failure is on the older commit `a0aa067`. It only reports that the unsigned packaging job failed, which was the darwin-x64 check, and the latest commit `3f1a4fd` already fixed that. I made no change for it.

PR: #3635
Comment by: @propr-dev[bot] (ID: 6938161878)
Comment by: @propr-dev[bot] (ID: 6937760542)
Model: Claude Opus 5.5
@propr-dev

propr-dev Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

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

Overall Evaluation

Ready to merge based on the supplied diff and context. The PR addresses API error consistency, input validation, compatibility routing, and unknown-task responses with focused helpers and integration coverage. Current-head checks report 35 passed, none failed or pending.

✅ Safe error responses — The boundary returns fixed JSON messages, removes stale response headers on errors, and keeps internal error details server-side.

✅ Correct route ordering — The templates alias precedes /:id, with tests checking both ordering and equivalent responses.

✅ Preserved response contracts — The changes retain existing MCP authentication challenges and distinguish unknown tasks from tasks represented in persisted, live, or queued state.

This was a static review of the supplied code; no commands or tests were run.

Merge blockers

No merge blockers.

Suggestions

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

S1: 🟢 Isolate task existence fixtures

In packages/api/test/apiTaskNotFound.test.ts, the “history-only” fixture inserts both a task row and history. Add a task-row-only case and, where database constraints permit, an isolated history case. This would independently exercise the helper’s persistence branches; it is optional because the current implementation explicitly checks both sources.

S2: 🟢 Cover CLI polling grace

Add focused coverage for the new grace period in packages/cli/src/commands/implementCommands.ts: an initial 404 followed by success, repeated 404s beyond the deadline, and immediate propagation of other errors. The implementation follows the supplied typed-error contract, so this is additional regression protection rather than a merge requirement.

Score

The implementation satisfies the reviewed scope without a verified regression, and all current-head checks are successful. Coverage is substantial, with a few optional boundary cases worth adding.

Score: 9/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 31s
  • Tokens: 62,925 (62,337 in / 588 out)
  • Cost: $0.53

View Task


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

Copy and edit to choose records from this review:

/fix S1 S2

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Nov 17, 2026
@propr-dev propr-dev Bot changed the title 🔨 [3617 by Claude Opus 5.5] API: JSON errors for malformed bodies and unknown routes, bounded /api/activity paging, basic security headers ✅⑨ [3617 by Claude Opus 5.5] API: JSON errors for malformed bodies and unknown routes, bounded /api/activity paging, basic security headers Nov 17, 2026
@integry
integry merged commit 0cc96e1 into 3616-epic-0-9-d8b Nov 17, 2026
50 checks passed
@propr-dev propr-dev Bot changed the title ✅⑨ [3617 by Claude Opus 5.5] API: JSON errors for malformed bodies and unknown routes, bounded /api/activity paging, basic security headers [3617 by Claude Opus 5.5] API: JSON errors for malformed bodies and unknown routes, bounded /api/activity paging, basic security headers Nov 17, 2026
propr-dev Bot pushed a commit that referenced this pull request Nov 17, 2026
…n item 5. I left out one part of item 5: the `AI`/`llm-*` labels being applied twice when a PR is created. That should be named in the PR description. The new test file `test/botCommentText.test.ts` passes (16 tests, using the quoted examples as inputs), and so do the existing suites that touch these comments. Lint and typecheck are clean. No file under `src/jobs` gains locking, Redis keys or queue logic.

1. Failed or invalid review comments (`reviewCommentFormatter.ts`, new `reviewCompletionComment.ts`)
- Invalid output: "⚠️ Review output was invalid." now gives one of three reasons:
  - the review output could not be parsed.
  - the reviewer returned no text.
  - the review cited files the PR doesn't change.
- Invalid output, continued: these comments drop the "Next step: /fix" block and carry the `error="true"` marker.
- Provider failure: "❌ Review failed." is always followed by a sentence. An empty error gives "The provider call failed without an error message."
- Parent comment: "Posted N reviews" no longer counts error reviews, and failed links are marked "(failed)". It now also says "Posted 0 reviews" instead of "Posted 0 review". The hidden marker that tracks whether a run failed still follows the provider result, so nothing about scheduling changes.

2. Failure comments
- PR follow-up failures now open with a plain cause, such as "Provider authentication failed." or "The agent process stopped unexpectedly.", and link to the task.
- Comment IDs: "Comment ID: 0" is gone. Real comment IDs keep their `✓` receipts, because polling reads them.
- Removed text: "Please check the logs for more details." is gone.
- Issue failure comments get the same cause line.
- Upstream HTML page titles become the status code, e.g. "403 Attention Required! | Cloudflare" → "HTTP 403". GitHub HTML error pages are reported by status only.
- Completion reports no longer show the `<synthetic>` model line, or the token and cost lines when no tokens were used.

3. PR bodies (`logFiles.ts`): the "Detailed Logs" block and the "Latest Conversation Messages" block are replaced by one "View task" link. Log files are still written on the worker. Existing PR bodies are not touched.

4. CI-failure comment: "Commit:" now links to the commit, and a separate "Run:" line links to the job run.

5. Labels and ids
- Task ids: the `-undefined-` came from comments with no `updated_at`. The revision id now uses the body digest alone in that case.
- `AI` with `AI-done`: the current code already removes `AI` when it adds `AI-done`; a test pins this. The closed issues I checked that kept both (#3512, #3529) were labelled on Nov 13 and show a different label order from this code. My guess is that the running instance was on an older build.
- Left out — double labels at PR creation: on #3632 and #3635 the bot applied `AI` and `llm-*` twice, about a second apart. The only label call has a retry delay of at least 2 seconds and isn't reached by the fallback path, so the second call probably comes from a duplicate run. Fixing that is not a text change.

To fit the 400-line lint limit I removed a duplicate `sanitizeErrorMessage` from `errorHandlers.ts` (it now imports the shared one) and moved link-building into small helpers.

I updated a few existing tests: some used placeholder review text that is now invalid output, and one checked for the conversation preview that was removed. No previews were made, since this only changes comment text.
integry pushed a commit that referenced this pull request Nov 17, 2026
…, drop internal paths and debug blocks (text only) (#3676)

1. Failed or invalid review comments (`reviewCommentFormatter.ts`, new `reviewCompletionComment.ts`)
- Invalid output: "⚠️ Review output was invalid." now gives one of three reasons:
  - the review output could not be parsed.
  - the reviewer returned no text.
  - the review cited files the PR doesn't change.
- Invalid output, continued: these comments drop the "Next step: /fix" block and carry the `error="true"` marker.
- Provider failure: "❌ Review failed." is always followed by a sentence. An empty error gives "The provider call failed without an error message."
- Parent comment: "Posted N reviews" no longer counts error reviews, and failed links are marked "(failed)". It now also says "Posted 0 reviews" instead of "Posted 0 review". The hidden marker that tracks whether a run failed still follows the provider result, so nothing about scheduling changes.

2. Failure comments
- PR follow-up failures now open with a plain cause, such as "Provider authentication failed." or "The agent process stopped unexpectedly.", and link to the task.
- Comment IDs: "Comment ID: 0" is gone. Real comment IDs keep their `✓` receipts, because polling reads them.
- Removed text: "Please check the logs for more details." is gone.
- Issue failure comments get the same cause line.
- Upstream HTML page titles become the status code, e.g. "403 Attention Required! | Cloudflare" → "HTTP 403". GitHub HTML error pages are reported by status only.
- Completion reports no longer show the `<synthetic>` model line, or the token and cost lines when no tokens were used.

3. PR bodies (`logFiles.ts`): the "Detailed Logs" block and the "Latest Conversation Messages" block are replaced by one "View task" link. Log files are still written on the worker. Existing PR bodies are not touched.

4. CI-failure comment: "Commit:" now links to the commit, and a separate "Run:" line links to the job run.

5. Labels and ids
- Task ids: the `-undefined-` came from comments with no `updated_at`. The revision id now uses the body digest alone in that case.
- `AI` with `AI-done`: the current code already removes `AI` when it adds `AI-done`; a test pins this. The closed issues I checked that kept both (#3512, #3529) were labelled on Nov 13 and show a different label order from this code. My guess is that the running instance was on an older build.
- Left out — double labels at PR creation: on #3632 and #3635 the bot applied `AI` and `llm-*` twice, about a second apart. The only label call has a retry delay of at least 2 seconds and isn't reached by the fallback path, so the second call probably comes from a duplicate run. Fixing that is not a text change.

To fit the 400-line lint limit I removed a duplicate `sanitizeErrorMessage` from `errorHandlers.ts` (it now imports the shared one) and moved link-building into small helpers.

I updated a few existing tests: some used placeholder review text that is now invalid output, and one checked for the conversation preview that was removed. No previews were made, since this only changes comment text.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant