[GH-ISSUE #5625] [Bug] GGUF parse cancellation discards earlier validated metadata rows #3411

Closed
opened 2026-10-31 00:40:04 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @morluto on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/5625

Area

Evidence, artifacts, or reconstruction

Observed behavior

The source ModelArtifactProvider.inspect loses a fully parsed GGUF metadata row when cancellation interrupts a later value. It preserves the exact caller reason but returns AnalysisCancelledError without partialObservation.

Reproduction

Ran a source-boundary Vitest probe on dd0015aaf156c5701ef9598bcc6c885e6b8da803 (model implementation from #5603):

  1. Use ggufFixture with zero tensors, a valid general.name string (First row), then custom.bools, a boolean array of 200,000 elements.
  2. Wrap the admitted FileHandle.read; abort with an opaque object immediately after the first read at the array-data offset. Assert that the observed chunk is positive and smaller than the array.
  3. Call provider.inspect({path, hash:'header'}, {signal}).
  4. Observe the exact cancellation reason and partialObservation === undefined.

The focused probe passed independently in two source checkouts. No model was loaded or executed. Public CLI/MCP cancellation was not tested.

Expected behavior

Retain fully validated earlier rows with source spans under typed cancellation, as required by the lifecycle rule. Exclude the interrupted array. The header digest, final file identity, and header completeness remain unknown; a partial result must not use the complete-result schema to claim otherwise.

Impact and scope

Verified for a GGUF scalar followed by an interrupted array. Safetensors creates normalized rows after JSON parsing; this finding does not establish equivalent row loss there. Frequency outside this controlled fixture: NOT_ENOUGH_INFO.

REA version

Source revision dd0015aaf156c5701ef9598bcc6c885e6b8da803.

Runtime and platform

Node 24.18.0; macOS 26.3 arm64. No analysis provider involved.

Target and artifact context

Synthetic GGUF v3 declaration-only fixture; no tensor data or model execution.

Interface

Other: actual source provider boundary.

Earliest failure stage

Cleanup, cancellation, or lifecycle.

Relevant output or evidence

Independent probe: 1 test passed. Assertions: 0 < arrayBytesObserved < 200000; error tag AnalysisCancelledError; exact cause object retained; partialObservation absent.

GgufHeader.read pushes each completed row before parsing the next. A later thrown cancellation prevents the parser result from reaching the provider. The complete model contract requires a header digest and complete header coverage, so retaining partial facts requires an explicit partial representation.

Additional context

Searched open/closed GGUF issues and open GGUF PRs. #3323/#5603 introduced this reader; broader model reconstruction follow-ups are distinct. No exact duplicate found. No credentials or private target data included.

Originally created by @morluto on GitHub (Oct 20, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/5625 ### Area Evidence, artifacts, or reconstruction ### Observed behavior The source `ModelArtifactProvider.inspect` loses a fully parsed GGUF metadata row when cancellation interrupts a later value. It preserves the exact caller reason but returns `AnalysisCancelledError` without `partialObservation`. ### Reproduction Ran a source-boundary Vitest probe on `dd0015aaf156c5701ef9598bcc6c885e6b8da803` (model implementation from #5603): 1. Use `ggufFixture` with zero tensors, a valid `general.name` string (`First row`), then `custom.bools`, a boolean array of 200,000 elements. 2. Wrap the admitted `FileHandle.read`; abort with an opaque object immediately after the first read at the array-data offset. Assert that the observed chunk is positive and smaller than the array. 3. Call `provider.inspect({path, hash:'header'}, {signal})`. 4. Observe the exact cancellation reason and `partialObservation === undefined`. The focused probe passed independently in two source checkouts. No model was loaded or executed. Public CLI/MCP cancellation was not tested. ### Expected behavior Retain fully validated earlier rows with source spans under typed cancellation, as required by [the lifecycle rule](https://github.com/morluto/rea/blob/dd0015aaf156c5701ef9598bcc6c885e6b8da803/docs/tool-design.md#own-the-lifecycle). Exclude the interrupted array. The header digest, final file identity, and header completeness remain unknown; a partial result must not use the complete-result schema to claim otherwise. ### Impact and scope Verified for a GGUF scalar followed by an interrupted array. Safetensors creates normalized rows after JSON parsing; this finding does not establish equivalent row loss there. Frequency outside this controlled fixture: NOT_ENOUGH_INFO. ### REA version Source revision `dd0015aaf156c5701ef9598bcc6c885e6b8da803`. ### Runtime and platform Node 24.18.0; macOS 26.3 arm64. No analysis provider involved. ### Target and artifact context Synthetic GGUF v3 declaration-only fixture; no tensor data or model execution. ### Interface Other: actual source provider boundary. ### Earliest failure stage Cleanup, cancellation, or lifecycle. ### Relevant output or evidence Independent probe: 1 test passed. Assertions: `0 < arrayBytesObserved < 200000`; error tag `AnalysisCancelledError`; exact cause object retained; `partialObservation` absent. [GgufHeader.read](https://github.com/morluto/rea/blob/dd0015aaf156c5701ef9598bcc6c885e6b8da803/src/model/GgufHeader.ts#L244) pushes each completed row before parsing the next. A later thrown cancellation prevents the parser result from reaching the provider. The [complete model contract](https://github.com/morluto/rea/blob/dd0015aaf156c5701ef9598bcc6c885e6b8da803/src/domain/model/modelArtifact.ts) requires a header digest and complete header coverage, so retaining partial facts requires an explicit partial representation. ### Additional context Searched open/closed GGUF issues and open GGUF PRs. #3323/#5603 introduced this reader; broader model reconstruction follow-ups are distinct. No exact duplicate found. No credentials or private target data included.
bsakaguchi 2026-10-31 00:40:04 +00:00
  • closed this issue
  • added the
    bug
    triage
    labels
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#3411
No description provided.