Skip to content

serve: schemajump R2 feeds a run of fixed ids as one prefill call (BLOOMERY_SCHEMAJUMP, on by default) - #535

Merged
midagedev merged 2 commits into
mainfrom
sjr2
Oct 20, 2026
Merged

midagedev merged 2 commits into
mainfrom
sjr2

Conversation

@midagedev

Copy link
Copy Markdown
Owner

Under a schema (response_format json_schema, a forced tool_choice), the jump arm feeds each run of ids the program fixes as one Engine::prefill (Need::Fill) instead of one next per id. The next decision reads the row of the step that closes the run.

  • The worker runs the call like a prompt's: a quantum of ids beside other busy slots, never inside a step.
  • A request that asks for probabilities, has a think budget, or meets a run under MIN_FILL (2) ids steps.
  • timings.constrained counts the arm, spans, span ids, decisions, free steps, and the next and prefill calls.
  • BLOOMERY_SCHEMAJUMP=off is the step arm (a registry row, OnOff, default on).

Gates, all green on the box:

  • Fixture tier: 20 of 20, 970 s.
  • Real tier: the 10 deferred items, 898 s.
  • The list comes from just affected narrowed by recipes.py reach (owning gates, gate-levers, the serve seats).

Next work is tracked in #532: L1 to L3, and the comparison with Clef-Flash.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K8ndZ5qubx9kYLVxTgbvEq

… by default (BLOOMERY_SCHEMAJUMP)

The jump arm feeds a run of ids the program fixes as one Engine::prefill (Need::Fill) instead of a step each. The id
just taken and the run but its last id are the call's; the run's last id is the step that follows, whose row is the
next decision's. The worker runs the call like a prompt's (a quantum of ids beside other busy slots), never inside a
step. The closing text after the last decision is fed too, so the stop id is picked from a row as the step arm picks
it. A request that asks for probabilities, has a think budget, or meets a run under MIN_FILL ids steps.

timings.constrained counts the arm, spans, span ids, decisions, free steps and the next and prefill calls. Every seat
passes levers.schema_jump() to SlotConfig through Listen (bind.rs slot_config); the seats' lever tables list it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01K8ndZ5qubx9kYLVxTgbvEq
@github-actions github-actions Bot added documentation Improvements or additions to documentation gpu The card engine: crates/gpu*, crates/app host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset needs-gpu Changes code a card must check, and carries no gate run on a card serve The HTTP server: crates/serve labels Oct 20, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MUST_FIX: Partial span fills leave request and slot position counts stale.

Must fix

1. Book and publish every successful fill quantum (kind A)

genloop.rs:2195 returns before updating n_past. With another active slot and a quantum of two, a client can disconnect after two partial fills. The cancellation fixture has a two-token prompt, so the cache holds six positions while timings report two [derived]. The worker also skips publishing fill progress at worker.rs:793. On the next pump the sink fails; end_request copies the stale count into the slot view, which /slots exposes.
Fix this before clients depend on the new arm's position reporting. Replace fill with:

    pub(crate) fn fill(
        &mut self,
        slot: &mut Slot,
        quantum: Option<NonZeroUsize>,
    ) -> Result<(), EngineError> {
        let span = self.span.as_mut().expect("a run being fed");
        let end = quantum.map_or(span.feed.len(), |q| {
            (span.fed + q.get()).min(span.feed.len())
        });
        slot.prefill_range(&span.feed[span.fed..end], slot.held.len(), &[])?;
        span.fed = end;
        self.tim.n_past = slot.held.len();
        if let Some(j) = self.tim.jump.as_mut() {
            j.prefill_calls += 1;
        }
        if end < span.feed.len() {
            return Ok(());
        }
        let Some(span) = self.span.take() else {
            return Ok(());
        };
        self.kept = span.run;
        self.tok = Some(self.kept[0]);
        self.taken = 1;
        Ok(())
    }

In Worker::step, replace needs.push(Need::Fill); with:

tick_of(&self.sh, a.slot)(a.job.timings());
needs.push(Need::Fill);

In the existing cancellation fixture, bind the returned timings as (r, timings) instead of (r, _), then add after generation:

assert_eq!(timings.n_past, slot.held_of(0).len());

Non-blocking

⚠ Supply the dispatch measurement: genloop.rs:2190 replaces L scalar calls with one prefill for an unquantized span, saving L−1 host calls [derived]; a quantum q instead needs ceil(L/q) fills. The closing step remains. Batch geometry and rounding also change. Provide the owning gate outputs and a same-lease on/off A/B on the contributor's card, as the AGENTS dispatch and change-class contracts require, to establish the elapsed-time effect.

Checked

Static validation followed prefill_range, partial fill, cancellation in pump, end_request, and the /slots consumer. The cancellation fixture discards timings; the proposed assertion detects the stale count. The seat source-text test at crates/gpu-gates/src/bind.rs:3212 also accepts a lever read whose value is discarded before binding. Neither finding matches a not-to-flag exclusion, an escape pattern, or a ledger lesson.

Notes

No builds or gates ran during validation. The PR body reports green gate totals but omits FAIL-first output and the card, commit, model and command-output evidence required by CONTRIBUTING.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/bloomery_serve_qwen38.rs, crates/gpu-gates/src/bin/gate_glm5next_serve.rs, crates/gpu-gates/src/bin/shared/ds41_serve_levers.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

Gen::fill sets the request's n_past to the slot's positions after every prefill call of a forced run, not once at
the run's end, and the worker ticks the slot's timings after each fill call, so `/slots` shows the run's positions
while its calls run. The constrain and slots tests pin both (red on 02bf082).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01K8ndZ5qubx9kYLVxTgbvEq
@midagedev

Copy link
Copy Markdown
Owner Author

Review fix: Gen::fill books n_past after each call, and the worker publishes the timings after each fill call (b0705d9). Fixture batch over the owning gates: 15 items, red=0 (gate-gpu-qwen38-serve re-run after an ssh drop: rc 0, 105 s).

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the last review:
Must-fix 1 is fixed: genloop.rs:2193 books every successful fill; worker.rs:794 publishes its positions.

Verdict: CLEAN: The incremental changes fix partial-fill position reporting and add assertions for both updates.

Checked

Duplicates: 1 new function checked in this increment; no duplicate contract found. Dryer reports 0 candidate pairs.
Complexity: crapper flags Gen::pump (25→29) and Worker::step (23→27), from the earlier span-dispatch branches. This increment adds no branches to either.
Silent failure: 2 error paths followed, slot selection and prefill failure; both reach the fatal worker error path before publication. No new defaults or discarded errors.
Tests: static mutation check only. Removing genloop.rs:2193 breaks the changed cancellation assertion; removing worker.rs:794 breaks the new paused-fill /slots assertion. The latch stops before the in-flight call is logged, so the expected count includes completed calls only.
Gates: no existing gate, pin or threshold removed or relaxed. The new integration gate is hw_-prefixed and ignored.
Adversarial checks: cancellation after a partial fill, alternating selected slots, and board-lock re-entry are blocked by the updated count, explicit selection, and released admission lock respectively.
Escape catalog: no patterns match this increment.

Notes

No builds, tests or gates ran during this review. The PR body supplies gate totals but lacks FAIL-first output and the card, commit, model and command-output evidence required by CONTRIBUTING.

Card check: needs-gpu. This pull request changes crates/gpu-gates/src/bin/bloomery_serve_qwen38.rs, crates/gpu-gates/src/bin/gate_glm5next_serve.rs, crates/gpu-gates/src/bin/shared/ds41_serve_levers.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@midagedev
midagedev merged commit e570d87 into main Oct 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation gpu The card engine: crates/gpu*, crates/app host Host crates: qdot, threads, engram, engram-lab, runtime, sampler, levers, decision, vision, refset needs-gpu Changes code a card must check, and carries no gate run on a card serve The HTTP server: crates/serve

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant