Skip to content

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

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

BlivionIaG wants to merge 104 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.

  • Issue: n/a — app companion of Implement GLP control vectors with a fused Metal kernel for Qwen3.8-27B #1835; no new family, backend or arithmetic.
  • Stacked on: main cd1a825e9e, merged into this head (942ea2e7a3); Implement GLP control vectors with a fused Metal kernel for Qwen3.8-27B #1835 at 741fd8af50 is the ancestor. Main's q27_witness load guard and the GLP glp option both kept in zig/src/native/metal.zig; main's macOS-only test block kept and this branch's qwen27_mtp import added inside it; CHANGELOG.md kept both sides; the branch's qwen27Source now inlines the Q27_SPECIALIZE substitution so metal_limits.zig stays at 598 lines.
  • atc overlap --json: ATC0.9.6 was run against upstream with --base fb8fdf3; complete=false (myPullRequestsLimit, otherPullRequestsLimit, pullFilesLimit, pullFilesUnavailable, timeLimit). Supplemental complete snapshot:217foreign open heads,3038 exact local merge comparisons including latest Main ff742df; existing reviewed overlaps are retained, not claimed globally clean. The avoidable added environment-test collision with CUDA (GB10): a lending-daemon source for the display carveout, opt-in #2762 was removed by preserving Main's existing test name, without importing its unmerged feature.

Checks on this head

  • Head commit: 942ea2e7a3.
  • 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

@ashhart

ashhart commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Thanks, BlivionIaG.

The latest source meets the four remaining code asks. The app prices the current Qwen startup-budget form and has
its parser regression. The engine IPC contract test is restored. A present non-boolean enabled value is refused
before state changes, and the refused-strength path restores the displayed value from the live snapshot.

The remaining proof is the two real native-picker cells. Initial selection while off must save the picked path with
enabled:false, no GLP arguments and no picker-triggered restart. Replacement while active must retain enabled
state and the existing strength and restart with the picked path. Desktop approval and the parent engine feature
remain separate landing gates.

This was a source-only re-check; no contributor build or test was run here.

  • Synthena

@ashhart

ashhart commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Thanks again @BlivionIaG. One sequencing note on top of the review above: this branch also carries 58 of #1835's 59 commits (the GLP engine and fused Metal kernel), so landing it would land #1835's code with the changes still asked there. We'll keep #1951 ready on our side and land it right after #1835's fixes are in; no change is needed to the app work itself. We have #1951 rebased onto current main for that.

  • Synthena

@joshuaswarren

Copy link
Copy Markdown
Contributor

The desktop leg's two failures are the secret-canary linter tests, and this PR's engine surface is the likely regression point: pull-liveness.test.ts:86 asserts the pull-liveness rows do NOT match the canary regex (proxy-user / needle / unknown-user / unknown-secret / private / hidden / provider-secret), and the emitted rows now carry fixture repo names like Org/Proxy through a path this PR rewrites (model-downloads.ts, engine-process-record.ts, the liveness pipeline). sandbox.test.ts fails the same way. 914/916 pass; the two reds are exactly the canary assert pairs. The fix on this branch: keep the canary repos out of the emitted liveness payload (or redact the repo field the rows emit) so the assert holds — happy to review the redaction approach.

@ashhart ashhart added kind:app Classified by Synthena as desktop or mobile app synthena:needs-changes Reviewed by Synthena; changes requested labels Dec 3, 2026
@ashhart

ashhart commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Synthena Initial Review — Needs changes (kind:app)

Adds app-side controls (file picker, strength, on/off) for the engine's control-vector steering feature, wired through preferences, IPC, preload, and settings UI, plus a few unrelated new engine modules (process record, performance tracker, benchmark model check) and translation packs.

  • Failing CI check(s): desktop, desktop-linux.

Findings:

  • [BLOCKER] app/electron/agent/engine/engine-process-record.ts: The stale-engine reaper kills a process group with process.kill(-pid, ...) based on a ps command string match, but the ps output is the full command line and the binary path is not shell-quoted; a path containing spaces or a sibling binary with a matching prefix could be matched, and killing a negative pid targets a group that may include unrelated processes if the engine did not set a process group. Suggested fix: Verify the pid's executable (e.g. readlink /proc//exe or ps -o comm=) matches the binary basename before killing, and only use the negative-pid group kill when the app itself created the process group; otherwise fall back to the single-pid kill.
  • [BLOCKER] app/electron/agent/engine/benchmark/model-check.ts: fs.realpath(argument) will reject with ENOENT if the argument path does not exist, turning a benign mismatch into an unhandled rejection inside checkBenchmarkModel; also the comparison realpath(argument) !== snapshot compares a resolved path against a snapshot value whose own resolution is not shown, so a symlinked cache dir can false-fail. Suggested fix: Wrap the realpath call in a try/catch (or fs.stat first) and treat a missing path as a mismatch error with a clear message; resolve both sides (or compare realpath-to-realpath) before the strict inequality.
  • [WARNING] app/shared/control-vector.ts: mergeControlVector treats an explicit null alpha as 'keep current', but checkedAlpha rejects null with a range error; callers passing {alpha: null} (e.g. a form reset) silently keep the old strength instead of surfacing an error, which can desync the UI from the stored preference. Suggested fix: Decide one semantics: either reject null like other invalid values, or document that null means 'unchanged' and drop the dead checkedAlpha(null) path; add a test for the chosen behavior.
  • Synthena

@ashhart

ashhart commented Dec 5, 2026

Copy link
Copy Markdown
Owner

A correction to our automated review: Our 28 Nov review stands: nothing more is needed on the app code (the flagged process-record, model-check and performance modules are service.ts split into files), and landing it is ours.

  • 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

kind:app Classified by Synthena as desktop or mobile app synthena:needs-changes Reviewed by Synthena; changes requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants