Repository navigation
feat(model): inspect GGUF and safetensors declarations - #5603
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49b016d1b8
ℹ️ 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".
[Medium impact] The PR appears safe to merge; no new blocking issue was found. SummaryAdds local GGUF and safetensors declaration inspection through CLI and MCP.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[CLI or MCP] --> B[ModelArtifactService]
B --> C[ModelArtifactProvider]
C --> D[GGUF or safetensors header reader]
D --> E[Complete Evidence]
E --> F[Complete delivery or export]
E --> G[Retained summary or selected page]
G --> H[Historical queries without reopening source]
Reviews (3) · Last reviewed commit: "chore: qualify model inspection with cur..." · Reviewed by Greptile |
|
@codex review All five initial findings are addressed in a15c1af / 8556837; b8ae48f refreshes main and matches the pinned prospective merge tree. Please re-review the format boundary and retained-view identity/message fixes. Current validation and its scope are in the PR body; final integrated checks are running. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8ae48f89f
ℹ️ 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".
|
@codex review 097771f addresses the empty-GGUF finding at the reader boundary (zero extents and rank-zero scalars; original rank/block constraints retained), and closes the related compact-headline leak. 62b640a refreshes main and matches the pinned prospective merge tree. Reader54 and public model5 tests pass; final integrated gates and renewed real-model measurements are running. Please review the final diff for remaining actionable issues. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
…ansition-view Resolve the inspect_analysis_view description conflict with main's model artifact view (morluto#5603). The description keeps main's text, including inspect_model_artifact, and adds this branch's capture_browser_scenario additions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #3323.
Problem and outcome
Bundled model files previously reached an unsupported-binary result.
inspect_model_artifact/inspect-model-artifactnow exposes GGUF v2/v3 (both byte orders) and safetensors declarations through one local workflow: typed metadata, tensor identity/shape/type/ranges, and explicitly derived element/storage totals.Default
hash: "header"reads only the header/directory. It returns a scoped header digest, exact path/extent and bytes read; full-file SHA-256 and the Evidence subject remain null. Explicithash: "full"streams every file byte for full SHA-256 without interpreting weights. Metadata arrays retain typed counts and eight-element previews with omissions recorded; scalar values, integer widths and negative zero survive JSON delivery.Optional
viewreturns selected rows plus model context in the initial call. Retainedmodel-artifactviews support batched names/keys/types/indices, fields, storage-validation states and pagination. Complete Evidence remains accessible. Unknown types keep their identity; declared ranges and unknown storage-size validation stay separate. Historical pages use validated positional indexes and unique names/keys/types, cached with immutable parent facts; they never reopen the file. Only the source-scoped index is mandatory: long labels obey field selection. Bounded view warnings link to complete parent Evidence.Boundary and scope
The format readers own interpretation; application services own Evidence and delivery; CLI/MCP share both. One admitted descriptor/inspection, bounded prefix reads, a 100,000,000-byte GGUF prefix/safetensors JSON ceiling (excluding its 8-byte length field) and separate 32 MiB retained representation budget constrain work before expansion. File replacement/truncation, cancellation and failed-close ownership use existing filesystem/resource primitives. The EOF follow-up distinguishes concurrent truncation from initially malformed declarations.
This is built-in static format inspection within the supported contribution scope. Inspection reads existing local files. CLI compact delivery and explicit Evidence export create caller-selected output files through existing atomic publication. Model execution, target attachment, inference, external-file traversal and runtime network access are outside the operation; no new runtime dependency or installer behavior.
Executed validation
62b640a60, tree9a5a4d7a9, main5b676ba9f: 54 reader tests + 5 public model CLI/MCP workflows passed.check:ci8 tasks + architecture guards across 1,665 files passed, duplication 3.47%; generated docs and 5 README tests passed. No new test files; prior discovery found every test exactly once.85568378c, following 214 / 9 on the earlier main integration. After newer main, 21 generic MCP cases + 5 model workflows passed in isolation. One preceding constrained attempt hit two generic 30 s timeouts; deadlines were unchanged. New-main Apple producers passed 31 tests. Its evaluation helper suite passed 7 cases and failed one 1 s preparation deadline; the helper, test and process/filesystem/artifact dependencies are identical to main, with no model path involved. That single case then passed in isolation without changing deadlines. Failed attempts are retained; these are scoped passes, not a green full-suite claim.4f004f392; fourteen format cases, two imported/oversized-response MCP cases and two empty-GGUF cases fail at49b016d1b. Independent official GGUFReader accepts five empty/quantized-empty/scalar declarations in each byte order; the old actual CLI refused them and the corrected CLI agrees on every shape/count/byte length.gguf0.19.0 /safetensors0.8.0 readers, including ranges, shapes, types, element counts and scalar/array previews. Header/full scopes and independent whole-file SHA-256 pass. Final valid results exactly match their corresponding earlier header/full baselines. One verifier comparison initially mixed header/full limitations; the corrected corresponding-mode oracle passes, and the failed attempt is retained. No model was executed.Pinned samples: stories15M Q4_0 (19,077,344 B, header 727,132 B, SHA-256
66967fbece6d…); stories260K big-endian (1,185,376 B, header 14,152 B,276d6f9d9050…); MiniLM L3 (69,569,488 B, header 6,096 B,cf1e4e2d420c…). Reference packages and binaries stayed outside the repository.Completed-task measurements and limits
Caller supplies two tensor names. Both strategies return the same format, scoped identity, selected metadata, declared totals and tensor facts, and export complete Evidence.
62b640a60, Linux / Node 24.18.0, fresh MCP processes; all steps include SDK, catalog/AJV, parsing, projection, serialization, token instrumentation, export and teardown.Tokenx estimates count arguments and complete replies plus either used-tool input declarations or every input declaration. Wire estimates additionally count catalog output schemas, initialization and other messages. These are not actual model tokens or successful-agent/tool-selection measurements. Whole catalog cost remains visible.
Historical measurements at
4f004f392also covered both execution orders and all three samples; they are not cross-revision speed comparisons. The four-call summary-plus-generic-queries route took 7.13–7.55 s / 8.78–9.33 family CPU s / 0.89–0.93 GiB; direct selection used two calls. Complete versus direct cold timings were similar on real samples; tiny input had fixed-cost variance, so no universal speedup is claimed. Twelve historical GGUF probes per strategy gave 20.49 ms median for full tensor pages and 9.40 ms for selected pages; the first generic-query use took 1.79/1.62 s and is included in those probe sets, not presented as steady warm latency. No source was reopened for these probes.Two-CPU affinity, 3 GiB V8 heaps and an 8 GiB process-family guard; all six final paired measurements passed first attempt without OOM or guard stops. Family RSS was sampled every 20 ms and can double-count shared pages or miss brief peaks. OS caches/host load, token-instrumentation overhead and engine-only costs were not isolated. There was no prior REA model-reader implementation; these compare equivalent delivery strategies. The small sample is authored, not real-model coverage.
Limits: Linux public workflows were executed; Windows/macOS were not. Storage sizes are derived from pinned ggml layouts or checked against safetensors declarations; runtime compatibility, weight values, model quality and effective/tied parameter counts are unverified. Array previews do not expose a complete vocabulary. Read guards detect observed filesystem changes, not adversarial changes that evade filesystem metadata. Generated catalogs/skills and all models remain ignored build/verification artifacts.
Author readiness
Human owner: @gensokyo-dev
The owner explicitly authorized the work, delegated technical review/validation to Codex and directed these declarations and ready submission. This records that instruction; it does not assert an independent human review.
Before merge