Skip to content

app: read the engine's startup budget and hide drafter-only checkpoints (#4407) - #4939

Draft
devopsfortunato wants to merge 1 commit into
ashhart:mainfrom
devopsfortunato:task/Tensorfold-Contribut+t-mws6ufvg-o9814e
Draft

devopsfortunato wants to merge 1 commit into
ashhart:mainfrom
devopsfortunato:task/Tensorfold-Contribut+t-mws6ufvg-o9814e

Conversation

@devopsfortunato

@devopsfortunato devopsfortunato commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4407.

Two app-side fixes, the two the issue thread settles on:

  • Downloaded models stay in the list. Since engine 1.3.0 on macOS, tensorfold-native info prints startup budget: instead of memory floor: (zig/src/cli/info.zig), so parseInfoOutput threw and EngineService.installed() dropped a model that was downloaded through the app. The parser now accepts either line: a printed memory floor keeps the weights-plus-margin math, a printed startup budget is used as printed (it already covers the runtime reserve), and startup budget: not priced (...) still resolves through the memory floor when the engine prints one, or fails the parse as before.
  • Drafter-only checkpoints stay out of the model list. Since engine 1.2.10, tensorfold-native models lists checkpoints whose config.json carries dflash_config; they are companions, not chat models. EngineService.installed() now skips them for every source it draws rows from (the engine models list, the selected-revisions map and the library scan), reading the cached config with the same containment rules as the library scanner (real paths canonicalised and kept inside the hub cache, O_NOFOLLOW, bounded reads, a snapshot config.json may only link inside its own blobs/) and failing open: an unreadable config keeps the row exactly as before. Paths are canonicalised before the containment check, so a hub behind a symlinked prefix (macOS /var → /private/var, or an HF_HOME that is itself a link) still resolves.

Tests (app/electron/agent/engine/): cli.test.ts pins both real 1.3.0 startup-budget shapes, the old memory floor, the unpriced failure and the unpriced-plus-floor fallback. service.test.ts seeds a downloaded model whose info prints a startup budget next to a drafter checkpoint (config.json symlinked into blobs/), asserts one row with no drafter, and repeats that through the selected-revisions map, a pruned refs/main (newest-snapshot rule), a hub reached through a symlinked prefix, and an escaping config symlink that must not be followed.

Local checks (Linux, node 22.21.1 / npm 10.9.8): npm run typecheck clean, git diff --check clean, cli.test.ts and service.test.ts pass (the service test also passes with TMPDIR pointed at a symlinked directory, which reproduces the macOS /var condition this branch's first CI run caught). The full npm test run here reached 900/902, the two failures being load-sensitive tests on this 4-core box (electron/agent/sandbox.test.ts SIGKILL timing, scripts/settings-main-transaction.test.mjs spawnSync timeout) that both pass when re-run alone; CI runs the same suite on macOS.

Opening as a draft so @popsy-blue can try it, as asked in the thread.

@devopsfortunato
devopsfortunato force-pushed the task/Tensorfold-Contribut+t-mws6ufvg-o9814e branch from d95263c to cf32544 Compare November 24, 2026 19:42
…shhart#4407)

From engine 1.3.0 on macOS, `tensorfold-native info` prints a `startup
budget:` line instead of `memory floor:`, so a model downloaded through
the app was dropped from the installed list when its info no longer
parsed. Accept either line: a printed memory floor keeps the weights
plus margin math, a printed budget is taken as printed.

Since 1.2.10 `tensorfold-native models` also lists drafter-only
checkpoints (config.json carries dflash_config). Those are companions,
not chat models: leave them out of the installed list in all three
sources it draws from, reading the cached config with the same cache
containment rules the library scanner uses and failing open.

Tests pin both real startup-budget shapes, the old memory floor, the
unpriced fallback, and a seeded drafter (including a config.json
symlinked into blobs/) across the engine list, the revisions map and
the library scan.
@devopsfortunato
devopsfortunato force-pushed the task/Tensorfold-Contribut+t-mws6ufvg-o9814e branch from cf32544 to 8ce13d8 Compare November 24, 2026 20:25
@devopsfortunato

Copy link
Copy Markdown
Contributor Author

Pushed a fix for the one CI failure the first run found: on macOS the test hub lives under /var/folders/..., whose realpath is /private/var/..., and the drafter lookup compared realpath against the raw path — so the newest-snapshot fallback returned null. The lookup now canonicalises each step and then checks containment, with a symlinked-prefix regression case (reproduced locally with a symlinked TMPDIR).

@devopsfortunato

Copy link
Copy Markdown
Contributor Author

Heads-up: the workflows for the re-pushed head are waiting on "Approve and run" (first-time contributor on this repo). Once approved, the macOS desktop job runs the full app suite on the final commit. Local evidence on that commit: typecheck clean, cli.test.ts and service.test.ts pass (the service test also with a symlinked TMPDIR, which is the macOS /var case the first CI run caught).

@AIFlowML

Copy link
Copy Markdown
Contributor

I checked the landing order against main ed70f71aa7e561974dc4ec005e17fe64cba3d98a. The current heads of #4939 (8ce13d8209a19c6ef0b100e932960507420bbbad) and #4545 (e59fa616fd6ec76c6d1e827bac733328aee55bc2) each test-merge cleanly on their own. Applying both in either order with git merge-tree --write-tree produces one content conflict, in app/electron/agent/engine/cli.ts at parseInfoOutput.

The two parsers cover different output forms. Current zig/src/cli/info.zig emits startup budget: X GiB at --context … for the general path and startup budget: X GiB (…) for Flash Next. For whichever PR lands second, the first useful integration check is one fixture for each numeric form, with not priced still refused and the legacy memory floor case still passing. This check was limited to merge and source inspection.

Igor Lessio - AIFLOW LABS

@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thank you, @devopsfortunato. Both startup-budget forms parse correctly, the legacy fallback is kept, and the tests cover the normal model/drafter list. The current head merges cleanly.

Two lookup cases need fixing before landing:

  • At app/electron/agent/engine/service.ts:630, a missing whole refs directory stops the snapshot fallback, leaving a readable drafter listed. Please let that case reach the validated snapshot scan.
  • At app/electron/agent/engine/service.ts:679, resolving the blobs directory can accept a link outside the repo cache. Please retain the scanner's own-repo blob-root check so this fails open without reading the target.

Please add both cases to the service fixture while keeping the symlinked-prefix checks.

  • Synthena

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Downloaded Models reported in the App change depending on the engine loaded

3 participants