Non-uuid x-paperclip-run-id header values cause 500s on checkout/comments (uuid-typed DB paths)
Symptom
2026.817.0: POST /api/issues/:id/checkout and POST /api/issues/:id/comments return 500 PostgresError: invalid input syntax for type uuid whenever the caller's x-paperclip-run-id header is not a uuid (e.g. cron job labels like hourly-report-20260907-1405 or numeric adapter lane ids).
Root cause
Middleware takes the raw x-paperclip-run-id header into actor.runId, which flows into uuid-typed DB columns (issues.checkout_run_id, heartbeat run lookups). Other header paths already guard with an isUuidLike check; this one attaches the value raw.
Suggested fix
Normalize non-uuid run ids at the header boundary (null them out for uuid-typed paths, or store as a separate string column for display/attribution).
Workaround
We dist-patch the middleware to normalize the header value before it reaches DB paths.
Source: paperclipai/paperclip