Commit graph

545 commits

Author SHA1 Message Date
acamilo
b6a4098992 infra: check 10 flags battles lost on repeat (row 67)
A whiteout ring in the Pewter Gym ran for an hour and a half without a
flag: every macro completed, and a stray tile reward on a walk back reset
the unrewarded rule. Reward lines now carry their rewardKind, and
unwon-battles flags 24+ MOVE n decisions with no wildwin/trainer/badge
reward in the window, on two probes, with no new ground. Report only, as
every check-10 rule; lint case 8 fails on main and passes here.
2026-09-29 15:34:00 +00:00
acamilo
6e090b0be5 Merge feat/agent-legacy-worker (unreviewed, integration base) 2026-09-29 15:13:47 +00:00
acamilo
dc403e8cdf docs: AGENT-01 rebased onto v0.6.5 and checked against FLY_TRACE; FLYSIM01 import seeds learning.updates 2026-09-29 14:26:07 +00:00
acamilo
563afb18f0 tests: the legacy agent worker checked against FND-01's FLY_TRACE of the running legacy frame
FLY_TRACE carries digests, not the frames or the {boot, bound, location} context, so it checks
a worker rather than drives one. legacy_parity gains read_frame_trace and check_against_trace
(ticks, clock, exact remainder, rates digest, spike-set digest, decision; the script held to the
trace's sugar, frames, rewards and rollback), RestoredSource, and
AgentDriver::seed_from_legacy_state for a worker started from a FLYSIM01 agent state.

flysim/tests/agent_trace_parity.rs runs LegacyFrame on the ROM with the trace on, records the
missing inputs, and checks the direct reference and the worker in-process, on a thread and as a
process: toy raw from power-on (FLY_ROM), and gameboy-legacy-fafb-v783-v1 macros mode from a
stream checkpoint with sugar and a ratchet rollback (FLY_AGENT01_FAFB=1). fly-session is a
flysim dev-dependency only.

A FLYSIM01 import starts learning.updates at the legacy plasticity.updates
(legacy_reinforcements): starting at zero broke changed <= updates on the live checkpoint.
2026-09-29 14:26:07 +00:00
acamilo
5da77454c3 macros: BUY BALL is one button from a mart's floor, like HEAL
Operator decision on row 66. Measured with the connectome, the fly walked
to the Viridian clerk again and again and never chose TALK, so the four
choices a purchase took at the counter never happened. BUY BALL is now also
offered on the overworld pad inside a mart whose first stock row is a Poke
Ball (Viridian, Pewter, Cerulean), while service_needed holds (no ball,
money for one, no Oak's parcel) and the clerk is not in the blocked window.
One press walks to the clerk, talks, advances the greeting to BUY/SELL/QUIT
(checking the first row is a Poke Ball), buys one, answers the price box
and is done when the wallet drops. The open-counter BUY BALL is unchanged.

Unit test for each offer condition; ROM row66 floor purchase from
FLY_ROW66_MART_CHECKPOINT: base never dealt on the floor, no ball; branch
dealt, started, done, one ball, 200 paid.
2026-09-29 14:09:02 +00:00
acamilo
96e3ffeeb1 examples: row 66 survey counters
trap_hunt: a shop/ball/catch tally (pad frames, starts, outcomes, balls,
party+box, Pokedex owned, mart entries) and FLY_TRAP_LOG_MACROS=1.
scene_probe offers: catch, party and Pokedex counts, FLY_PROBE_SCREEN_*
screen dumps, FLY_PROBE_SAVE_MART to save a mart entrance.
2026-09-29 13:55:23 +00:00
acamilo
36325d82dd palette: a counter the fly walked away from is not walked back to for the window
Row 62 re-deals GO SHOP/GO HEAL whenever the service is needed, with no
window. Live on v0.6.5 from the rung-8 archive that was a ring: GO SHOP to
the Viridian clerk, GO OUT/GO OBJECTIVE back out without TALK, GO SHOP again
(33 in 35 minutes). A completed GO SHOP/GO HEAL facing the counter person now
records TargetKey::Counter on the building's map; the service walk toward it
is withheld for the reached window, from the street and inside. TALK at the
counter is unchanged.

ROM row66 test (FLY_ROW66_MART_CHECKPOINT): base 31 street GO SHOPs in 10,000
frames, branch 0.
2026-09-29 13:55:23 +00:00
acamilo
5269c2f142 state: the battle bag is open only while its box is on screen
wListMenuID keeps ITEMLISTMENU after the list closes, so from a catch to the
end of the battle (caught text, Pokedex page, nickname offer, naming screen)
the pad read as the bag: BACK and THROW BALL, whose A presses typed the name.
The bag now also needs its TextBoxBorder at (4,2)-(19,12).

rom_catch: row66 test (THROW BALL dealt after the catch: base 666 frames,
branch 0), and both tests retry from idle offsets because one ball misses
about two throws in three and frame timing decides which.
2026-09-29 13:55:23 +00:00
acamilo
931fa01a8c docs: ENV-01 status and the 2026-09-29 amendments (guarded image read, FLYSIM01 boundary, names) 2026-09-29 13:16:22 +00:00
acamilo
d07653cc41 tests: legacy environment goldens and parity in every execution mode, the refusals, and the service trace replay 2026-09-29 13:16:22 +00:00
acamilo
d130a5ffe0 fly-session: a rollback request without a declared rollback policy fails the epoch 2026-09-29 13:16:22 +00:00
acamilo
4819f6ccd9 fly-session: the launcher starts the legacy Game Boy environment in-process, on a thread or as a process 2026-09-29 13:16:22 +00:00
acamilo
e28b0d8999 fly-session: LegacyGameboyEnvironment, the ENV-01 Game Boy environment worker
The emulator half of flysim's LegacyFrame behind the environment methods:
the one-frame setup scaffold, one joypad batch per Advance, f32le audio
(sample/255, unfiltered), the per-boundary memory image behind the MEM-01
seam (read between an export and an import, because emulator_read_mem syncs
OAM/VRAM/timer/STAT/LY), gameboy-slots-v1 SaveSlot/RestoreSlot, capture and
staged restore, and the world's half of FLYSIM01. SaveSlot, RestoreSlot and
Agent.Rollback are step mutations under the ipc-v1 operation key. The parity
harness (toy cartridge, direct reference in LegacyFrame order, bus driver,
FLY_TRACE replay) is in legacy_env_parity.
2026-09-29 13:16:22 +00:00
acamilo
ae503aa7a0 docs: legacy-gameboy-v1 amendments, the rate-role mapping and what the legacy agent reports 2026-09-29 12:21:06 +00:00
acamilo
8f058a402b tests: the gated FAFB run, recorded inputs through the worker against NeuralAgent driven directly 2026-09-29 12:21:06 +00:00
acamilo
625bcb6403 tests: the toy rollback lands in a world that stands still past a blocked window 2026-09-29 12:21:06 +00:00
acamilo
bd57b73b72 tests: legacy agent goldens in every execution mode, two flies, and the refusals 2026-09-29 12:21:06 +00:00
acamilo
214755f2b9 fly-session: the AGENT-01 parity harness, a direct NeuralAgent reference and a toy connectome 2026-09-29 12:21:06 +00:00
acamilo
fbf7c1e486 fly-session: the launcher starts a legacy agent in-process, on a thread or as a process 2026-09-29 12:21:06 +00:00
acamilo
9bdfb079e5 fly-session: LegacyAgentWorker, the legacy Game Boy agent over the neural core
Agent.Initialize checks the profile against the dataset fingerprint and
warms up as the legacy fresh start does; Prepare applies sugar, ticks the
548625/32768 ms frame on the rational clock and decodes with
gameboy-readout-context-v1; Commit installs the frame, stimulates, then
reinforces once; Agent.Rollback is legacy-ratchet-rollback-v1's agent
half; capture is agent_to_chunks in an envelope and a restore resets the
readout transient as a fresh legacy process has it.
2026-09-29 12:21:06 +00:00
acamilo
72cefb773b session-types: legacy-rate-role-id-v1, the identity on the Id grammar, pinned in both languages 2026-09-29 12:21:06 +00:00
acamilo
9f2345dba7 docs: v0.6.5 status
Some checks are pending
ci / node 22 (test + typecheck) (push) Waiting to run
ci / rust stable (cargo test --workspace --release) (push) Waiting to run
ci / infra/tests/lint.sh (push) Waiting to run
ci / playwright apps/stage (allowed to fail) (push) Waiting to run
2026-09-29 04:47:16 +00:00
acamilo
05ff68773c Merge fix/loop-row65: the Mt. Moon mouth ring and the Cerulean yard, on the 62+63+64 tree 2026-09-29 04:47:05 +00:00
acamilo
b720db9a42 docs: row 65, the Mt. Moon door ring on the release merge and the Cerulean yard (12.29, audit) 2026-09-29 04:01:16 +00:00
acamilo
ceaf55ad48 macros: a yard's one door is taken, and a split map's exits are the fly's own piece's
Cerulean's badge house back door leaves the fly on (9, 9), the door tile of a
closed yard; the pad was empty for the rest of the survey.

- The exit walks fall back on a step-fired warp underfoot once every listed
  goal has failed the route search (goals_of set it aside while any other exit
  was listed, reachable or not).
- The decoded grid marks warp carpets (warp_carpet_tile_ids.asm) on the maps
  whose ExtraWarpCheck reads them; a walk whose goal is a warp underfoot bumps
  toward one (CheckWarpsCollision) instead of row 64's sideways step-off, which
  fires nothing on a tile that is no door.
- The badge house is on the map graph and the yard is a piece of Cerulean, so
  GO OUT in the house takes the front door.
- path::exits keeps the fly's own piece on a split map: refusals from the yard
  no longer rest the town's exits for the whole map.
- The 12.28 guarantee reads where the fly stands: a same-map teleport moved it.

ROM test row65_the_fly_leaves_the_cerulean_badge_houses_back_yard
(FLY_ROW65_YARD_CHECKPOINT); scene_probe's route survey can save its caught
frame (FLY_PROBE_SAVE without FLY_PROBE_SAVE_RANK).
2026-09-29 04:01:16 +00:00
acamilo
2f869fd4bc macros: a floor whose way on is a passage deals no GO OUT fallback
GO OUT's "a room has to be leavable" tier dealt Mt. Moon 1F's mouth back onto
Route 4 (visited, away from the rung) one step from the tile the fly arrives
on, and Route 4's GO ROUTE / GO OBJECTIVE walked it straight back in. With row
62's GO HEAL bringing a hurt fly back to that tile, rows 62+63+64 crossed
Route 4's west doors 34 times in row 59's ROM test (bound 25).

While an unrested passage leads toward the objective, the way out has no
fallback: GO WARP's rule the other way round. The blocked window is the escape
hatch; tiers one and two (somewhere new, toward the objective or an errand)
are untouched, and a hurt party keeps GO HEAL.
2026-09-29 04:01:16 +00:00
acamilo
310282540b Merge fix/tag-release-rom 2026-09-29 02:49:03 +00:00
acamilo
abacebf6b9 tag-release: refuse a gate that would pass the ROM suites without running them
The ROM suites return early and count as passed when FLY_ROM or their
checkpoint variable is unset; v0.6.4's gate ran that way and the merge
of rows 62-64 looked green while row 59's ROM test failed. Require
FLY_ROM and log every checkpoint suite left unset.
2026-09-29 02:49:03 +00:00
acamilo
19d295d111 tests: close row 62's last test, whose brace the row 64 merge took as shared context
Both branches appended tests at the end of the file; resolving the
conflict as both sides left row 62's final test without its closing
brace.
2026-09-29 01:47:23 +00:00
acamilo
56ed48b0b9 Merge fix/bridge-refresh-on-load 2026-09-29 01:31:26 +00:00
acamilo
4a37527c76 Merge fix/deploy-bridge-env 2026-09-29 01:31:26 +00:00
acamilo
d7238a935b Merge feat/recovery-copy 2026-09-29 01:31:26 +00:00
acamilo
ccba5d75a2 tests: row 64's ledge test sees Route 4's centre, which row 62 made an errand
review-row62-r2: merged, the Mt. Moon centre is the errand ahead of the
test's goal on Route 4's west side; the behaviour is right, the fixture
predates row 62.
2026-09-29 01:31:22 +00:00
acamilo
ce12a1d7a5 Merge fix/loop-row64
# Conflicts:
#	docs/design/macros.md
#	infra/docs/macros-traps.md
#	services/flysim/crates/flybrain-gb/src/pokemon_red/macros/tests.rs
#	services/flysim/crates/flysim/tests/rom_macros_mode.rs
2026-09-29 01:31:22 +00:00
acamilo
e2e830076e Merge fix/loop-row62
# Conflicts:
#	docs/design/macros.md
#	infra/docs/macros-traps.md
#	services/flysim/crates/flybrain-gb/src/pokemon_red/macros/tests.rs
#	services/flysim/crates/flysim/tests/rom_macros_mode.rs
2026-09-29 01:30:32 +00:00
acamilo
6d11e437e5 Merge fix/loop-row63 2026-09-29 01:29:42 +00:00
acamilo
b6e552ace2 tests: the row 62 east test's first sighting as a plain tuple 2026-09-29 00:18:27 +00:00
acamilo
c8f35b4fce docs: row 64, a ladder underfoot, Route 4's ledges and the way out that goes nowhere (12.28, audit) 2026-09-29 00:11:14 +00:00
acamilo
d06e1cf809 bridge: refresh stored tokens on load before giving up, persist both roles
A stored access token that has expired (obtainmentTimestamp + expiresIn) or
that validate rejects with 401 is now refreshed once through its role's
RefreshingAuthProvider before startup fails, for the bot and broadcaster
roles alike. Refreshes are persisted under the role whose provider made
them (no more scope-set guessing), through one serialized writer, so both
roles reach tokens.json even when they are one account; writes stay
tmp + rename, 0600.

Only a refresh Twitch refuses (4xx, e.g. 400 Invalid refresh token) is
fatal, with one line naming the role and the runbook's re-authorize step.
Twitch errors are logged by status and message only: twurple's
HttpStatusCodeError message carries the refresh grant URL, client secret
and refresh token included, so the entrypoint and EventSub log lines now
redact it.

Tests mock Twitch's validate and token endpoints. Runbook and B1 updated.
2026-09-28 23:47:48 +00:00
acamilo
83e842aee2 macros: a way out that does not take the fly anywhere is not done
The general half of row 64: section 12.2's rule ("a macro that completes
without moving because its precondition is already satisfied is a trap")
held by the executor for every way out, instead of by each macro.

A way out's promise is another map. A Settle arrival on an exit key that
leaves the fly on the same map now ends Blocked, so the exit rests in the
blocked ledger for the window. When the fly never left the tile it pressed
from, row 57's refused-from-here ledger also keeps that button off this
tile for the window, because the last resort ignores the blocked ledger
and would otherwise re-deal the same dead exit once per hold. Nothing is
pressed, ranked or chosen: two ledgers that already exist get one more
honest writer. A pad with nothing left that can run is empty and waits.

On base with only this commit, from the live row-64 checkpoint (72k
frames, GO OBJECTIVE/GO WARP preferred): GO OBJECTIVE done in place 1,500
-> 0; the fly leaves the ladder tile and moves on (still not to Cerulean,
which needs the ledge knowledge). The test fixture's settle now drains the
refused ledger after every finish, as PokemonPalette::record_talk does.
2026-09-28 23:38:06 +00:00
acamilo
f4946ce744 tests, docs: row 62 round 2, GO HEAL east of Mt. Moon on the cartridge and the two limits in 12.26 2026-09-28 23:37:40 +00:00
acamilo
b2c5944a02 05-deploy: a release with a channel refuses an empty GAME_TITLE
The generated fly.env writes GAME_TITLE whether or not the env file
sets it, and flybridge refuses to start on an empty one. It reads the
file only at start, so the gap surfaced as dead chat at the next reboot
(2026-09-28), a day after the deploy that caused it.
2026-09-28 23:35:33 +00:00
acamilo
e10f48e1c7 macros: a ledge is a hop the route search takes the one way the cartridge does
Row 64, the source of the Mt. Moon ring. Off the ladder, the road reaches
Route 4 east of the mountain, where Cerulean is three ledges down. The
collision list calls a ledge tile a wall, so the route search had no road
from the cave's exit to Cerulean at all: GO OBJECTIVE refused no route, the
east edge rested in the blocked ledger, and the other walks took the fly
back into the cave, onto B1F's exit (27, 3) or down B1F's ladder to B2F
(5, 7), where the ladder ring took over.

- The decoded grid marks LedgeTiles hops (data/tilesets/ledge_tiles.asm,
  OVERWORLD tileset only, the lower-left anchor tiles HandleLedges reads).
- The route search takes a hop from above as one press that lands two
  tiles on; from below a ledge stays a wall; the flood the map's pieces
  are measured with is unchanged.
- The walk holds while the cartridge carries the fly over (scene Unknown,
  scripted, on the hop's own line), so a hop it asked for is not written
  as a push-back.

ROM test from the live checkpoint (FLY_ROW64_CHECKPOINT): base stays on
(5, 7) with 167 done-in-place and never leaves B2F; branch takes the
ladder on the first GO OBJECTIVE, hops Route 4's ledges and reaches
Cerulean City at frame 1,972 with the pushed ledger empty.
2026-09-28 22:50:34 +00:00
acamilo
014d869e14 macros: a walk that starts on its own ladder steps off and back on to take it
Row 64, Mt. Moon B2F (5, 7), two days live. A warp whose exit has no press
fires at the end of a step onto it (CheckWarpsNoCollision) and at no other
time; a bump into the wall beside it warps only at a map edge off the
overworld (ExtraWarpCheck). The fly came down the exit ladder and stood on
it, and GO OBJECTIVE and GO WARP both aimed at the tile underfoot, settled
there and reported done without a press, 27 frames each, ~750 per ten brain
minutes. No ledger was involved, so restarts restored the ring.

A walk whose goal is a step-fired warp the fly already stands on now steps
onto free ground beside it (never another warp) and back, which is what
fires it. Nothing else changes: the pad, the ledgers and every other
arrival are as they were.
2026-09-28 22:49:17 +00:00
acamilo
3ea8da346c recovery splash: the operator's copy, and STUCK from the last progress
A reset to the rung the fly is on reads 'the start of MT. MOON'; a rung
that is not a place reads 'the BOULDER BADGE milestone'; failed says
what happens next ('Trying something else next') instead of promising
a human. The helper keeps the last probe that saw new places or a higher
rung, across restarts and reboots, so STUCK counts the whole trap rather
than the current streak (live: 15 MIN shown for a two-day trap).
Mockups re-shot with the real next target (12 -> 11).
2026-09-28 22:43:41 +00:00
acamilo
64148848e5 loop recovery: check every minute, not every five
The live timer's phase sat one second before each watchdog loop probe,
so every confirmation waited almost a whole extra period. A run is a
JSON read unless a step is due, and the ladder already ignores a probe
it has seen, so a one-minute cadence costs nothing.
2026-09-28 22:19:53 +00:00
acamilo
f2d8a2d491 palette: a centre is the area's from ground the route to it stays on, and no service leaves the rung's room
Review round 2 of row 62. Route 4's east side and Mt. Moon B1F's exit chamber are in
Route 4's area, but the only road to its centre runs through B2F, which is in none:
GO HEAL (and the errand under GO OBJECTIVE) walked into B2F and dropped there, opposite
the road to Cerulean. A building is the area's errand or service only where
geography::route_within holds. And a service is not wanted while the rung's own target
stands in the room (row 29's rule, row 58's gym bounces).
2026-09-28 22:12:09 +00:00
acamilo
aba63beb77 docs: macros.md 12.26 and the row 62 audit, the shop, the balls and the nurse withheld
What the pad dealt against what the fly chose, the five places the pad
withheld a counter with a job to do, the purchase that ended before its
price box, THROW BALL measured as not a trap, and the before/after
surveys (ten per arm) and ROM runs.
2026-09-28 22:08:17 +00:00
acamilo
2fb5e37ab4 scene_probe: FLY_PROBE_CATCH=offers, what the pad deals frame by frame
Twenty brain minutes of the service's frame behind a uniform stub,
counting per decidable frame which shop, centre and ball buttons are on
the pad and what comes of the ones pressed, beside the cartridge's own
heals, purchases, throws, catches, whiteouts and wLastBlackoutMap. With
FLY_PROBE_PREFER, FLY_PROBE_PADS and FLY_PROBE_TRACE_MACRO for the
mechanism (loop review row 62).
2026-09-28 22:08:17 +00:00
acamilo
d188a59495 tests: row 62's ROM proofs, HEAL in the Mt. Moon centre and a ball bought in Pewter
From the Mt. Moon centre with the party at 10/70 (FLY_ROW62_CENTER_CHECKPOINT):
HEAL is dealt, heals, and wLastBlackoutMap becomes Route 4. From the
rung-11 Pewter checkpoint with the errands paid, 1,606 and no ball
(FLY_ROW62_MART_CHECKPOINT): GO SHOP is on the pad, walks into the mart,
and BUY BALL reports done only with the ball in the bag and 200 paid.
Both fail on main 862e343 (HEAL never dealt in 3,000 frames; GO SHOP not
on Pewter's pad).
2026-09-28 22:08:17 +00:00