test(canonical2): H10 reconcile-failure observability trap + behavior-gap todo#508
Conversation
…-gap todo Pin the three observability surfaces (ctx.log.warn, emitAgentEvent, onAgentEvent) that fire when reconcileSessionStoreCompactionCountAfterSuccess rejects, and pin the behavior contract that handleCompactionEnd emits completed=true regardless of reconcile outcome. Add it.todo documenting the fire-and-forget gap (audit gap #1 from wave-D bbcf2f3). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
262d992 to
a015af0
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a015af0305
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| sessionKey: ctx.params.sessionKey, | ||
| data, | ||
| }); | ||
| void Promise.resolve(ctx.params.onAgentEvent?.({ stream: "compaction", data })).catch( |
There was a problem hiding this comment.
Guard reconcile-warning callback against sync throw
When reconcileSessionStoreCompactionCountAfterSuccess fails, this path now calls onAgentEvent via Promise.resolve(ctx.params.onAgentEvent?.(...)). Because the callback invocation is evaluated before Promise.resolve, a synchronous throw in onAgentEvent escapes this handler, turning the reconcile-failure path into an unhandled rejection instead of a logged warning. This can happen with custom onAgentEvent implementations that throw before returning a promise. Wrap the invocation in a deferred callback (for example, Promise.resolve().then(() => onAgentEvent?.(...))) so both sync throws and async rejections are contained.
Useful? React with 👍 / 👎.
|
🌻 — base retargeted from Will merge with the rebase wave when it lands on canonical2. |
Summary
ctx.log.warnwith[compaction-counter:reconcile-failed],emitAgentEventwithstream:"compaction"+ warning data shape,onAgentEventcallback with same shape) fire whenreconcileSessionStoreCompactionCountAfterSuccessrejects.handleCompactionEndemitscompleted=truein thephase:"end"event even when the reconcile rejects — makes a future fix visible as a test change.it.todo: documents the fire-and-forget gap wherehandleCompactionEndswallows reconcile failures in.catchand returns success regardless.Audit-gap-#1 followup from the cohort cleanup waves. Wave-D observability landed at bbcf2f3 (
fix: surface compaction count reconcile failures).Test plan
pnpm vitest run src/agents/pi-embedded-subscribe.handlers.compaction.test.ts— 7 passed, 1 todopnpm tsgo:core— clean