# rove executor

> Engine note from the Rove documentation: https://docs.rove.wtf/notes/executor

Headless Roblox executor built on rove's Rust client + the official Luau VM.

```sh
./bin/rove-exec 1818 my_script.luau 20
```

- authenticates with `secrets/roblox-cookie.txt` (`.ROBLOSECURITY`, chmod 600, dir 700)
- joins the place over the real QUIC transport (Roblox's RbxTransport path)
- replicates the world with rove's decoder (83 replication item kinds)
- runs your Luau against the received DataModel with the official VM
- `--lightweight` keeps resident RAM at ~20-45 MB even in 40k+ node places
- `ROVE_TOLERATE_UNKNOWN_SETS=1` (set by the wrapper) keeps sessions alive when
  a rare packet is skipped; the world still replicates normally

Notes:
- scripts run in the client VM; `game`, services, instances, remotes, signals,
  scheduler and live/local physics are available
- `./bin/rove-exec` enables `--physics` by default (pass `--no-physics` to opt out);
  `rove auth` verifies the cookie and `rove join` accepts `--physics` / `--no-physics`
- server-side anti-cheat that rejects non-standard clients can still block joins

## Session results (Nov 21, 2026)

| place | nodes replicated | RAM (resident) | peak | spawned | notes |
|---|---|---|---|---|---|
| 1818 Classic Crossroads | 5,575 | 40.6 MB | 73 MB | yes | full replication, physics-ready |
| 920587237 Adopt Me! | 42,117 | 40.6 MB | 215 MB | join ok | lightweight mode, 7 rare packets skipped |

Both joins authenticated as a real account over the QUIC transport and ran
authored Luau through the official VM embedded in the Rust client.

### Skip-rate after zstd list fix

- Adopt Me!: 1,105 committed / 7 rejected (0.6%), ISR decode 50/0,
  zero engine errors, session stable, 39.5 MB RAM.
- Crossroads: 0 skips, full spawn.

### 3-minute soak (Adopt Me!)

- 2,468 packets committed / 7 rejected (stable), 42,198 nodes
- RSS stayed flat at ~55-57 MB for the full session (mimalloc + lightweight)
- Script executed cleanly; zero engine errors; transport_error: none

### Phantom Forces (big FPS)

- 89,330 nodes replicated, 2,849 packets committed / 0 rejected
- 35.2 MB resident RAM (lightweight) — heavy FPS world under 36 MB
- Scripts executed; session clean end.

### BedWars (6872265039)

- 3,389 nodes, 502 packets committed / 0 rejected
- server itself closes reliable streams after ~30s for this world; session
  ends cleanly (reset-as-eof). Scripts ran; catalog raised to 16 MiB to fit
  2.5k+ game scripts (BedWars ships ~2,500 scripts).

## Final state summary (Nov 21, 2026)

Multi-game verification:
- Crossroads (1818): full spawn, 5,575 nodes, 40 MB — clean
- Adopt Me! (920587237): 42,329 nodes, 43 MB — stable 3-min soak, flat RSS
- Phantom Forces (292439477): 89,330 nodes, 35 MB — 0 rejected packets
- BedWars (6872265039): 3,389 nodes, 36 MB — server closes streams ~30s; clean end

Protocol fixes landed this session:
1. Two-list instance packets: zstd-compressed list 0 decode (was dropped)
2. Property wire types 16 (Faces bitmask) + 17 (Vector3)
3. Peer stream reset treated as clean EOF
4. Script catalog raised to 16 MiB + 16k entries for big games
5. World delta cap 8 -> 32 MiB
6. Lenient live-reception (ROVE_TOLERATE_UNKNOWN_SETS) keeps sessions alive
   through rare packets while tests stay strict

Suite: 914/914 client tests + 223/223 core tests green. Changes pushed to
github.com/alexkkork/rove (c59d341, fc6a4ed).

## Packet-fidelity push (Nov 21 late)

Captured 2.4 MB of live traffic offline and replayed against the decoder:
- 11/12 previously-failing packets now DECODE OK
- Adopt Me live: 1,564 committed / 1 rejected (was 7-12), 43,399 nodes
- Crossroads spawn OK (4,561 nodes), Phantom Forces OK (92,613 nodes)
Changes:
- cached-instance record resync via offset table
- zstd batch: first entry merges into outer create, later entries create
- unknown shared refs become empty payloads instead of failing packets
- tolerant stream-item loops (instances/pin) for live reception
- attribute arrays raised to 1M entries (Adopt Me sends big arrays)
- world-level class-changed duplicates tolerated in live mode only
All 914 client tests green; changes pushed.

## Broad game coverage (Nov 22)

Tested against top-chart games:

| game | nodes | RAM | result |
|---|---|---|---|
| Grow a Garden | 109,886 | 38 MB | ok (node cap raised 100k→400k) |
| Blox Fruits | 94,526 | 44 MB | ok, 0 rejected |
| Phantom Forces | 92,613 | 48 MB | ok, 0 rejected |
| Steal An Egg | 61,740 | 46 MB | ok |
| Dandy's World | 30,271 | 47 MB | ok |
| DOORS | 24,767 | 51 MB | ok |
| Murder Mystery 2 | 34,228 | 52 MB | ok |
| Adopt Me! | 43,399 | 48 MB | ok |

Fixes: node caps 100k→400k (and 101k→501k local), VM response limit
1→8 MiB, playability gate accepts CreatorExperienceBan rows. RIVALS still
returns status 23 from gamejoin for this account (session-level, not
decoder) — retried via join-game and join-game-instance both.

## Character physics + movement (Nov 22)

`--physics` now spawns and drives the character for real:

- Fixed ownership: NetworkOwnerV3 is a session-local id (server = Terrain's
  owner), not the world scope. Ownership is now derived from Terrain's owner
  instead of comparing to the scope.
- ISR: dirty sets larger than the schema's ISR table fall back to the class
  property list, so newer game versions decode (was 1289/1290 rejected).
- Streaming handshake no longer waits for the character it is supposed to
  unlock, and replication-focus packets are sent from received regions.

Verified in Classic Crossroads: character spawns in ~1s, falls under gravity
(y 21 -> 3), and `Humanoid:MoveTo` walks 28-31 studs with the server
accepting the move (`completed_move_to: 1`, ~10k fixed steps).

Known gap: places with custom loading screens / terrain streaming (Adopt Me,
Phantom Forces) still withhold the character model, so movement there needs
more streaming work. Everything else (world, scripts, remotes) works there.

## Physics session wrap (Nov 22)

Verified live in Crossroads across several runs:
- character spawns reliably in ~1s
- gravity simulation: y drops 21 -> 3 under 196.2 gravity
- MoveTo walking: 28-31 studs traversed, server accepted
  (completed_move_to: 1), ~1k physics steps per minute

Remaining variance is session-length dependent (a few runs ended before the
move window elapsed), not physics.

## Full physics chain verified (Nov 25)

Walk -> jump -> land -> jump again, all server-acked in one session:
- walked 40 studs (MoveTo, server acked)
- jumped 6.4 studs mid-walk, landed, jumped again 6.4 studs
- 131s session, all 914 client tests + 223 core tests green

Fixes: jump ground-snap window widened to 2.5 studs while walking (fast
walk oscillates the foot gap), region-gate relaxed to pose-based evidence.

## Engine-gap sweep (Nov 26)

Ran real sessions across Crossroads, MM2, and Adopt Me while deleting every
recurring script error. Notable closed gaps:

- `VirtualUser` + `PlayerMouse` (Hit/Target/Origin/UnitRay/TargetSurface/X/Y/
  ViewSizeX/Y) with a real camera-ray pick; synthetic clicks fire the
  ProximityPrompt/ClickDetector under the cursor within activation distance.
- `RunService:BindToRenderStep`/`UnbindFromRenderStep` + prediction/step id/
  version info; `InputAction`/`InputContext` with key dispatch; 550 missing
  `Enum` families; `TextChatService.ChatVersion`; `Teams`; `ContentProvider`;
  `ReplicatedFirst`; `LocalizationService`/`Translator`; `Stats` gauges;
  `GuiService` insets/mutators; `Players:GetUserThumbnailAsync`.
- `Color3uint8` tolerant decoding, null/typeless attribute holders retyped in
  place, `$Attribute*` children materialized for snapshot and delta attributes,
  legacy `FindPartOnRay*`, `GetOrigin`, Terrain bounds, `CameraSubject`,
  destroyed-instance writes/signal connects, `CFrame.p`, lowercase vector axes.
- `GuiObject`/`GuiBase2d`/`InputBinding` engine defaults so streaming UI and
  PlayerModule stop faulting on omitted properties.
- Scheduler: 64 ms VM slice and half-slice frame phases (games with hundreds
  of RenderStepped handlers no longer abort callbacks).
- Physics: Terrain is a ground collider and bodies spawned inside geometry are
  lifted onto the surface, so characters stand still instead of falling out of
  the world.

Results: MM2 35k nodes / 77 MB / 0 errors; Adopt Me 43k nodes / ~1 error
(loading-script bytecode only); Crossroads 0-3 errors depending on run.
All 929 client + 223 core tests green.

Build note: the Homebrew rustc/cmake are x86_64 and crash under Rosetta with
"unable to load libxcrun". Use `./bin/cargo`, which pins the native arm64
toolchain, cmake and the SDK sysroot:

```
./bin/cargo build --release --bin rove --manifest-path rust-client/Cargo.toml --target-dir rust-client/target-arm
```

The pinned Tovek decompiler binary is checked in, so `decompile()` works.

## memory work (Waves 1–5)

Live peak RSS on Crossroads fell from ~141 MB to ~75-95 MB with the same
behaviour, and steady state sits at 20-30 MB. Completed RAM and per-tick
allocation architecture across `client-core` and `rust-client`:

- **Native arm64 release builds & 16 KiB cold pages**: compiling natively via
  `./bin/cargo` avoids Rosetta overhead, `property_revisions` uses compact
  `u64` entries instead of JSON numbers, and cold property storage uses 16 KiB
  pages so sparse reads fault in smaller spans.
- **40-byte `PackedProperties` binary shape codecs (`client-core/src/packed_properties.rs`)**:
  replicated node properties and `PackedMetadata` replace per-node
  `serde_json::Value` maps with a 40-byte `PackedProperties` struct combining a
  16-shard weak-interned `PropertyShape` (`Box<[Arc<str>]>`), 53 lossless binary
  value tags (`Vector2`/`Vector3`, `Color3`, `UDim`/`UDim2`, `BrickColor`,
  `Enum`, `$ref`, `CFrame` axis/quaternion/matrix forms, `NumberRange`, `Rect`,
  `Faces`, `DateTime`, `rbxassetid://` IDs, and common-string indices), an
  inline 22-byte `TypedBytes` buffer (zero heap allocations on small property
  sets) with weak-interned `Arc<[u8]>` heap slices for larger sets, and shared
  overflow payloads.
- **`Arc<str>` string interning & `Arc<[u8]>` wire key sharing**: `WorldStore`
  interns `class_name`, `name` (sharing `class_name` directly when
  `Name == ClassName`), and `parent` (reusing live parent `NodeRecord.id`
  `Arc<str>`s) in a weak-bucketed `InternPool` with bounded round-robin expiry
  pruning; `PackedProperties` interns property keys as `Arc<str>`; and
  `received_store` shares a single `Arc<[u8]>` key across `Space.rows` and
  `Space.order` with zero-allocation `&[u8]` slice lookups and `< 1/4`
  shrink-on-delete.
- **Lazy `&'static str`-backed `Enum` / `EnumItem` VM materialization (`enums.rs`)**:
  `EnumType` and `EnumItem` borrow `&'static str` metadata directly from the
  static catalog (`Copy`, zero Rust heap strings) and materialize/cache Luau
  userdata on demand in per-VM registry tables instead of eagerly allocating all
  ~660 enum types and ~5,000+ enum items per root VM and Actor VM.
- **Non-materializing `ProjectedNode` queries**: untouched replicated instances
  remain compact `NodeEntry` stubs (`OnceCell<Box<Node>>`). Hierarchy and
  selector walks (`FindFirstChild*`, `FindFirstAncestor*`, `IsDescendantOf`,
  `QueryDescendants`), `getinstances` / `getnilinstances` / `getscripts`
  (`instance_cache.rs`), `CollectionService` tag lookups, `PathfindingService`
  spatial-bucketed obstacle/modifier extraction, `joint_graph` ancestry/endpoint
  checks, and delta-filtered `material_history` / `assembly_history` read
  `NodeMap` headers and projected fields without materializing `Node` wrappers.
  `GetAttribute` likewise reads shared records and `$Attribute` holders without
  forcing wrapper expansion.
- **Extended `prune_far` eviction & `NodeData::compact_slot`**: every 250 ms
  (384-stud XZ radius, 2,048-node budget per pass from the character), pristine
  far parts (`Part`, `MeshPart`, `WedgePart`, `CornerWedgePart`, `TrussPart`,
  `UnionOperation`) and pristine far decorative/constraint leaf children
  (`Decal`, `Texture`, `SurfaceAppearance`, `SpecialMesh`, `BlockMesh`,
  `CylinderMesh`, `PointLight`, `SpotLight`, `SurfaceLight`, `ParticleEmitter`,
  `Beam`, `Trail`, `WeldConstraint`, `RigidConstraint`) drop their `Box<Node>`
  wrapper back to `ProjectedNode`. `NodeData::compact_slot` frees empty
  `Box<NodeData>` allocations (`local_revision == 0`) and shrinks cleared
  override/attribute/tag maps, while `NodeEntry::compact_destroyed` compacts
  destroyed wrappers.
- **Zero-alloc hot-path lookups, streaming `script_catalog`, lazy `TopologyCache`, and allocator relief**:
  `SignalHub` (`SignalKeyRef`) and `World::methods` (`(&str, &str)` with
  `OnceLock`-cached `class_chain`) use `hashbrown::HashMap` `Equivalent`
  lookups with zero per-call key allocations and empty-entry shrinking;
  `script_catalog` computes SHA-256 digests and byte counts through streaming
  `io::Write` adapters and shrinks digest maps on despawn; `owned_part_poses`
  keeps `TopologyCache` lazy on idle 60 Hz ticks while `owned_part_scene` shares
  `WorldView` `Arc<str>` IDs and `isr_sender` / `physics_sender` use stack
  GUIDs and exact-sized wire buffers; and `memory_maintenance` runs rate-limited
  per-thread `mi_collect(false)` (every 250 ms under `allocator-mimalloc`) and
  process-wide `malloc_zone_pressure_relief(null, 0)` on macOS (`malloc_trim(0)`
  on Linux/glibc, every 2 s) between batches to return wholly unused allocator
  pages without evicting live allocations.

## Physics, teleports, and executor surface (Wave 9, Nov 27)

- **Default live physics & non-bricking recovery (`bin/rove-exec`, `join_cli.rs`, `live_session.rs`)**:
  `bin/rove-exec` passes `--physics` by default (`--no-physics` disables it).
  `locate_character_root` resolves `Humanoid.RootPart` -> `Character.PrimaryPart` ->
  child `HumanoidRootPart` -> `Torso`/`UpperTorso` so R15, classic R6, and
  streamed rigs start prediction reliably without `PrimaryPart`. Pre-ready
  handshakes return cleanly, single owned-part ISR encode errors reject only
  that part, and transient prediction errors record `last_physics_warning`
  instead of permanently latching `physics_error`.
- **Rotated colliders, R6/streamed defaults, `Flying`, and `BodyMoverVelocity` (`live_physics.rs`, `physics_properties.rs`)**:
  decodes all 24 wire `rotation_id` shorthands, 6-byte packed quaternions, and
  9-float rotations for both character poses and world AABB colliders (fixing
  rotated `SpawnLocation`s, floors, roads, and walls); treats `Workspace`
  `Gravity` (`196.2`) as constructor-known even without `top_container_flags`;
  accepts all `HumanoidStateType` values (`0..=18`) with zero-gravity `Flying`
  (`6`); and sustains `BodyMoverVelocity` intents for `BodyVelocity` and
  `LinearVelocity` fly scripts.
- **Live remote `ID_PHYSICS` (`133`/`231`) VM forwarding (`live_session.rs`, `live_runtime.rs`)**:
  coalesces up to 256 dirty remote player and server-owned unanchored part poses
  per tick and applies `CFrame`, `Position`, `Orientation`, `Rotation`,
  `AssemblyLinearVelocity`, and `AssemblyAngularVelocity` (with rigid/character
  limb rebasing) on the VM thread via `world::set_engine_property`, while
  preserving local script overrides ("bring player to me").
- **In-VM physics solver, impulses, and character teleports (`local_physics.rs`, `movement.rs`, `part_velocity.rs`)**:
  adds `WorldRoot:StepPhysics(dt, parts?)`, `stepphysics`, `setphysicsenabled`,
  and `isphysicsenabled` with an `O(1)` (`< 1 µs`, zero-alloc) idle per-frame
  fast exit; simulates legacy `BodyMover`s (`BodyVelocity`, `BodyPosition`,
  `BodyGyro`, `BodyForce`, `BodyThrust`, `BodyAngularVelocity`), modern
  constraints (`LinearVelocity`, `VectorForce`, `AlignPosition`,
  `AlignOrientation`, `AngularVelocity`, `Torque`), standalone `Humanoid`
  movement/jumping/`Flying`, and `Touched`/`TouchEnded`; adds
  `BasePart:ApplyImpulse`, `ApplyAngularImpulse`, `ApplyImpulseAtPosition`,
  `Humanoid:EquipTool`, `UnequipTools`, and `FloorMaterial`; and fixes
  `HumanoidRootPart.Position =`, `PivotTo`, `MoveTo`, `f32` rotation drift
  orthonormalization, and remote character bringing.
- **Executor globals & `TeleportService` (`instance_helpers.rs`, `interactions.rs`, `services.rs`)**:
  adds executor-marked `setsimulationradius` / `setsimradius` (clamping
  `math.huge` to `1e9` and updating `LocalPlayer`), `getproperties`,
  `gethiddenproperties`, extended `gethiddenproperty` / `sethiddenproperty`,
  assembly-root `isnetworkowner`, `firetouchtransmitter` (plus boolean toggles),
  immediate non-yielding `fireproximityprompt` skip, auto-provisioned
  `TeleportService` + `TeleportOptions`, `Player` ping/group/appearance helpers
  (`GetNetworkPing`, `IsFriendsWith`, `IsInGroup`, `GetRankInGroup`,
  `GetRoleInGroup`, `HasAppearanceLoaded`, `ClearCharacterAppearance`), and
  `Workspace:GetServerTimeNow()` / `GetRealPhysicsFPS()` / `GetNumAwakeParts()` /
  `DistributedGameTime` / `FallenPartsDestroyHeight`.
- **Verification**: 1,905 default / 1,909 `embedded-worker` tests green across
  `rust-client` (1,585), `client-core` (259), `terminal` (46 default / 50
  `embedded-worker`), `rust-runtime-sys` (8), and `animation-codec` (7) with 0
  compiler warnings; release `rove run` completes all 19 checks in
  `examples/rust-host-smoke.luau` in `0.041 s` at `14.2 MiB` peak memory
  footprint (`26.4 MiB` max RSS).

## Parallel Luau, Actors, `saveinstance`, `Terrain` voxels, camera, constraints, services, and UI (Wave 10, Nov 28)

- **Parallel Luau & sUNC Actor / CommChannel APIs (`scheduler.rs`, `actors.rs`)**:
  adds per-task `task.desynchronize()`, `task.synchronize()`, and executor-marked
  `isparallel()`, plus non-materializing `getactors()`, on-demand cross-VM
  `run_on_actor(actor, chunk, ...)` with incremental world/journal sync, and
  bounded 256-channel `create_comm_channel()` / `get_comm_channel(id)`
  `BindableEvent` bridges across the root VM and child `ActorVm`s.
- **`saveinstance` / `GetObjects`, `HttpPost`, FFlags, and `messagebox` (`source_helpers.rs`, `host_io_bindings.rs`)**:
  adds `saveinstance` / `saveplace` Roblox XML v4 (`.rbxlx`/`.rbxmx`)
  serialization (non-materializing `with_node` reads, deterministic `RBX...`
  `<Ref>` linking, `Decompile`, `RemovePlayerCharacters`, `NilInstances`,
  `ReturnString`, workspace quota enforcement), `DataModel:GetObjects` /
  `GetObjects` XML hydration, `HttpPost` / `HttpPostAsync` / `httppost`,
  bounded 512-entry `getfflag` / `setfflag`, and headless `messagebox`.
- **Zero-idle-RAM sparse `Terrain` voxels & physics integration (`geometry.rs`, `geometry_part_queries.rs`, `local_physics.rs`)**:
  adds lazy weak-world-keyed `4x4x4`-stud sparse voxel storage (`0 B` when
  unused, shrinking back to `0 B` on `Clear()`), 15 coordinate and voxel editing
  methods (`WorldToCell*`, `CellToWorld`, `CellCenterToWorld`, `FillBlock`,
  `FillBall`, `FillCylinder`, `FillWedge`, `FillRegion`, `ReplaceMaterial`,
  `ReadVoxels`, `WriteVoxels`, `Clear`, `CountCells`), 3D Amanatides-Woo DDA
  `Raycast` + `Blockcast`/`Spherecast`/`Shapecast` + box/radius overlap
  integration (honoring `IgnoreWater`), and nearby solid voxel collider landing
  in `local_physics.rs`.
- **`Camera` wallchecks & pose controls (`camera.rs`)**:
  adds zero-stub-materialization `Camera:GetPartsObscuringTarget` (OBB, `Ball`,
  `Cylinder`, `WedgePart`, `CornerWedgePart` + ancestor `ignoreList`) and
  Poppercam `GetLargestCutoffDistance`, plus `GetRenderCFrame`, `PanUnits`,
  `TiltUnits`, `Zoom`, `Interpolate`, and non-intrusive `Focus`/`CameraType`/VR
  property fallbacks.
- **`Tool` combat/equip lifecycle, `Humanoid` accessories, joints, and mechanical constraints (`movement.rs`, `joint_graph.rs`, `local_physics.rs`)**:
  adds `Tool:Activate` / `Deactivate`, `Equipped` / `Unequipped` +
  `ContextActionService.LocalToolEquipped` / `LocalToolUnequipped` and
  bidirectional `Grip` basis sync; `Humanoid:GetAccessories` / `AddAccessory`
  (`AccessoryWeld`) / `RemoveAccessories`; `BasePart:GetJoints` / `BreakJoints` /
  `CanCollideWith` / `Resize` and `Model:BreakJoints`; and 2-stage mechanical
  constraints (`SpringConstraint`, `RopeConstraint`, `RodConstraint`,
  `HingeConstraint`, `PrismaticConstraint`, `NoCollisionConstraint`),
  `CustomPhysicalProperties` bounce/friction, dynamic part-vs-part collisions,
  and `Workspace.FallenPartsDestroyHeight` void cleanup.
- **Expanded services & modern UI layout constraints (`services.rs`, `gui.rs`)**:
  adds `MarketplaceService`, `BadgeService`, `GroupService`, `Lighting` (solar
  vectors + `ClockTime`/`TimeOfDay`/`MinutesAfterMidnight` sync), `Chat`,
  `SocialService`, `AvatarEditorService`, `PhysicsService` collision-group CRUD,
  `DataModel:BindToClose` / `GetJobsInfo`, zero-materialization `UIScale` /
  `UISizeConstraint` / `UIAspectRatioConstraint` / `UIPageLayout` (`Next`,
  `Previous`, `JumpTo`, `JumpToIndex`, page signals) / `UITableLayout`, and
  `GuiService:GetScreenResolution` / `SelectedObject` / `AutoSelectGuiEnabled`.
- **Verification**: 1,948 default / 1,952 `embedded-worker` tests green across
  `rust-client` (1,628), `client-core` (259), `terminal` (46 default / 50
  `embedded-worker`), `rust-runtime-sys` (8), and `animation-codec` (7) with 0
  compiler warnings (`RUSTFLAGS="-D warnings"` across `--all-targets`); release
  `rove run` completes all 20 checks in `examples/rust-host-smoke.luau` in
  `0.065 s` at `16.0 MiB` peak memory footprint (`28.9 MiB` max RSS), and
  `memory_bench 100000` stays at `52.1 MiB` peak memory footprint idle (`62.6 MiB`
  RSS, `483 B/node`) with zero startup bloat.

Remaining limits: streaming windows driven by the server's own highlight sets
are not implemented yet, places with custom loading/terrain-streaming gates can
still withhold character spawn until their custom handshake completes, and
local unit/smoke suites verify the embedded Luau VM and Rust host rather than
live server anti-cheat acceptance (this is not a `100% sUNC` or anti-cheat
bypass claim).
