Guard auth_token_missing run-event persistence so it can't abort adapter launch

The missing-token warning is purely diagnostic; if appendRunEvent fails
(database or publication error) the run should still launch, losing only
the warning. Addresses Greptile review.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
scotttongandClaude Fable 5 committed 2026-08-22 05:00:18 -07:00
1 parent 2418cc6dc8
commit bb723c7845
1 file changed
+17 -8
+17 -8
View File
@@ -15954,14 +15954,23 @@ export function heartbeatService(db: Db, options: HeartbeatServiceOptions = {})
},
"local agent jwt secret missing or invalid; running without injected PAPERCLIP_API_KEY",
);
await appendRunEvent(currentRun, seq++, {
eventType: "adapter.auth_token_missing",
stream: "system",
level: "warn",
message:
"Agent JWT secret is missing; this run has no PAPERCLIP_API_KEY, so unauthenticated API writes would be attributed to the board instead of the agent.",
payload: { adapterType: agent.adapterType },
});
try {
await appendRunEvent(currentRun, seq++, {
eventType: "adapter.auth_token_missing",
stream: "system",
level: "warn",
message:
"Agent JWT secret is missing; this run has no PAPERCLIP_API_KEY, so unauthenticated API writes would be attributed to the board instead of the agent.",
payload: { adapterType: agent.adapterType },
});
} catch (err) {
// The event is purely diagnostic; a persistence failure must not
// prevent the adapter from launching.
logger.warn(
{ runId: run.id, err },
"failed to persist adapter.auth_token_missing run event",
);
}
}
let adapterFinalizeOutcome: "succeeded" | "failed" | null = null;
const inspectFinalizeWorkspaceBranch = async () => {