Skip to content

Commit d0b72c4

Browse files
Doccy008claude
andcommitted
fix(sweep): retry on ingest failure, bound sweepWorkflowSeen to active sessions
Address review feedback on the workflow-ingest gate: - A transient ingest failure previously stuck a session: the fingerprint was recorded before the async ingest, so on rejection the session was skipped until its artifacts changed again. Delete the fingerprint in .catch so the next sweep retries it. - sweepWorkflowSeen never evicted entries for sessions that went inactive, so it grew unbounded over the process lifetime. Prune it to the current active set at the start of each sweep. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 351dd40 commit d0b72c4

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

server/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,12 @@ if (require.main === module) {
815815
// Catches workflows that complete without a subsequent hook and flips
816816
// launch-detected "running" rows to "completed" once their journal lands.
817817
const { ingestWorkflowsForSession, workflowsMaxMtime } = require("./lib/workflow-ingest");
818+
// Forget fingerprints for sessions that are no longer active so the map
819+
// can't grow without bound over the process lifetime.
820+
const activeIds = new Set(active.map((r) => r.session_id));
821+
for (const id of sweepWorkflowSeen.keys()) {
822+
if (!activeIds.has(id)) sweepWorkflowSeen.delete(id);
823+
}
818824
for (const row of active) {
819825
if (!row.tp) continue;
820826
// Skip sessions whose workflow artifacts are unchanged since the last
@@ -839,6 +845,9 @@ if (require.main === module) {
839845
if (sess) broadcast("session_updated", sess);
840846
})
841847
.catch((err) => {
848+
// Forget the fingerprint so the next sweep retries this session
849+
// instead of skipping it until its artifacts change again.
850+
sweepWorkflowSeen.delete(row.session_id);
842851
console.warn(
843852
`[SWEEP] Workflow scan failed for session ${row.session_id}:`,
844853
err?.message || err

0 commit comments

Comments
 (0)