Skip to content

Commit 88bc8a3

Browse files
grypezclaude
andcommitted
fix(kernel-utils): pass error snapshots to lift generator in driveLift
gen.next(errors) was passing the same live mutable array reference on every resume. A lift that stores the received value from one yield and inspects it after a later yield would see mutations from subsequent failures. Pass [...errors] snapshots so each yield receives an independent copy. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7f0d41a commit 88bc8a3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/kernel-utils/src/sheaf/sheafify.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,15 @@ const driveLift = async <M extends Record<string, unknown>>(
145145
): Promise<unknown> => {
146146
const errors: unknown[] = [];
147147
const gen = lift(germs, context);
148-
let next = await gen.next(errors);
148+
let next = await gen.next([...errors]);
149149
while (!next.done) {
150150
try {
151151
const result = await invoke(next.value);
152152
await gen.return(undefined);
153153
return result;
154154
} catch (error) {
155155
errors.push(error);
156-
next = await gen.next(errors);
156+
next = await gen.next([...errors]);
157157
}
158158
}
159159
throw new Error(`No viable section for ${context.method}`, {

0 commit comments

Comments
 (0)