Rung 16's place was at(ROUTE_25), so inside Bill's house GO OBJECTIVE and GO OUT were both the
door: the live Route 25 <-> Bill's house ring. It is now errand(BILLS_HOUSE): the room's people
first, then its things, where the things include the cartridge's own hidden events, read from
HiddenEventMaps/HiddenEventPointers ($11:$6A40/$6A96, pinned from CheckForHiddenEvent's operands
and shape-checked on every read). A hidden event is only ever the errand's next step: GO ITEM,
GO NPC and TALK elsewhere are unchanged. One with a SPRITE_FACING argument (Bill's PC) is
approached and faced from that side only.
Cerulean is split a third time: the town's ground ends at row 28, and Route 5 and Route 9 are on
the ground behind the trashed house ($3e), in by its front door and out by the hole in its back
wall. The house is on the map graph, so the objective toward rung 17 walks through it.
ROM tests from the scout checkpoints (door ring, PC step, live row-71 Route 25, Cerulean
south-half and trashed house) fail on main and pass here. No button, readout, catalog or adapter
change; the compatibility string is unchanged.
Both tests passed vacuously until the Viridian stall checkpoint was mapped. GO SHOP is dealt for
a service need since rows 62/66 and the parcel errand is GO OBJECTIVE's, so the Viridian
checkpoint (parcel in the bag) rightly has no GO SHOP. In the GO HEAL test the first hold was the
rotation's GO OBJECTIVE, which walked to Oak's lab and left the area.
state::shop reports the buy and sell lists' cursor as row plus
wListScrollOffset, only while the list is on screen. MART_CURSOR_ROWS
stays. The catch ROM test now asserts its ball sits in the bag window's
first rows, so it covers the unscrolled throw beside row 71's scrolled
one.
The battle bag is a DisplayListMenuID list: the arrow walks rows 0..2 and
the window scrolls under it. state::battle reported wCurrentMenuItem alone
as the bag cursor, so THROW BALL and ITEM could never reach a bag entry
past the third. Live on rung 15 a wild Oddish sat at low HP with the
Poke Ball fifth in the bag; row 69 left THROW BALL alone on the pad and
every start blocked.
The cursor is now wCurrentMenuItem + wListScrollOffset, the sum the
cartridge makes on A. wListScrollOffset ($CC36) is pinned from the operand
of DisplayListMenuIDLoop's read and checked by a ROM test. The ROM test
from the live trap checkpoint (FLY_ROW71_CHECKPOINT) blocks on main and
throws and catches on this branch.
CUT-01's speed probation fell back at a median realtime factor of 0.959.
With exactly as many cpus as sweep threads, the session's host threads
(dispatching tokio worker, coordinator, listeners) sleep and wake around
every transition, the sweep workers park and wake with them, and the
scheduler often stacks two workers on one cpu: the session's ticks ran
about 35% slower than the legacy loop's on the same frames (equal with a
spare cpu).
flybrain_core::pool::place_workers gives each spawned sweep worker a cpu
of its own and confines every other thread to the rest of the cpuset;
flysim-session calls it before spawning anything (in-process and thread
modes; FLY_SESSION_PIN=0 turns it off). Placement chooses cpus only, so
no result, trace or checkpoint changes; the legacy loop, process mode and
the shadow binary never call it. The compatibility string is unchanged.
On the release cpu model, 4 cpus, 4 threads, same frames: session 16.16
-> 12.98 ms/frame (legacy 10.53). The service's profile line prints the
measurement spans and the brain's phase split when FLY_SESSION_PROFILE is
set. Docs: legacy-gameboy-v1 section 12 amendment, implementation entry.
N5: after an operator reward pulse the shadow reads the rest of the trace for its stop line, which ends the window. N4: the relay treats a byte-cap stop exactly like a no-consumer stop. N3: end_window turns a pass back into running and clears passedAt and reason. N2: the runbook says plainly that a long outage costs the run and gives the command to start a new one.
A stopped trace (no consumer, byte cap) is no longer an allowed skip: the shadow drops the brain time and saves compared before it, so a restarted box shadow that replays a stopped trace cannot count pre-gap time. The relay closes coverageLost only when the verdict's window.lastStopTrace is the lost trace or later, persists coverageLost (fsync) before forwarding the stop, and check refuses a verdict without a window. Runbook: a mid-run relay restart costs the run.
B1: after an outage of more than ten minutes flysim stops its trace for want of a
consumer and the live fly runs untraced. When the link heals the relay reported healthy
and, counted in trace lines, the box's lag fell under the catch-up bound before its
shadow reached the stop, so `check` could pass for about a minute. The relay now scans
the trace bytes it forwards for that stop and sets a sticky coverageLost in relay.json
(kept across a relay restart of the run; cleared only by a new shadow window, which
takes the stop as history) and reports itself not healthy. `check` refuses on
coverageLost, on a live trace not written for 90 s, and on a run id that is not the
drop-in's (also for a verdict that carries one without a remote drop-in).
Notes: the divergence files the box may send are bounded (after a diverged verdict, at
most three, capped in size); the saves queue holds twelve minutes and the relay unit
gets 1G; fly-shadow-remote-setup keeps authorized_keys in a root-owned home apart from
the mirror, never follows a symlink there as root and requires --from; the runbook
documents the clock-skew refusal, the recovered-stop rule and the first-hour RTF watch.
Also: the ingest lists the mirror's traces under its ledger lock (a file created between
the listing and the lock was marked finished).
A save is pending from the moment the relay reads it until the box's byte
count shows it arrived; a new connection sends again every pending save the
box does not hold, before any trace. In the two-box rehearsal an 11-minute
stall that ended in a broken connection lost the saves queued on it.
A writer thread owns the ssh pipe. The relay keeps ticking through a stall,
reports itself unhealthy and stops the heartbeat; new saves are still read the
moment they appear and held in memory (256 MiB, about 8 minutes of hot saves:
the container keeps a hot save about ten seconds, and a 3-minute stall in the
two-box rehearsal lost 33 of them); trace bytes wait on disk (16 MiB queued at
most), and a newer trace file and the journal wait until every older file is
complete on its way. A reconnect resends what the box does not hold.
The on-container shadow cost the live fly real time (RTF 0.9998 -> 0.93-0.98,
27 ms/frame on shared CPUs, falling behind every hour). fly-shadow gains:
- relay (release container, as flyshadow.service): streams new saves, the
trace bytes of this run and the sugar journal over one ssh connection;
writes the box shadow's verdict back (runId-bound, lagTransitions plus the
unsynced tail, a relay member) and keeps flysim's consumer heartbeat fresh
only while connected, the box shadow of this run is alive and the box has
everything that was on disk a minute ago; exits 3 on a remote divergence.
- ingest (build box, the relay key's forced command): checks the release
directory and binary hashes against its own, resets the mirror for a new
run, writes the mirror and reports acks, liveness, verdict, divergence.
- run --run-id-file: the verdict carries runId; a new id exits 4.
- coverage: a no-consumer trace stop while following is a coverage
divergence (a stop that predates the shadow stays a trace-cap skip); the
journal is read before the trace directory is listed.
tests/shadow_remote.rs runs a real flysim, the relay, the real ingest binary
and a remote shadow through a restart, a remote shadow death and a sync
stall (coverage divergence relayed back).
infra: fly-shadow-run start runs remote with /etc/fly/shadow-remote.env
(a flyshadow.service drop-in running the relay; --local keeps the old
placement), check also needs relay.json healthy; infra/box/ holds the build
box's flyshadow-remote.service/.path and fly-shadow-remote-setup (release at
the same path, root-owned restrict,command= authorized_keys); 02-base adds
openssh-client. Runbook, lint and a dated legacy-gameboy-v1 section 18
amendment.
The compared count and the status are recomputed on different verdict
writes; on a loaded box the v0.7.1 release gate read the new count with
the status still 'running'. Bounded wait (120 s); assertions unchanged.
EnemySendOut opens the party list with BATTLE_PARTY_MENU when the fly answers YES to
"Will <mon> change POKeMON?", the value ChooseNextMon uses after a faint. Read as a forced
switch its pad was SWITCH, NEXT with no B: live in Mt. Moon after the first catch, NEXT on the
Pokemon already out for 58 brain minutes. A forced switch now also needs the active battler at
0 HP; the offer's pad is the party list's SWITCH and BACK.
Unit tests for both lists; ROM tests from the live trap (FLY_ROW70_CHECKPOINT) and from a real
forced switch after a faint (FLY_ROW70_FORCED_CHECKPOINT); macros.md 12.33, macros-traps row 70.
Conflicts: deploy/build/package scripts (flysim-session, fly-shadow and fly-session all
built, packaged and given cpuset drop-ins; fly-runtime and fly-shadow-run both converged),
fly-legacy-session Cargo.toml and lib.rs (service and shadow both kept, tokio gains signal),
runbook and implementation guide (both sections kept).
Conflicts in fly-legacy-session task.rs (feed record next to PERF-01 profile spans) and
fly-session coordinator.rs (media_bytes doc, read_agent_extension and trim_records kept
alongside PERF-01 spans, publish span and publish metric both kept).
tests/shadow.rs failed with 'one trace file per process' (0 vs 2) on a
build box because it ran a flysim binary that was not built from the
tree under test: cargo test -p fly-legacy-session does not build
flysim's binary, and the box's bx target directory was shared by name
with other trees, so the binary beside the test predated FLY_TRACE_DIR
and wrote no trace. Reproduced by running that test binary against its
stale flysim; not a timing or segment-handling bug. The test now builds
the flysim binary itself (cargo build -p flysim --bin flysim, same
target directory and profile), proved on a target another tree had
populated.
Production could miss a whole process the same way (a trace that
cannot be created, a failed consumer check), so the shadow now holds
every flysim boot header in the live sugar journal since it started to
a trace file created during that boot; an untraced process is a
coverage divergence and fails the verdict. In FLY_TRACE_DIR mode a trace
that cannot be created no longer stops flysim from starting (it runs
untraced and the shadow fails), and a heartbeat dated ahead of the
clock counts as fresh. The test adds an untraced third process and
expects the coverage divergence.
The live checkpoints the boot parity starts from are pokered-unique8-v7 files;
since row 68 (v8) a boot takes them only with FLY_ACCEPT_ADAPTERS, as the
v0.6.7 deploy sets it. The test sets the adapter's own MIGRATES_FROM when the
environment names none; both runtimes read the same list.
Review round 3, G1-a: the guard stops only when flyshadow's ActiveState is inactive or failed
(systemctl show), not while it is activating/auto-restart. check also requires the guard timer
active and baseline.json. allows_cutover refuses an updatedAt more than 60 s ahead of the clock.
Lint drives the guard and check with a fake systemctl; a real systemd 257 user manager run is
kept in the review notes.
The admission race test (TASK-01 R2-3) spawned its hammer before the first
iteration set the queue up; on a loaded build box the hammer could admit into
the empty initial queue, which is a legitimate admission, and fail the test.
- worker: local_lane_carries is every method but Worker.*, so an endpoint's
read-only extension (SERVE-01's Legacy.FeedStatus) no longer crosses the bus.
- ipc-v1 section 1, bus-v1 section 12, step-v1 and the framework README: the
in-process local lane and in-memory artifacts, dated 2026-09-30.
- flybrain-core: LifNetwork::tick_spikes, the last CPU tick's spike list
(None under the GPU backend); a test proves it is exactly the neurons the
tick stamped and that window unions equal the last_spike_ms scan.
- legacy agent: Prepare runs its ticks one at a time and ORs each tick's list
into the transition's bitset; Commit uses it instead of scanning 139,255
last-spike times (falls back to the scan when no list is kept).
- legacy composition: a service session publishes its committed snapshot
every 60th boundary (plus every boundary with events or boundary actions);
nothing in the release subscribes, and each publication seals copies of
the frame and the audio.
- coordinator: a single dispatch job is called in place; worker shell moves
the reply result instead of cloning it; publication promotions begin when
Advance answers whatever the cadence.
- profile: record() for a sample from another clock; finer spans (shell,
local lane, handlers, advance parse/build, the brain's phase clock).
The example composition's adapter and FLYSIM01 string move to v8 with the live
adapter, and the fixtures are regenerated by update_fixtures (composition digest
44916db0... -> d37ccb40...); invalid.json's hand-written cases follow, with the
one deliberately mismatched string moving from v6 to v7 so it is still the
previous adapter. Branches that carry these fixtures (the port stack) regenerate
them the same way on rebase.
The operator's decision of 2026-09-29, chosen over a pad rule that would have
withheld a stat move once used: pay the fly for the HP its own attack removes
from the Pokemon it is fighting, so the move that deals damage is worth more
than the one that does not. Row 67: the live fly lost the Pewter Gym's Jr.
Trainer 29 times running with TAIL WHIP 155, BUBBLE 23, TACKLE 0, and nothing in
the catalog paid for anything inside a battle it did not win.
`damage`, the twelfth kind, 80 ms. 0.20 per whole enemy Pokemon's max HP, paid
in proportion on the sample the HP drops; +0.05 when the fly's hit knocks out a
trainer's Pokemon; at most 0.50 a battle (the trainer rule's own value, which
two Pokemon reach exactly). A wild battle pays at the wild-KO rule's scale, 1,
1/2, 1/3, for its first three battles per (map, species, level) that paid any
damage, then nothing, and a rollback blocks every key that has paid
(damageCounts, replay-blocked damage:<key>). Trainer battles keep no lifetime
ledger: a trainer is fought again only after losing to it.
The fly's attack is a drop in wEnemyMonHP on a sample where hWhoseTurn ($FFF3,
counted from the hJoyLast anchor to the end of HRAM) reads 0 and wPlayerMoveNum
is not STRUGGLE. ApplyDamageToEnemyPokemon runs in ExecutePlayerMove with it 0;
the enemy's poison, burn and Leech Seed ticks (HandlePoisonBurnLeechSeed picks
the enemy's HP because it is 1), its recoil, confusion self-hit, Explosion and
Substitute all land with it 1. Every drop moves the target's mark, so a tick is
never paid later as part of a hit. A target is (wEnemyMonPartyPos, species,
level) and keeps its lowest HP for the battle, so a heal is never paid twice and
a switch back keeps its mark; it is marked when it first reads full HP, because
InitBattleVariables leaves the last battle's wEnemyMon in place -- in the row 67
ring that is the same trainer's Diglett at the HP it won with.
v7 -> v8. STATE_VERSION stays 4: damageCounts and battle.damage are optional and
absent in a v7 state, which restores with no wild key paid and a battle in flight
marked where it stands, so nothing lost before the restore is paid.
MIGRATES_FROM is [v7, v6]: the chain composes, since v7's own migration (the
item seed) still runs in this build on the first sample without items:seeded.
Feed: `damage` has no counter (RewardKind::from_adapter -> None). On `wildwin`
the stage would fold every hit into "N wild wins", false of a trainer battle and
of one the fly goes on to lose. A hit reaches the page as a reward event with
its own label, HIT #<species> FOR <n> HP[ KO]; the feed's closed kind set does
not move.
The compatibility string differs from main's in exactly one segment:
pokered-unique8-v7 -> pokered-unique8-v8.
Tests: the rule (fly's turn vs the enemy's, Struggle, heal, switch, twin slots,
stale enemy, restored battle, cap, knockout, wild scale, round trip); the adapter
(proportional pay, TAIL WHIP nothing, poison then hit, the ring's second battle,
wild scale and rollback, one read per address, checkpoint round trip, a v7 state
mid-battle); compat_migration (v7 and v6 FLYSIM01 envelopes refused without
their own opt-in and restored with it; the v7 one mid-battle pays only what
follows); rom_damage (FLY_ROW67_CHECKPOINT: the live v7 string and ledger
migrate; from the live state BUBBLE and TACKLE are paid on every drop they cause
and TAIL WHIP never, the fly's hits land with hWhoseTurn 0 and the enemy's with 1).
resolve_wram.py --emit resolved both from ram/wram.asm at the pinned commit,
each bracketed by pinned anchors (wWalkCounter/wEnemyMonSpecies and
wEnemyMonHP/wEnemyMonStatus): $cfd2 and $cfe8. 77 of 81 pinned addresses
re-derived, no disagreement. wEnemyMonPartyPos is battle_struct's third field
(macros/ram.asm: Species db, HP dw, PartyPos). gen_symbols.py's EXTRA_RAM
carries both so a regeneration keeps them.
LegacySession starts in-process participants with Via::Local
(FLY_SESSION_LOCAL_LANE=0 keeps the bus path, a measurement knob). speed_ab
takes FLY_PERF_ARMS (local, bus, process), FLY_PERF_SERVICE (the service
host's per-frame reads), FLY_PERF_WORKERS (1 or 2 Tokio workers) and prints
the legacy brain's own tick time beside the session's.
- worker: one Shell per worker serves its bus loop and a LocalLane. A local
request goes through the same admission (classification, body digest,
result cache, arrival-order ticket, endpoint lock) and answers the same
SessionRpcOutcome, without a bus message. Worker.* stays on the bus.
HandlerCtx::seal keeps a local request's reply media in memory.
- rpc: a WorkerRef carrying a lane sends endpoint methods over it; sealed reply
handles reach the caller in memory under the same reference; a bus call
carries sealed copies of in-memory attachments (promote).
- launcher: Via::Local offers in-process participants over their lane.
- coordinator: publication attaches sealed copies of in-memory media, begun
when Environment.Advance answers; defer_snapshots (publish without waiting
for admission, settled at the next snapshot); digest_views and media_bytes
as SERVE-01 has them.
- legacy env/agent: frame, memory image, audio and spike bitset sealed via
HandlerCtx::seal; the spike bitset is built eight neurons a byte.
- profile: span maxima, enabled(); the agent runs the brain's phase clock
when profiling.
- tests: every synthetic transport test also runs over the local lane; the
two publication-identity checks state the sealed copy there.
Artifact::in_memory holds an immutable buffer in the caller's address space
(store id 'in-memory', no digest): it reads, clones and retains like any other
handle without a router round trip, and a bus call, reply or publish refuses it
as an attachment before anything is sent. Artifact::to_memory reads a sealed
handle into one under the same reference. PERF-01's local lane hands these
between participants of one process.
R3: allows_cutover floors the window at REQUIRED_BRAIN_SECONDS (10,800):
a verdict run with a shorter --required-brain-seconds never passes
check. G1: the in-shadow back-off (LagJudge) judges the live lag growth
rate against fly-shadow-run's pre-start baseline (baseline.json lagRate
and margin, re-read every poll) instead of any growth, and lifts itself
for 10 minutes when a pause did not help (the shadow is not the cause);
--lag-guard-margin replaces --max-live-lag-seconds. N3: lagTransitions
is refreshed at every verdict write, backed off or not, over the rest of
the current file and every newer one.
R1: the verdict hashes flysim-session (SERVE-01's service) with the
other release binaries; check takes --current (default /opt/fly/current)
and --binary (default flysim-session) and requires the verdict's release
to be the directory the link resolves to, every shadowed binary
unchanged there. R2: a session that does not start, a restore-gate
refusal, a capture with no agent, an unrecorded transition and an
unbuildable trace line are divergences; skips carry a kind and only the
live side's own kinds (startup-save-gone, operator-reward-pulse,
trace-cap, no-transition) allow a cutover. N3: pass and the cutover rule
require one live save compared per 600 brain seconds and at most 10 %
unavailable, and the cutover rule a shadow at most 3,600 transitions
behind. N1: the shadow writes the consumer heartbeat, removes it when it
stops, and prunes history files. The coordinator's history is bounded
per segment. The test adds a gate refusal (a boot divergence) and waits
for the heartbeat; so does the rehearsal script.
In FLY_TRACE_DIR mode a process starts no trace unless the shadow's
heartbeat (<dir>/consumer) is fresh (FLY_TRACE_CONSUMER_STALE_SECONDS,
600), and a running trace stops within a minute of frames once it is
stale ({"truncated":true,"reason":"no-consumer"}). Before a
process creates its file the oldest trace files are deleted to keep the
directory under FLY_TRACE_DIR_MAX_BYTES (8 GiB). A dead or diverged
shadow can no longer leave the live service tracing.
shadow::run follows the live service's per-process trace files: each
segment boots a session from that process's startup save (a fresh start
powers on instead), replays the transition's admissions, runs it, takes
the live captures in the live order around a deferred rollback, and
compares its own trace line field by field, the ledger digest, and the
FLYSIM01 bytes of every live save (host-fields and archive-order
substituted). The first difference stops it with a diverged verdict and
divergence.json. A spool copies live generations as they appear; a lag
guard backs off while the live fly loses real time.
verdict.json is fly-shadow-verdict-v1, the contract CUT-01 reads;
fly-shadow check applies the cutover rule. trace::compare_line is shared
with trace::compare. tests/shadow.rs runs the real service through a
restart under a shadow and plants four differences, each caught with the
right kind, field and step.
FLY_TRACE_DIR writes one FLY_TRACE file per process (a restart truncated
the single path), FLY_TRACE_MAX_BYTES caps a file (4 GiB in directory
mode: a trace nobody consumes cannot fill the disk), FLY_TRACE_LEDGERS=<n>
adds ledgersDigest every n transitions. frame::ledgers_string is now the
one definition of the ledger string both runtimes digest. Recording only:
no behaviour field and nothing the fly does changes; compatibility string
unchanged.
R2-1: a failed step hands the begun captures to the writer before it reports the error, and LegacySession::flush_captures hands them over while the loop idles.
R2-2: completed_saves reports every queued save's outcome instead of stopping at the first error.
R2-3: the commit ends the in-flight admissions and records the pulses under one lock, and a sugar's reads and queueing take that same lock.
feed_game and feed_milestone each called adapter.progress() (a pure read), so every publish
computed it twice. Both now take the snapshot as an argument; publish and the session service
read it once. The header bytes are unchanged (service_parity and journal_replay pass).
- worker: a handler may finish its reply outside the endpoint's lock
(HandlerReply::deferred); admitted mutations take the lock in arrival
order (LockOrder), so a request sent before another is handled first;
a reply's cache holds are taken concurrently.
- legacy agent: State.Capture copies the state under the lock and
encodes, digests and seals it off the lock, so the next Prepare ticks
while the payload is written.
- rpc: send/finish split (SentCall); the caller's holds on wanted
attachments are taken concurrently.
- coordinator: begin_capture sends every State.Capture and returns;
finish_capture collects them. LegacySession begins a boundary's saves
and collects them after the next transition, then queues them to the
writer thread.
- Coordinator::snapshot_every(n): a snapshot every n-th boundary plus
every boundary with events or boundary actions; a service session
publishes every other boundary, the legacy feed's 30 Hz from 60 Hz.
- In-process participants reach the router in memory (a separate process
still uses its socket).
- Spans on the agent's and the coordinator's capture path; tests/speed.rs
times the legacy frame's phases, its agent export, and a session save.
- legacy-gameboy-v1: the artifact-backed ledger, the palette seed and the
pending pulse (amendments of 2026-09-29).
The session's ledger crosses the task's canonical JSON, which writes an
integral f64 as 7580031 where the legacy export writes 7580031.0; the
values are equal and the legacy import reads both alike.
Takes the artifact-backed task ledger (B1), the pending pulse (N1), the
palette seed (N3), queue_save/completed_saves (N4) and the bounded history
and concurrent seals (N5). The service host now queues its saves through
TASK-01's queue_save; SERVE-01's save_queued is gone.
- fly-session::profile: switchable per-phase spans (FLY_SESSION_PROFILE),
in the coordinator's phases, the world's advance and the agent's
prepare and commit.
- The world seals the view, the image and the audio chunk concurrently.
- Coordinator::bound_history: a service session keeps the newest 4096
transitions of trace, phase and audit logs and latency samples (it
grew without bound).
- tests/speed.rs: legacy loop against the session on one box, unpaced
and paced at 1x, in-process and process, with the span breakdown.
The TASK-01 review's N1: a second sugar before the next commit is refused
with the first one's pulse as the retry, legacy and session alike. A run
whose recorder misses a frame on a loaded box is repeated rather than
failed (it cannot be compared, and it says nothing about either runtime).