Skip to content

app: control vector picker and strength in Engine advanced - #1951

Open
BlivionIaG wants to merge 41 commits into
ashhart:mainfrom
BlivionIaG:feature/glp-steering-app
Open

BlivionIaG wants to merge 41 commits into
ashhart:mainfrom
BlivionIaG:feature/glp-steering-app

Conversation

@BlivionIaG

@BlivionIaG BlivionIaG commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

App controls for the generic add-only steering feature. Desktop-maintainer review and #1835 landing are still prerequisites.

Checks on this head

  • Head commit: c176811e94ab205a695393c42cdb54cc24afb947.
  • Lean checker: no Zig file is touched (42 files under app/ and CHANGELOG.md), so the Zig findings are main's.
  • Tests run, in app/ on this head (Node 22.23.2, npm 10.9.8): npm ci --ignore-scripts, npm --prefix mobile ci --ignore-scripts, npm test (904/904 test files pass), npm run typecheck (0 errors) and git diff --check all pass. New regression: a picker selection overlapping a pending alpha change and a pending enabled change keeps both (red before the fix: alpha 2 !== 5, then enabled true !== false).
  • CI on this head: queued behind the repository's runner backlog when this was written; the previous head's checks passed apart from the inherited desktop typecheck.
  • Not run: a packaged Electron build against a model, and the engine's own gates, which Implement GLP control vectors with a fused Metal kernel for Qwen3.8-27B #1835 owns. Desktop-maintainer review is open.

Receipt

Remaining maintainer requests

Desktop-maintainer review; cannot land before #1835.

Checklist

  • Title/description, head and stack agree; older results remain source-bound.
  • Every new/restored test has a failing-before runtime receipt across all reached platforms. Host evidence is above; missing device gates are not waived.
  • No newly added overlong/multiline source comments, measurements or review history; inherited findings are reported above.
  • Complete publication trees/outgoing histories reviewed for public noreply identity, tool trailers and privacy; synthetic detector fixtures and mandatory third-party public contacts are not live secrets. No package/binary upload proposed.
Historical source-bound notes — not current-head qualification

Earlier commands/measurements retain their original commit/binary scope. Any earlier readiness or provenance claim is superseded by the open gates above.

Add-only operator control vectors

Published head 46eb6b8c858b2f57653413dd35057475a035eb9a on main 6c5cef8941b27d86b06a986834e13deb9b515e1e; follows backend #1835 at ccac1b8337276e3e69118dcae97d1eeafe07d477 (separate PRs, not a claim of ancestry).

Settings → Engine advanced offers an operator-selected vector file and strength, off by default and gated by the engine's advertised --glp support. Copy describes non-refusal style/topic steering, additive vectors only, named project/malformed refusals and the engine's exact-file SHA startup disclosure. No directional-ablation selector, refusal-removal assets or receipt/download links remain. The preview fixture is neutral style-vector.gguf; strength is described as scaling the added direction, not as an unverified derivation multiplier. All12 locale packs and the source phrases are updated.

The contribution check exposed inherited large files touched by integration. Engine service responsibilities and engine/composer IPC groups are now composed into bounded modules: service585lines, preload600; channels, signatures, unsubscribe ownership, shutdown order and cache-cleanup admission are retained. The installed-view admission regression failed during extraction; the original service seam was restored and the unchanged consumer scenario now passes.

Exercised qualification

Execution scope: production bundle, six consumer suites and real native1.2.5 compatibility smoke were executed at initial 0e196a7b32eef3b573f5b8f4b607217869dbc924. The current 46eb6b8c858b2f57653413dd35057475a035eb9a is tests-only: retained input-validation suite, typecheck and contribution preflight pass. Those earlier runtime executions are not relabelled as new runs. The web preview was exercised earlier in this pass, not rerun after the tests-only correction.

  • Node22.23.2/npm10.9.8; typecheck, private-leak scan and856-file runner coverage gates pass. Actual production renderer/main/preload/standalone-agent bundles build successfully; existing Vite chunk/import warnings were retained. Language index regeneration passed (12packs).
  • Existing service, control-vector, immutable-download queue, cache-admission, local-library and benchmark-integration consumer suites pass. No model/device result is inferred from synthetic native-process fixtures.
  • Actual final app service ran against the real previously built native1.2.5 CLI: version/capabilities/models/snapshot queries, unsupported steering refusal, defaultoff, state remained stopped, no model started. This is compatibility/glue proof, not new nativebackend qualification.
  • Actual web-preview Settings surface exercised file selection and enable/disable behavior and rendered the corrected add-only copy. It uses the repository mockbackend, not nativeElectron. Chromium screenshot capture repeatedly timed out; no visual image or nativeUI/device proof is claimed. The owned preview tab/server were closed.
  • Repository preflight versus pinnedMain: 0errors,0warnings,0newleanfindings;43changedfiles. Existing README updated with behavior and ownership.

Open gates

Desktop-maintainer review, and #1835 landing first (its own device runs are the maintainer's). No packaged Electron or model-performance receipt is claimed.

CI correction: the old desktop check asserted IPC literal text remained in preload.ts. Those implementation-text, wiring-count and browser mock-echo assertions are deleted, not repinned to the new modules. Actual production input-validation cases remain and pass; typecheck passes. This is a tests-only descendant, not a new runtime measurement. Current b71 CI: desktop-linux and appimage-linux pass; macOS desktop855/856cases pass, with only the unchanged inherited bot-VM bounded-output EPERM. The failing job did not record its syscall/stack; no isolation weakening, skip or retry was introduced. All other platform checks passed; the inherited desktop failure and device gates remain open.

CI on the current head: 12 successful checks and 2 scheduled-only skips, desktop and desktop-linux included.

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

CI is green on 14595092e (all 11 checks pass).

The first run's desktop job was cancelled by concurrency, not a failure; a fresh run passed in 11m3s. The branch also merges main's 5fe74ebb9, which fixes a linear_time.Fastest compile error on main that was failing the zig and zig-windows checks on both PRs.

@BlivionIaG
BlivionIaG force-pushed the feature/glp-steering-app branch from 1459509 to 0e196a7 Compare November 10, 2026 15:07
@BlivionIaG

BlivionIaG commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

Final app head is now b71e73e20c041583aa1162146fb217b7e729127c on pinned Main 8a7838a65a1fa1a44e0136a2cccd8bfcc8c0a8b5. Previous0e196 passed the real renderer/main/preload build, private-leak/856-file coverage gates, typecheck, six consumer suites and actual appservice/native1.2.5 compatibility smoke without model startup. Desktop CI caught an obsolete source-text assertion requiring IPC literals in preload.ts; removed that implementation/wiring/mock-echo block, retained and exercised actual input-validation contracts, typecheck passes. This is tests-only; no runtime proof relabeled. Other CI remains pending; backend Metal/no-GLP/style-topic gates remain unwaived.
Actual b71 desktop follow-up:855/856cases passed; the sole failure is now the unchanged bot-VM bounded-output EPERM, not the removed IPC assertion. Desktop-linux and appimage-linux passed. This is the same inherited genericEPERM as #1835, with no failing syscall/stack recorded; no process-isolation suppression or retry introduced. Independent read-only composition/preload review found no current defects, which is not runtime proof or a waiver. Other checks and existing device gates remain open.

Terminal platform-check snapshot at unchanged b71e73e20c041583aa1162146fb217b7e729127c:11successful checks,1failed,2scheduled-only skips. Linux Zig, Windows Zig, macOS dev-tools, formatting, pytest, release paths, both benchmark-client platforms, Linux desktop/appimage and mobile passed. The sole failed check remains macOS desktop's unchanged bot-VM bounded-output EPERM, not a GLP service assertion. No rerun or gate waiver. This host/build snapshot still does not qualify supported-model steering, no-GLP0/20speed/equality or semantic style/topic evidence.

Maintainer follow-up #1951 (comment) assigns review to the desktop-app maintainers,not the engine maintainers. This app-only PR remains dependent on--glp from#1835 and cannot land before it. No merge/auto-merge/draft-state change;awaiting app-maintainer review. Currentb71e73e2 stays unchanged.

@ashhart

ashhart commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Thanks @BlivionIaG. This PR changes only the desktop app, plus its CHANGELOG line, and the app has its own maintainers, so they'll review it rather than us. On the engine side it needs --glp from #1835, so it can't land before that.

  • Synthena (Ash's Agent)

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Rebased onto main 6c5cef894, now 334b7c2ff, so it no longer conflicts. The conflict was only CHANGELOG.md; the app line now ends "Thanks to @BlivionIaG." I also dropped the empty "re-run the app checks" commit. In app/: npm ci, npm test, npm run typecheck and git diff --check all pass on this head. It still needs --glp from #1835 to land.

@BlivionIaG
BlivionIaG force-pushed the feature/glp-steering-app branch from 334b7c2 to 46eb6b8 Compare November 13, 2026 10:17
The reader implements the GLP format defined by the weightless project
(@msuiche): a GGUF v3 container of one fp32 direction per layer, applied by
adding it to the residual stream. A file with no mode is llama.cpp's additive
vector; a file that names any other mode, project included, is refused rather
than read as an add file. The reader also refuses a spec version, rank or hook
point it does not implement, a layer named twice, a direction that is not
finite, and a digest that does not match. It reports the SHA-256 of the exact
bytes it was handed, so a caller can name the file it loaded.

tf-glp-check shows the reader's view of a file for glp_parity.py to compare
with the reference reader, the file hash included.
…8-27B

A steered layer takes the dispatch an unsteered layer takes: the norm that
adds the block's output to the residual stream also adds alpha times the
layer's direction to the row, and the normalisation reads the result. The
plan holds one device buffer per layer the vector names, and a model without
one runs the plain norm. The steered norm clears the half-operand state the
plain norm leaves for the head, since its output has no such words.

The kernel contract has a float64 reference for the add, a bound for the
kernel's own fp32 product and sum, the launch's threads and threadgroup memory
for gate 5, and the GPU suite with a control that drops a NaN and one that
breaks the normalisation. The GPU half needs a Mac.
Off unless --glp is given: without it the server is as it was. The file is
read once at startup, before the model loads, and the startup line names the
file (escaped), the SHA-256 of its exact bytes and that replies are steered,
beside the strength, the layers and the checkpoint the vector came from. The
file hash is taken over the bytes already read; nothing is read twice.

A file the reader refuses, a width or base model that does not match the
checkpoint, a layer past the checkpoint's depth, a Gemma checkpoint, any other
family, and a CUDA or ROCm backend are all refused by name and the server does
not start. The engine reports the vector in force with the same file hash.

docs/control-vectors.md covers the format, the layer a direction names, the
refusals and how an operator brings a vector; the repository ships none.
@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Commit identity fixed: author and committer on all 6 commits are now BlivionIaG <15323295+BlivionIaG@users.noreply.github.com> (the committer line had a malformed noreply address from a local git config). Trees and dates are unchanged; the head is now 46eb6b8c8. CI is green on it: 12 successful checks, 2 scheduled-only skips.

@ashhart

ashhart commented Nov 16, 2026

Copy link
Copy Markdown
Owner

The change does what it describes: an opt-in file-and-strength control in the advanced engine settings, off by default, active only when the engine advertises the steering flags, with just the on/off state and strength written to audit records rather than the chosen file. The new host test of the setting behaviour is thorough, covering strength validation, refusal on an engine without support, picker-only file selection, restarting when the strength or file changes, persistence across a restart, and dropping a file that has since gone away.

What is missing is coverage at the IPC boundary. The change deletes the host assertions that every engine channel is role-gated, that private material such as credentials, lesson text, environment values and folder paths never reaches audit logs or events, that the native picker is the sole admission route for a path, and that the bridge exposes each channel. They are removed rather than re-expressed against the reorganised modules, and nothing behavioural replaces them, so those invariants, including on the new control-vector channels, no longer have a host test. Please restore them as behavioural IPC tests and add an explicit check that the chosen vector path is never audited and that each new channel requires the operator role.

Nothing here changes the engine, server or kernel; the new launch flags only become meaningful once the separate backend work lands. Size, comment-length and environment-access rules all hold. On balance this needs fixes for the deleted IPC security coverage, though the feature itself is sound.

  • Synthena

@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Added engine-ipc-contract.test.ts (7f59824690, on top of the head, no force push). It registers the real engine-ipc.ts handlers against a recording service, audit, role check and native picker, so these are behavioural checks and not source matches:

  • Every registered channel, the four control-vector ones included, refuses a caller below its role before it touches the service, the picker or the audit; each asks for operator, engine:delete for owner. The channel list must equal the test's table, so a new channel cannot skip the checks.
  • The control-vector file path, the connection key, lesson text, folder paths and environment values never appear in an audit record. engine.controlVector holds only the state and strength (enabled/alpha, or cleared), engine:connection, chooseControlVector and addLibraryFolder write no audit record.
  • Only the native picker admits a path: a renderer-supplied path is never forwarded, and a cancelled, empty or two-file result reaches no service call.
  • Refused input (non-boolean Cortheon or learning flag, a lesson over 8 KB, a bad folder id or scan option) reaches neither the service nor the audit.
  • Every registered channel is reached through the preload bridge.

Checked on a clean npm ci: the new test passes; three planted faults (no role check on clearControlVector, the path added to the audit record, a renderer path forwarded to addLibraryFolder) each fail it. npm run typecheck exit 0; git diff --check exit 0; pr_check.py --base main 0 errors, lean 345 vs 345. npm test: 857 of 857 pass once mobile/ dependencies are installed (three mobile script tests fail only for missing modules otherwise).

@ashhart

ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thanks @BlivionIaG. The new tests exercise the real IPC handlers and restore the role, audit privacy, picker-only path and preload coverage, including the four new channels. That answers our latest code request. What remains is #1835, which this depends on, and fitting it to current main's locale and preload changes.

  • Synthena

…erved

The steer suite was freed before runAll read its probes; hold it through the run.
Build both kernels from the production specialization so the plain norm returns padded rows.
The spec's layers field is required even when the helper fills it.
…ld apart

capabilitiesFor(.., true) lists --glp even where this host's engine refuses it,
so comparing that listing with glp_startup.steers failed every non-Metal shard.
Assert the forced steering build lists it, a false build still follows the
platform's advertised bit, and the real capabilities equal steers.
Choosing a file reads the saved vector and writes it back with the
strength and state it read. Started beside a pending strength or state
change, it could apply the values that change had already replaced, and
whichever write landed last decided the settings. The picker now runs
through the same serialized feature-change path as set and clear, and a
regression holds the queued restart to overlap both a strength change and
an off change with a pick.
@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Fixed in 6fc81fa647: EngineService.chooseControlVector now runs through the shared changeFeature queue, so a picker selection is serialized with set and clear and cannot read preferences a pending change has not written yet.

The regression in app/electron/agent/engine/control-vector.test.ts holds the queued restart and overlaps a pick with (a) a pending alpha 2→5 change and (b) a pending on→off change, then checks the picker's returned snapshot and the saved preferences. Red before: alpha 2 !== 5, and with that assertion skipped, enabled true !== false. Green after: 3/3 runs.

app/: npm test 904/904 files pass, npm run typecheck 0 errors, git diff --check clean; tools/pr_check.py --base 6609ffbf99 --pr 1951 0 errors, 0 warnings, lean 165 vs 165, 0 new.

Head c176811e94 merges upstream/main (6609ffbf99) and the #1835 head (24de2f6cb7); conflicts in CHANGELOG.md (both sides kept) and zig/build/qwen27_host.zig (the MTP host filter and main's qwen27_costs module both kept). CI is queued on the new head.

# Conflicts:
#	CHANGELOG.md
#	zig/build/qwen27_host.zig
@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thanks @BlivionIaG. The picker now shares the setting-change queue, and the overlapping strength/state regression covers the reported race. The restored IPC security coverage remains present, and the included steering parent contains the previously requested fixes.

Desktop-maintainer approval and the steering parent landing first remain prerequisites. The app tests do not replace packaged Electron checks or the engine's exact off-path and same-setting serial steering comparisons.

  • Synthena

Main's SenseNova support turned the qwen27 norm into normShift and filled quant_gpu.zig to its 600-line limit. The steered norm now dispatches from norm_steer_gpu.zig with its pipeline held by the steering plan, unsteered norms call main's normShift, and SenseNova models refuse a control vector.
@BlivionIaG

Copy link
Copy Markdown
Contributor Author

Merged the new #1835 head (178a01a70b, with main 4c79cfe346) into this branch: head d353847607; npm run typecheck 0 errors, npm test 904/904, pr_check 0/0; app/CHANGELOG.md keeps both sides. Still waiting on desktop-maintainer approval and the steering parent landing first.

@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thanks, @BlivionIaG. The picker queue fix, overlapping strength/state regression and IPC coverage remain intact. The app code is unchanged from the previously tested subtree, and the latest app checks are useful.

Desktop-maintainer approval and the steering parent landing first remain prerequisites. Packaged Electron checks and the parent's exact off-path and same-setting serial steering comparisons are still needed. The changelog is the only conflict with current main.

  • 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.

3 participants