A Postgres restart or pg_terminate_backend (error 57P01) takes the render worker's pooled client mid-$queryRaw in DevelopService.claimRenders (apps/api/src/develop/service.ts:144). Prisma surfaces it as P2010 wrapping the server message, and the catch in RenderWorker.start logged it at warn as develop: poll failed — which fed the error loop on every tick during a DB restart.
The next tick re-claims a fresh client, so this is a transient blip. Mirror the BIT-32448 autopilot fix: detect 57P01 and log at info (develop: poll skipped, db connection was reset), keeping the warn path for real poll failures.
Extract isPostgresAdminShutdown into apps/api/src/lib/pg.ts so develop and autopilot share one definition; autopilot/service.ts re-exports it to keep its existing test imports working.
Tests
New apps/api/src/develop/service.test.ts mirrors the autopilot tests:
isPostgresAdminShutdown matches the 57P01 raw-query message and rejects unrelated errors
RenderWorker logs a 57P01 shutdown at info (not warn) and keeps looping
RenderWorker still warns on a real poll failure
pnpm -r build and pnpm -r typecheck green. Unit tests run locally with a no-DB vitest config (the API global-setup needs a *_test database, which CI provides via the pgvector service).
## What
A Postgres restart or `pg_terminate_backend` (error 57P01) takes the render worker's pooled client mid-`$queryRaw` in `DevelopService.claimRenders` (`apps/api/src/develop/service.ts:144`). Prisma surfaces it as `P2010` wrapping the server message, and the catch in `RenderWorker.start` logged it at `warn` as `develop: poll failed` — which fed the error loop on every tick during a DB restart.
The next tick re-claims a fresh client, so this is a transient blip. Mirror the BIT-32448 autopilot fix: detect 57P01 and log at `info` (`develop: poll skipped, db connection was reset`), keeping the `warn` path for real poll failures.
Extract `isPostgresAdminShutdown` into `apps/api/src/lib/pg.ts` so `develop` and `autopilot` share one definition; `autopilot/service.ts` re-exports it to keep its existing test imports working.
## Tests
New `apps/api/src/develop/service.test.ts` mirrors the autopilot tests:
- `isPostgresAdminShutdown` matches the 57P01 raw-query message and rejects unrelated errors
- `RenderWorker` logs a 57P01 shutdown at `info` (not `warn`) and keeps looping
- `RenderWorker` still warns on a real poll failure
`pnpm -r build` and `pnpm -r typecheck` green. Unit tests run locally with a no-DB vitest config (the API global-setup needs a `*_test` database, which CI provides via the pgvector service).
Paperclip-Issue: BIT-32449
Paperclip-Cluster: 8d12f6208533
A Postgres restart or `pg_terminate_backend` (error 57P01) takes the render worker's pooled client mid-`$queryRaw` in `DevelopService.claimRenders`. Prisma surfaces it as P2010 wrapping the server message, and the catch in `RenderWorker.start` logged it at warn as "develop: poll failed" — which fed the error loop on every tick during a DB restart. The next tick re-claims a fresh client, so this is a transient blip: detect 57P01 and log at info instead, keeping the warn path for real poll failures. Extract `isPostgresAdminShutdown` into `lib/pg.ts` so develop and autopilot share one definition.
Paperclip-Issue: BIT-32449
Paperclip-Cluster: 8d12f6208533
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
A Postgres restart or
pg_terminate_backend(error 57P01) takes the render worker's pooled client mid-$queryRawinDevelopService.claimRenders(apps/api/src/develop/service.ts:144). Prisma surfaces it asP2010wrapping the server message, and the catch inRenderWorker.startlogged it atwarnasdevelop: poll failed— which fed the error loop on every tick during a DB restart.The next tick re-claims a fresh client, so this is a transient blip. Mirror the BIT-32448 autopilot fix: detect 57P01 and log at
info(develop: poll skipped, db connection was reset), keeping thewarnpath for real poll failures.Extract
isPostgresAdminShutdownintoapps/api/src/lib/pg.tssodevelopandautopilotshare one definition;autopilot/service.tsre-exports it to keep its existing test imports working.Tests
New
apps/api/src/develop/service.test.tsmirrors the autopilot tests:isPostgresAdminShutdownmatches the 57P01 raw-query message and rejects unrelated errorsRenderWorkerlogs a 57P01 shutdown atinfo(notwarn) and keeps loopingRenderWorkerstill warns on a real poll failurepnpm -r buildandpnpm -r typecheckgreen. Unit tests run locally with a no-DB vitest config (the API global-setup needs a*_testdatabase, which CI provides via the pgvector service).Paperclip-Issue: BIT-32449
Paperclip-Cluster: 8d12f6208533