feat: bring webhook mode closer to action mode

Webhook deliveries now run the same issue and PR triage as action mode on open/edit/reopen events, gated by WEBHOOK_TRIAGE_ENABLED; @bot answers embed the host-curated repository knowledge cache from R2 (never the uninitialized scaffold); exact /recheck and /conflict commands get a guidance reply pointing to action mode instead of silence. Cache restores write through a temporary file and rename so concurrent webhook work never reads a partial object. Documents that all webhook local writes stay inside the current working directory.
This commit is contained in:
lezi-fun committed 2026-08-22 11:36:46 +08:00
1 parent ec601bef93
commit a6e3fd2fc5
10 files changed
+336 -13

No files matched your search

+6 -1
View File
@@ -164,7 +164,12 @@ async function restoreObject(params: {
}
params.validate(content);
await fs.mkdir(path.dirname(params.target), { recursive: true });
await fs.writeFile(params.target, content, { mode: 0o600 });
// Write through a temporary file so a concurrent reader (the webhook
// service serves several repositories concurrently) never observes a
// partially written cache object.
const temporaryTarget = `${params.target}.tmp-${process.pid}-${Date.now()}`;
await fs.writeFile(temporaryTarget, content, { mode: 0o600 });
await fs.rename(temporaryTarget, params.target);
logger.info({ key: params.key, bytes: content.byteLength }, "Restored persistent cache object from R2.");
}