Skip to content

server: repair strict builds and residency-aware adapter fixtures - #106

Merged
joelteply merged 7 commits into
codex/s4-per-mind-integrationfrom
cormac/inherited-ci-repair
Nov 11, 2026
Merged

joelteply merged 7 commits into
codex/s4-per-mind-integrationfrom
cormac/inherited-ci-repair

Conversation

@joelteply

Copy link
Copy Markdown

The integration branch fails GCC fatal warnings on partial training initializers and the fclose deleter type; server tests also attempt adapter loads without the residency registration now required by the engine.

Initialize the existing callback fields explicitly, construct pending learning state with its defaults intact, use a typed file closer, and make the test fixtures measure and register residency before loading adapters. Admission checks remain unchanged.

Validation: Cormac reports a macOS x86_64 CPU llama-server build with LLAMA_FATAL_WARNINGS=ON and Python compilation passing. Codex reviewed the exact fcce169 diff. ARM GCC and server test execution remain for CI; no live fixture was run. Coordinated implementation by Codex and Cormac.

joelteply and others added 2 commits November 10, 2026 10:40
…by type, and give LoRA tests real residency custody

The integration line's CI failed on paths fork #103 does not touch (Codex's audit, logs 42832757120 and 42832757300):

- server-context-learn.inc:396 aggregate-initialized pending_learn with only its first nine fields, so
  grant/finished/failure tripped -Wmissing-field-initializers on the ARM -Werror build. pending_learn
  now has a constructor for those nine; every other field keeps its stated default.
- server-context-learn-checkpoint.inc:45-46 used decltype(&fclose) as a unique_ptr deleter, and
  fclose's attributes are dropped in a template argument (-Wignored-attributes). A file_closer type
  replaces it.
- test_lora.py and dream-adapter-routes.py loaded or freshly created adapters by name alone; the
  engine now seats an adapter only inside a residency registered for its exact subject, so they
  failed unknown_residency. Each now measures (dry_run), registers the rows and leases through
  /learn/residency, and loads under that residency, as the core does. Admission is not relaxed.

With e183785 (training admission initializers, Codex) this repairs the gate. llama-server builds
with LLAMA_FATAL_WARNINGS=ON (macOS x86_64 clang, CPU); both tests compile under python.

Assisted-by: Claude (Cormac)
joelteply and others added 5 commits November 10, 2026 11:10
…rity that may calibrate an unmeasured geometry

Its full-share grant (share_ppm 1000000, no max_chunk_us) is refused pending_calibration by design
(server-learn-ledger.h): only idle-only authority may learn before a geometry's chunk cost is
measured, as learn-past-example.py does. Nothing else decodes while the test learns. The guard is
unchanged.

Assisted-by: Claude (Cormac)
…rs from the engine's preflight

Every learn now needs optimizer_residency and workspace_residency (admit_learning_residency). The
test preflights each example through /learn/preflight's completion form, registers her optimizer
once for the shadow's exact loaded subject, and a workspace per example sized to that reply, then
attaches both references to the completion's learn. Rows split exactly as admission splits them
(shared_compute_held skipped, shared_compute_required to the workspace, the rest to the optimizer).
Weights already came through registered residency. Same pattern as learn-past-example.py.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…w and tokenizer

CI serves stories260K at -c 512, and 55 repeats of the sentence exceed that window, so the
example preflight correctly refused it (reply_rows past the served window). The route forbids a
caller-computed reply_rows (server-context.cpp post_learn_preflight). So the test reads the slot's
n_ctx, counts the served prompt (with BOS) and the reply's end of turn through /tokenize with the
schema's reply semantics (add_special false, parse_special true), and takes the largest repeat count
that fits. It is still a multi-chunk learn for the save race.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…ngine incarnation

/lora-adapters/unload requires the engine incarnation (server-context.cpp post_lora_adapters_unload).
Audit of the pytest suite: test_lora.py is its only caller of a lifecycle route (load, unload,
residency, grants). Every other call there already carries its residency or engine.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply

Copy link
Copy Markdown
Author

Windows diagnosis update for exact 3851243 (job 130009056581).

Failing case: test_completion_unified[256-4-n_predict_vals2-expected_success2], requests [90, 90, 40, 90]. The 40-token request must succeed, but all four returned HTTP 500 / Context size has been exceeded.

The captured timeline gives a causal lead: the short request is task 38, first launched at 532 ms. At exhaustion it has 38 cached tokens while long tasks 0/1/2 have 73 each. The fixture starts HTTP requests through independent ThreadPoolExecutor workers; it does not establish simultaneous server admission. Hypothesis: delayed short-request arrival lets the long requests occupy unified KV before the short request can finish. Windows scheduling may expose this, but a Windows-only engine defect is not established.

Reproduction plan: use an isolated CPU binary at this exact revision and independent port; record request arrival, slot assignment and KV occupancy; compare synchronized arrival with deliberately delayed short-request arrival, then compare base 316ad8. Keep the success assertion and custody guards until the intended scheduling contract is demonstrated. No rerun-to-green or platform skip proposed. Local reproduction has not run yet; the Windows efficiency deployment currently owns the build slot.

@joelteply

Copy link
Copy Markdown
Author

Review (Fable): approve. Strict-build repairs are mechanical and correct (explicit nullptr for the new admission fields, a closer type instead of decltype(&fclose) for -Wignored-attributes, a pending_learn constructor for -Wmissing-field-initializers on ARM); the adapter tests now register custody before seating, as the engine requires.

@joelteply
joelteply merged commit 8bb0a18 into codex/s4-per-mind-integration Nov 11, 2026
14 of 18 checks passed
joelteply added a commit that referenced this pull request Nov 11, 2026
…shadow unloads while another mind learns

c5551ed made ggml_opt_free assert that the SHARED scheduler had no pending graph. A serving
context keeps one optimizer per shadow on one scheduler, and llama_context::opt_release frees an
idle shadow's optimizer while another shadow's step is in flight (#85's contract: "ggml_opt_free
touches no shared scheduler"). That assert then aborted llama-server whenever the unload landed
mid-step (fork #106/#107 reproducer, learn-unload-during-learn.py, 2 of 3 runs on CPU).

ggml_opt_free releases only this context's own buffers and metadata. The check is now
context-local: ggml_backend_sched_graph_pending_for(sched, graph), true only when the scheduler is
part-way through THAT graph (graph_step already keys its continuation on the caller's graph
pointer). Freeing a context whose own graph is in flight still aborts. ggml_opt_reset and
ggml_opt_prepare_alloc keep the scheduler-wide guard: reset zeroes the last graph's gradients,
which in a dynamic graph can sit in the shared compute buffer another mind now uses, and
prepare_alloc allocates onto the scheduler.

Tests (test-opt-dynamic-accum, built with -fsanitize=address on CPU, IntelMac):
- run_frees_idle_mind_while_another_steps: B learns a step, A stops one node into its step
  (scheduler pending), B is freed, A completes with exactly the update it makes alone. PASS.
- run_free_own_pending_graph_aborts: freeing a context whose own graph is in flight aborts
  (observed in a forked child; skipped with a message where fork() is unavailable). PASS.
- the existing suite: PASS.
- Mutation: restoring the scheduler-wide check aborts the first test at the same assert the
  engine hit (exit 134).
End to end: the reproducer passes 10/10 on the fixed CPU server, but it is timing-dependent (it
aborts only if the unload lands mid-graph; 0/6 on the unfixed engine in a later run), so the unit
test is the proof.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant