Skip to content

[0.0.25] fix(runtime): deflake command_invoke RC-1 wall budget under CI load - #2298

Merged
Xuepoo merged 1 commit into
mainfrom
ctx-2259/fix-command-invoke-flake
Oct 20, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
ctx-2259/fix-command-invoke-flake

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Priority: P2 | Area: area:runtime | Labels: fix,P2,area:runtime | Milestone: 0.0.25 | RFC: RC-1 callback budget | Task: CTX-1381

Closes #2259

Root cause

crates/bitty-runtime/tests/command_invoke.rs drives the real host-mediated
cross-VM command path, so one dispatch runs inside a single RC-1
call_function wall window
: the caller chunk executes bitty.commands.invoke,
the host mediates the call, the callee chunk runs in a second VM, and the result
is schema-validated and marshalled back. The harness reused the 50 ms production
wall budget for that work.

Measured idle cost on this host (debug test profile, 20 runs of the failing
test): 11–27 µs per dispatch. So:

  • macOS ARM64, PR chore(docs): bump terminal docs pin #2252 (docs pin, test file untouched):
    WallClockExceeded { elapsed_ms: 80, budget_ms: 50 } in
    raising_callee_is_contained_and_the_host_serves_on; rebase + rerun green.
  • Linux Quality gates (2) shard on main (run 39293939250):
    args_schema_violation_is_refused_before_execution failed with
    left: "err:E_TIMEOUT" at command_invoke.rs:498 — the same suspension
    through the caller's err:<code> mapping.

That is a scheduler stall during sharded nextest, not extra product work: no
host regression, and the production budget is not exercised by the assertion.

Fix (issue option 1/3, repo precedent)

Widen only the test harness wall dimension through the existing
PluginRuntime::set_vm_wall_budget_ms test hook:

const HARNESS_WALL_BUDGET_MS: u64 = 10 * RC1_WALL_CLOCK_BUDGET_MS; // 500 ms

Same treatment already accepted for bitty#1727 (composer_headless_driver) and
bitty#1744 (plugin_ui). Production keeps RC1_WALL_CLOCK_BUDGET_MS = 50 and
VmBudgets::default(); production code never calls the setter, and
instruction/memory stay at RC defaults.

The exact 50 ms value stays pinned deterministically by
bitty-lua/tests/measurement_lua.rs (execute_with_elapsed at exactly 50 ms,
check_budgets) and load_gate.rs. New
runaway_callee_is_contained_and_the_host_serves_on proves the dispatch path
is still bounded by the unchanged 10M-instruction budget (timing-independent:
while true do end always trips a budget), and that the host serves on after a
suspension.

Repeat-run evidence

40 x serial     (all 15 tests)          -> 0 failures
384 x concurrent (32 processes x 12)    -> 0 failures

Mutation proof

Tight production budget restored (HARNESS_WALL_BUDGET_MS = RC1_WALL_CLOCK_BUDGET_MS)
plus a genuine ~75 ms regression in the dispatched command (8M-iteration loop):

test result: FAILED. 8 passed; 7 failed
invoke: Vm("vm suspended: WallClockExceeded { elapsed_ms: 50, budget_ms: 50 }")

i.e. the original tight budget still catches a real regression, and the failure
signature matches CI. With the widened harness and the same compute regression
the suite still fails — via
InstructionBudgetExceeded { used: 10000012, budget: 10000000 } — so widening
the load-sensitive wall dimension does not hide Lua-compute regressions.

Accepted bound: sub-500 ms host-side latency regressions on this path are no
longer flagged by these integration tests; the 50 ms contract itself is pinned
by the deterministic VM-level tests above.

Gates

  • cargo fmt --all -- --check — clean.
  • just clippy (workspace -D warnings, plus bitty-terminal --features dev-tools) — clean.
  • cargo nextest run -p bitty-runtime -p bitty-lua — 2947 passed, 2 skipped.
  • cargo check --target x86_64-pc-windows-gnu --workspace --all-targets — clean.
  • just ci-local: not used as a gate for this PR (owner directive). The only
    attempts failed for infrastructure reasons, not code: rust-lld aborted with
    signal 7 [Bus error] while linking test binaries as /mnt/data reached 100%,
    and the retries failed seeding the act cache (Permission denied, root-owned
    cache dir). Local fmt/clippy/nextest/Windows gates above plus remote CI
    are the acceptance gate.
  • macOS ARM64 is CI-only (no local macOS host); the macOS ARM64 check and test
    job on this PR is the platform evidence.

…load

The integration fixtures drive the real host-mediated cross-VM command path:
one dispatch runs the caller chunk, the mediated callee chunk in a second VM,
schema validation, and result marshalling inside a single RC-1
`call_function` wall window. Reusing the 50 ms production wall budget for that
harness suspended at 80 ms on a shared macOS ARM64 runner (WallClockExceeded,
bitty#2259) and surfaced as `err:E_TIMEOUT` on a Linux Quality gates shard, with
the command path itself untouched.

Widen only the test harness wall dimension to 10x RC1_WALL_CLOCK_BUDGET_MS
through the existing `set_vm_wall_budget_ms` test hook (same treatment as
bitty#1727 and bitty#1744); production keeps `VmBudgets::default()` at 50 ms and
never calls the setter. The exact budget stays pinned by
`measurement_lua`/`load_gate` (`execute_with_elapsed` at 50 ms), and a new
runaway-callee test keeps the dispatch path bounded by the unchanged instruction
budget.

Measured idle dispatch cost is 11-27 us, so the CI observation is a scheduler
stall, not product work. 424 consecutive runs (40 serial + 384 concurrent) pass;
with the tight budget restored, a genuine ~75 ms command regression fails with
`WallClockExceeded { elapsed_ms: 50, budget_ms: 50 }`.
@Xuepoo Xuepoo added this to the 0.0.25 milestone Oct 20, 2026
@Xuepoo Xuepoo added fix Bug fix area:runtime Area: runtime orchestration P2 Priority: medium labels Oct 20, 2026
@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 94249070-4d4b-4d49-b1ff-a7a347897237
📥 Commits

Reviewing files that changed from the base of the PR and between 470c20a and 11c86c0.

📒 Files selected for processing: 1
  • crates/bitty-runtime/tests/command_invoke.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Xuepoo
Xuepoo merged commit 6c4ae43 into main Oct 20, 2026
17 checks passed
@Xuepoo
Xuepoo deleted the ctx-2259/fix-command-invoke-flake branch October 20, 2026 02:40
Xuepoo added a commit that referenced this pull request Oct 20, 2026
The first pass was audited at `470c20ab`; four commits merged while it was open
and one of them changes a claim the entry makes.

- #2296 adds the production component request surface
  (`bitty.component.request` / `bitty.component.poll`) and closes #2254, so the
  Known issues bullet no longer says no request producer exists. Its real
  limits replace it: no IPC verb, no streaming or retained handle, lossy UTF-8
  response bodies, and a mirrored grant surviving a runtime-only suspend.
- #2295 hardens the activation record against a planted symlink on both the
  write and read side, with a typed `ActivationWriteError`.
- #2291 moves all six extracted extension pins to their upstream heads and adds
  the pin drift gate.
- #2298 deflakes the cross-VM `command_invoke` test against the 50 ms
  production RC-1 wall budget.

The provenance line now records the audited head `6c4ae437`. The RC-1 fuel
accounting fix is still not claimed: PR #2292 remains open.

Docs-only: no code, scripts, workflows, or pins touched.
Xuepoo added a commit that referenced this pull request Oct 20, 2026
The first pass was audited at `470c20ab`; four commits merged while it was open
and one of them changes a claim the entry makes.

- #2296 adds the production component request surface
  (`bitty.component.request` / `bitty.component.poll`) and closes #2254, so the
  Known issues bullet no longer says no request producer exists. Its real
  limits replace it: no IPC verb, no streaming or retained handle, lossy UTF-8
  response bodies, and a mirrored grant surviving a runtime-only suspend.
- #2295 hardens the activation record against a planted symlink on both the
  write and read side, with a typed `ActivationWriteError`.
- #2291 moves all six extracted extension pins to their upstream heads and adds
  the pin drift gate.
- #2298 deflakes the cross-VM `command_invoke` test against the 50 ms
  production RC-1 wall budget.

The provenance line now records the audited head `6c4ae437`. The RC-1 fuel
accounting fix is still not claimed: PR #2292 remains open.

Docs-only: no code, scripts, workflows, or pins touched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:runtime Area: runtime orchestration fix Bug fix P2 Priority: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[0.0.25] macOS ARM64 CI flake: command_invoke WallClockExceeded (80ms vs 50ms budget)

1 participant