Repository navigation
fix(event-log,agent,js-runtime): fix Host stress bugs, bound V8 ArrayBuffers, and remove SQLite hot-path bottlenecks - #7100
Merged
Conversation
…ace and remove SQLite hot-path bottlenecks
…step cell child knowledge
… stop-race cleanup - P1-1 (js-runtime): disable resizable ArrayBuffer and growable SharedArrayBuffer across all three isolate entry points so backing stores cannot bypass ArrayBufferBudget; replace infinite-loop test with finite in-budget, over-budget, and resizable-rejection assertions. - P1-2 (agent-state): switch RunSlot.current to tokio::sync::RwLock so contested takeover waits are natively cancel-safe and swap+retirement occur within the same poll; add contested cancelled-takeover regression test. - P1-3 (event-log): replace runtime sqlite3_config(SQLITE_CONFIG_MEMSTATUS, 0) with compile-time LIBSQLITE3_FLAGS=SQLITE_DEFAULT_MEMSTATUS=0 in .cargo/config.toml and verify PRAGMA compile_options. - P1-4 (agent-engine, agent-native): introduce preparation::OutputBudget (Compute vs Frozen) so materialize and SummaryRepair preserve the frozen max_output_tokens instead of re-applying the default 200k Summary 4% floor; assert dispatched max_tokens == 4096 in compaction test. - P2-1 (event-log): make queued ReadDispatcher jobs cancel-on-drop to release closure/custody immediately and skip cancelled jobs before authority validation or connection open. - P2-2..5 (cli stress): tighten Scenario H/I/J/K/L assertions (wave-1 messageIds & in-flight load, UI/background reader error & sample counts, canary fixture_0 content & strict 80/80 archive readback, durable agent/goal status, active runId stop + kind==removed). - Bonus Bug #8 (agent-native): use original_frontier() in driver_cells.rs (quarantine, NativeCellPort::new, NativeCellPort::commit) so stopping a Run mid-Cell cleanly rejects new child admission instead of triggering Run is no longer executable -> failed quarantine -> CleanupUnconfirmed; log error detail in cleanup.rs::observe_tool and add unit regression test.
M4n5ter
force-pushed
the
stress/hell-tier-host-torture
branch
from
November 20, 2026 17:21
de0865a to
ce46952
Compare
- Strip WebAssembly, SharedArrayBuffer, and Atomics in plugin/engine.rs runtime_base so neither Pure nor Scoped plugin isolates can allocate unmetered page-allocator backing stores; add pure/scoped integration tests. - Replace ReadQueue's VecDeque+HashMap pair with a single BTreeMap<u64, ReadJob> so repeated cancellations while another read stays pending leave zero stale IDs. - Tighten Scenario H to verify >= 50 wave-1 runs actively working via agent/observe immediately before SIGKILL #1 (observed 100/100) with no post-check sleep. - Tighten Scenario L so total_active_deleted only counts runs where agent/stop returned requested=true, settlement succeeded, and changeSession removed the session. - Replace the racy 40-Write cell stop test with a deterministic Rig test pausing inside PreparedTool::prepare before committing StopRequested so NativeCellPort::commit(ChildAdmitted) deterministically hits view.stopped and records ChildRejected without poisoning cleanup.
M4n5ter
force-pushed
the
stress/hell-tier-host-torture
branch
from
November 20, 2026 17:56
cb6e9a0 to
09e4498
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes 6 real runtime/durability bugs and 4 SQLite/V8 hot-path scaling bottlenecks exposed by a new opt-in Hell-Tier Host stress suite (Scenarios H–L).
Bug fixes
platform/event-log,plugins/agent/native): refreshProjectWorkspacePlanunder the serialized root-store write lock (ProjectWorkspacePlan::refresh_under_mutation) so concurrentagent/createcalls on the same fresh directory converge on a single project instead of failing withProjectError::Changed.platform/js-runtime): wire av8::new_rust_allocatorbacked by an atomicArrayBufferBudget(bounded_create_params) into JS cells, REPL, and plugin engines, guard resizableArrayBuffer/SharedArrayBufferconstructors, and stripWebAssembly/SharedArrayBuffer/Atomicsin pluginruntime_baseso off-heap backing stores cannot bypassheap_bytes.SummaryRepairmutating frozen cut & output cap (plugins/agent/engine,plugins/agent/native): introducepreparation::OutputBudget::{Compute, Frozen}and preserveprovenance,composition.max_output_tokens,adjudications, andcompaction_recoverywhenrepair == trueinsummary_repair.rsandmaterialize.rssoFrozenSummary::Repairpreserves the original frozen Summary cut and dispatchedmax_tokens.O(N × M)per-notification Cell child knowledge explosion (plugins/agent/native): capture and project[Host Cell child knowledge]once per distinct Cell per step cut instead of repeating up to 256 KiB on every notification in a batch (FrozenNotificationgains top-levelthrough: u64andknowledge: Option<FrozenCellKnowledge>).CleanupUnconfirmed(plugins/agent/native,plugins/agent/engine): useRunAccess::original_frontier()(original_driver_frontier) indriver_cells.rs(quarantine,NativeCellPort::new,NativeCellPort::commit) so anagent/stoparriving mid-Cell cleanly rejects new admission withToolError::Failed("Cell admission is stopped")and recordsChildRejectedinstead of misclassifying stop asToolError::Persistence->ToolError::CleanupUnconfirmed.OperationCleanup::Unconfirmed(plugins/agent/engine,plugins/agent/native): log underlyingdriven/outcome/observe_toolerror details indriver_assembly.rs,queue.rs, andcleanup.rsinstead of discarding them.SQLite & Host hot-path improvements
platform/event-log): replaceReadSlotsbroadcast wakeups withReadDispatcher(Mutex<ReadQueue> + Condvar,BTreeMap<u64, ReadJob>,available_parallelism().clamp(4, 8)readers) that eliminates thundering herds and drops cancelled read payloads/custody immediately outside the lock with zero stale queue IDs.platform/event-log): fast-pathRootOwner::validate_currenton Unix viaF_GETPATH//proc/self/fd+lstat+preadand exposeEventLog::root_owner_ref.plugins/agent/state): replace the globalDomain::driversmutex held across SQLite I/O with per-RunRunSlotbacked bytokio::sync::RwLock<Weak<Ticket>>so takeover awaits lock acquisition before atomically replacing and retiring the prior claim..cargo/config.toml,platform/event-log,plugins/agent/state): disableSQLITE_DEFAULT_MEMSTATUS=0at compile time for bundled SQLite, reuseprepare_cachedon hot read paths (diagnostics,recall,session_history), and defer Recall FTS5 indexing to transaction end inadmit/append(afterdeliver_held) to avoid implicit per-fact savepointfts5IndexFlush.Opt-in Hell-Tier Host stress suite
products/maka/cli/tests/mainline_reopen/host_hell_stress.rs(#[ignore], Scenarios H–L):SIGKILL+ 160 sessions + concurrent fresh-workspace creation & forks100/100active runs, 160/160idle,fresh_plus_fork=25/25, SQLite integrity OK, 0 orphansagent/stopsabotaged, 60 80-chunk streams) + 32 UI clientslistp50 11ms / p95 120ms,historyp50 69ms,searchp50 6ms,ui_errs=0,host.stderr.log0 ERRORs, FDs57→57editQueue118.9ms → 125.2ms(1.05× flat), bghistoryp50 7ms /searchp50 2ms, FDs57→574×80-wayJS +2×40-wayPy + 40 memory/CPU bombs + 32 PTY/pipe + 32 canaries)archive:readback verified, peak RSS2844.8 → 566.8 MiB, 0 orphansrequested=truemid-run stops), 16 Goals, 16 ScheduledTasks (32 fires), 440 memory opsgoals=16/16verified viaagent/goal,listp50 7ms, RSSW3 498.3 → W10 478.7 MiB, WAL flat20.7 MiB, FDs57→57Local database migration (optional)
FrozenNotificationnow requires a top-levelthroughfield (withknowledgeoptional on new steps). Sessions without Cell notifications (notifications: []) are unaffected.If you have an existing local
runtime-rust.sqlitecontaining pre-PR Cell notification steps that you want to keep continuing, stop Maka and run the migration script once:The script backfills
notice["through"] = notice["knowledge"]["through"]while keeping each historical notice'sknowledgeintact for exact replay, updates dependentFrozenRecovery,PrefixProof,ItemContinuation,RequestSpec,RecordedFact,ContextCompacted,agent_attempts,agent_steps.body,agent_runs.baseline,agent_session_history.prefix_digest, andagent_recall_heads.digest, prunes stale pins, and nominates replaced blobs inpending_content_releases.Verification
codex/gpt-6.2-astrareview (merge approved on09e4498dd).cargo test -p maka-event-log(45/45, incl.bundled_sqlite_disables_memstatus,cancelled_queued_read_drops_payload_and_skips_execution,validate_current_fences_marker_tampering_and_parent_rebind,concurrent_fresh_workspace_creation_converges_on_single_project)cargo test -p maka-agent-state(55/55, incl.distinct_runs_do_not_block_and_takeover_fences_prior_claim,cancelled_contested_takeover_preserves_prior_claim)cargo test -p maka-js-runtime(34/34, incl.array_buffer_budget_enforces_direct_single_and_cumulative_bounds,array_buffer_allocations_are_bounded_by_heap_limit,pure_and_scoped_plugins_enforce_off_heap_budget_and_disable_wasm)cargo test -p maka-agent-engine(32/32)cargo test -p maka-agent-native --lib(stopped_run_rejects_cell_child_admission_without_poisoning_cleanup,model_recovery::compaction3/3,tool_history13/13)--release -p maka-cli --test mainline_reopen -- --ignored --nocapture --test-threads=1): Scenarios H, I, J, K, L all green.cargo clippy --no-deps(0 warnings across touched crates),rustfmt --edition 2024 --check,git diff --check,node scripts/asf-license-headers.mjs check.migrate_frozen_notifications.pyend-to-end against a fresh SQLite DB with allevent-logandagent-statemigrations applied (--dry-run, migration,prefix_digest+agent_recall_headsverification,PRAGMA integrity_check,PRAGMA foreign_key_check, and idempotent re-run).