Repository navigation
fix(task): propagate resume and history storage failures - #307
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
585d32c to
1192f48
Compare
| // it is combined explicitly. Neither failure is recoverable here. | ||
| Effect.catchCause((cause) => | ||
| Effect.logError("Child write evidence history unavailable", { sessionID: nextSession.id, cause }), | ||
| Effect.failCause(Exit.isFailure(exit) ? Cause.combine(exit.cause, cause) : cause), |
There was a problem hiding this comment.
CRITICAL: Cause.combine duplicates main cause in finalizer
Effect.onExit finalizers in Effect v4 automatically combine their failure cause with the main effect's cause when the main effect also failed. Explicitly calling Cause.combine(exit.cause, cause) here causes the main cause to appear twice in the final combined cause (once from the main effect, once from the finalizer's explicit combine, and the runtime combines them again).
The fix is to simply fail with the recovery cause and let the runtime combine automatically:
| Effect.failCause(Exit.isFailure(exit) ? Cause.combine(exit.cause, cause) : cause), | |
| Effect.failCause(cause), |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| const history = yield* sessions.messages({ sessionID: nextSession.id }) | ||
| yield* projectWrites(history.flatMap((message) => message.parts)) | ||
| }).pipe( | ||
| // Effect v4 finalizer failures replace the original cause unless |
There was a problem hiding this comment.
SUGGESTION: Comment is misleading about explicit combine being needed
The comment states "Effect v4 finalizer failures replace the original cause unless it is combined explicitly." This is incorrect — Effect v4 automatically combines finalizer failures with the original cause. The explicit Cause.combine at line 608 is what causes the duplication.
Consider updating the comment to reflect actual behavior:
| // Effect v4 finalizer failures replace the original cause unless | |
| // Effect v4 automatically combines finalizer failures with the original cause. | |
| // Fail with the recovery cause only; the runtime will combine if the main effect failed. |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| ? yield* sessions.get(SessionID.make(params.task_id)).pipe(Effect.catchCause(() => Effect.succeed(undefined))) | ||
| ? yield* sessions | ||
| .get(SessionID.make(params.task_id)) | ||
| .pipe(Effect.catchIf(NotFoundError.isInstance, () => Effect.succeed(undefined))) |
There was a problem hiding this comment.
SUGGESTION: Add comment explaining catchIf vs catchCause behavior
The change from catchCause to catchIf(NotFoundError.isInstance) intentionally narrows error handling: only typed NotFoundError failures are caught; defects (Die), interrupts, and other failure types propagate. This is correct per the PR intent, but a brief comment would clarify why catchIf is used and that defects/interrupts are not swallowed.
| .pipe(Effect.catchIf(NotFoundError.isInstance, () => Effect.succeed(undefined))) | |
| .pipe(Effect.catchIf(NotFoundError.isInstance, () => Effect.succeed(undefined))) |
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge (pending green run of Scope. Review base Re-evaluation of the 3 prior findings (same changed lines)
No new inline comments posted. Files Reviewed (2 files)
Previous Review Summaries (2 snapshots, latest commit 6204585)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 6204585)Status: No Issues Found | Recommendation: Merge Files Reviewed (2 files)
Previous review (commit 1192f48)Status: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
SUGGESTION
Files Reviewed (2 files)
Reviewed by free · Input: 164.1K · Output: 25.5K · Cached: 354.6K |
|
Independent adjudication of the reported
A native fault probe on this checkout gives:
The two actual task history-recovery fault regressions also pass independently (15 assertions), including exact cause length 2 and listener unsubscribe. Removing the explicit combine would lose the original execution defect. No source change was made for this finding. Fresh current merge-tree CI and review remain required after integration advances. |
1192f48 to
6204585
Compare
6204585 to
4c07771
Compare
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Issue for this PR
Closes #284 and #285.
Type of change
What does this PR do?
Closes #284 and #285.
Only typed NotFound recovers a missing resumed task. Storage defects propagate instead of creating a replacement child. History recovery failure also propagates; when execution and recovery both fail, preserve both causes. Listener unsubscribe remains in its finalizer.
Worker implementation independently checked on Bun 1.3.14: five new native storage-failure regressions pass, 35 assertions. The worker's broader task suite had one existing background-completion timeout; that claim is not a substitute for current CI. Full typecheck is not claimed locally.
BackgroundJob's displayed error may show only the first of combined causes. The actual cause is preserved here; no claim that presentation is fixed. Full current merge-tree CI and Kilo or Arena review are required before integration.
How did you verify your code works?
Independent native focused regressions passed: 5 tests, 35 assertions. Actual current remote merge-commit Linux and Windows test jobs and all 17 typecheck tasks passed. Pinned Effect storage-failure probe also verifies compound causes.
Screenshots / recordings
Not a UI change.
Checklist