Repository navigation
AutoStory: one shared list of story failure classes - #479
Merged
Merged
Conversation
Adds Pokemon_StoryFailureClasses: 27 classes as data rows (id, meaning, how a run sees it, the sim faults that inject it, the engine Outcome names it covers, a retry hint), the maps from every sim FaultClass and every engine failure name to a class, and a "class=<id>" tag that log lines and run records can carry and read back. No game uses it yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
FRLG's fault sweep injects it (11.01, console B, 2026-11-12); the story failure class mount_lost now lists it as its sim fault. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
An Outcome may carry its StoryFailureClass (outcome_failed's third argument, for a game's own failure names); failure_class_of() falls back to the shared list's class for the name. The engine's failure lines ([Event], [Checkpoint], [Step], [Segment], [Verify]) end with "(class=<id>)" when the class is known, and an OperationFailedException that leaves an event is logged as class=operation_failed. Pokemon_StoryFaultSweep: a game gives its sweep as data (rows, an injector per sim fault, the known-failing list); the engine makes one test per class and row, named "<row>, <class id>", judges it, and checks the known-failing list names only its tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…/fault-classes # Conflicts: # SerialPrograms/Source/Pokemon/AutoStory/Engine/Pokemon_StoryEngine_Tests.cpp
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine
commented
Nov 14, 2026
dayfine
left a comment
Owner
Author
There was a problem hiding this comment.
Verdict: mergeable on the fork
Reviewed SHA: 5334a11
Verdict
APPROVED
Correctness pass on git diff origin/autostory/engine...origin/autostory/fault-classes, then a style pass. CI green. No existing comments. The class table covers every failure name the engine returns on this branch (I checked with git grep for outcome_failed("...")). No blocking findings.
Should-fix
Pokemon_StoryOutcome.h:20—Outcome, which nearly every AutoStory file includes, now pulls inNavigation/Simulation/Pokemon_SimFaults.hthroughPokemon_StoryFailureClasses.h. This is the first non-test include from AutoStory into the sim. Keep theStoryFailureClassenum in a small header with no sim dependency, and move theinjected_by/FaultClassmapping next to the fault sweep, so the production engine doesn't depend on the simulator.Pokemon_StoryFailureClasses.cpp:23—const std::vector<StoryFailureClassInfo> CLASSESis a namespace-scope global with a non-trivial destructor. Our style rule calls for a function-localstatic const(thedatabase()idiom, TotW #140). It also avoids static-init-order trouble ifstory_failure_classes()is called from another TU's static initializer.Pokemon_StoryFailureClasses.cpp:218withPokemon_StoryFailureClasses_Tests.cpp:144—story_failure_class_info()indexesCLASSESby the enum with no bounds check.rows_in_enum_orderchecks the order of the rows that exist, but not that every enumerator has a row. A new enumerator added without a row reads past the end. Assertclasses.size() == SIM_MISMATCH + 1in the test, or throwInternalProgramErroron a bad index.
Nits
Pokemon_StoryFaultSweep.cpp:41—const std::string& nameis read only, so takestd::string_viewby value.Pokemon_StoryFaultSweep.cpp:64,:66—.at()used as the lookup, and onlyException&is caught, so an injector'sstd::exceptionescapes the known-failing inversion. Catchstd::exceptiontoo.
…rged, review fixes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
This was referenced Nov 14, 2026
dayfine
added a commit
that referenced
this pull request
Nov 15, 2026
Conflicts: TalkOverRule keeps BDSP's door settle (DOOR_QUIET, DOOR_CALM, PLAYER_STILL) next to nav/shared's per-rule `calm`; SCREEN_EVENT_COUNT is 12 with PLAYER_STILL last; the system keyboard detector is nav/shared's, so BDSP's new game types through FastCodeEntry::type_on_system_keyboard. The screen events moved to CommonTools/ScreenEvents in namespace PokemonAutomation and SwitchHomeObserver to NintendoSwitch: BDSP's includes and names follow.
This was referenced Nov 15, 2026
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.
Depends on #332
Base
autostory/engine(#332); the diff shows only this change.Each game names its failures its own way (FRLG ~50 Outcome names, BDSP ~20, PLZA ~15, on top of the engine's ~25), and the two fault sweeps each keep a private
FaultClassenum, so a failure seen on one console can't be looked up, swept or retried the same way in another game. This adds one shared list in the engine,Pokemon/AutoStory/Pokemon_StoryFailureClasses.{h,cpp}: 27 classes as data rows (id, one-line meaning, how a run sees it, the sim faults that inject it, the engine Outcome names it covers, a retry hint),story_failure_class_of(FaultClass),story_failure_class_of_outcome(name), and aclass=<id>tag for log lines and run records with its reader. The engine now uses it: anOutcomecan carry its class (outcome_failed's new third argument, defaulted, so game code is unchanged;failure_class_of()falls back to the list's class for the name), and the engine's failure lines ([Event],[Checkpoint],[Step],[Segment],[Verify]) end with(class=<id>)when the class is known, anOperationFailedExceptionleaving an event asclass=operation_failed.Pokemon_StoryFaultSweepis the shared sweep: a game gives its rows, an injector per sim fault and its known-failing list as data, and the engine makes one test per class and row, named<row>, <class id>, judges it, and checks the known-failing list names only real tests. No game uses either yet; that is the adoption PRs below. Tested with the newPokemon::StoryFailureClassesandPokemon::StoryFaultSweepsuites, newPokemon::StoryEventscases for the class in log lines, and the updatedPokemon::StoryEnginestep line; also with thePokemon::StoryFailureClassessuite (every engine failure name to its class, every sim fault in exactly one class, no name in two classes, every id round-trips through a log line and a run-record field, untagged or unknown text reads as no class); fork CI runs it.Survey: what fails today
failure)game_not_running,start_failed,wrong_save,precondition_failed,reload_failed,save_failed,unsupported_step,unknown_checkpoint,bad_range,empty_segment,bad_verify_policy,lint_failed,no_save_hook,console_only,too_many_interrupts,unhandled_interrupt,interrupt_failed,interrupt_unsettled,interrupted,talk_no_text,mash_no_overworld,expect_failed,require_failed,end_failed,postconditions_failed,operation_failed(anyOperationFailedException). Logged as[Checkpoint] X: failed at N event: <failure>: <detail>,[Segment] X: failed at Y: ...,[Verify] ...Pokemon_SimFaultsFaultClass: SCENE_END_POSE, SCENE_EARLY, BATTLE_OPENING, WILD_BATTLES, LATE_FADE, SLOW_FADE_IN, WARP_NO_OP, DARK_CAVE, LOST_TAP, UNSEEN_STEP (no game uses the shared enum yet)no_pose,unknown_facing,step_unresolved,wall_overrun,slope_*,route_move_budget_exceeded,native_route_stopped,encounter_requires_recovery,transition_unconfirmed,no_trainer,no_battle,no_message,dialog,fly_menu_unread,count_unread,level_unread,hp_unknown,scene_evidence_missing_or_mismatched,blackout,hp_not_full,level_below,wrong_end,mart_*,mart_cancel,pc_failed,pc_refused,teach_*,use_item_*,wrong_item,item_not_found,trash_cans_*,fossil_*,capture_*,grind_*,no_save,no_route,bad_args,bad_legs,bad_target,unknown_item,sim_failuremoved_lessno_pose,map_mismatch,measured,counted_wall,short_leg,interrupted_step,interrupted_leg_unconfirmed,no_banner,no_dialogue,unknown_action; story sim:dialog,heal,talk_over,sim_failure,sim_mismatchSimMisses/SimWorldKnobs: missed fade, missed banner, fade hold, dark floor, slide onto a warp, late first line, wandererswalk_no_end,scene_quiet,platform_not_seen,no_prompt,heading_unread,not_at_start,older_save,no_reload,battle_failedlaunch_failedThe classes (retry hint: step = find the player and rerun the step, reload = reload the checkpoint's save, stop = a person or code change)
game_not_runninglaunch_failedwrong_startreload_failedsave_failedstory_errorlost_tapunseen_stepwalk_shortblockedmount_lostpose_lostwarp_no_oplate_fadeslow_fade_indark_mapscene_end_posescene_earlybattle_openingwild_battlesinterrupt_failedscreen_unreadmenu_failedbattle_loststate_check_failedoperation_failedsim_mismatchPer-game mapping for the adoption PRs
wrong_startnot_at_start,older_savereload_failedno_reloadsave_failedno_savestory_errorno_route,bad_args,bad_legs,bad_target,unknown_itemunknown_actionwalk_shortslope_*, replaymoved_lessshort_leg,counted_wallwalk_no_endblockedroute_move_budget_exceeded,native_route_stoppedmount_lostpose_lostno_pose,unknown_facing,step_unresolved,wall_overrunno_pose,map_mismatch,measured, sim slide onto a warpheading_unreadlate_fadetransition_unconfirmeddark_mapwild_battlesencounter_requires_recoveryinterrupt_failedinterrupted_step,interrupted_leg_unconfirmedscreen_unreadno_trainer,no_battle,no_message,dialog,fly_menu_unread,count_unread,level_unread,hp_unknown,scene_evidence_missing_or_mismatchedno_banner,no_dialogue, sim missed banner, late first linescene_quiet,platform_not_seen,no_promptmenu_failedmart_*,mart_cancel,pc_failed,pc_refused,teach_*,use_item_*,wrong_item,item_not_found,trash_cans_*,fossil_*,capture_*battle_lostblackout,grind_*battle_failedstate_check_failedhp_not_full,level_below,wrong_endsim_mismatchsim_failuresim_failure,sim_mismatch,dialog,heal,talk_over(story sim)Adoption order: (1) engine: done here, except taking the engine's no-reload set from the
stophint (left as is:wrong_startwould stop reloads that fix a wrong start); (2) FRLG: class its Outcome names (outcome_failed(..., class)), build its sweep as aStoryFaultSweep(test names become<row>, <class id>, so KNOWN_FAILING keys are renamed); (3) BDSP: class its names, its sweep as aStoryFaultSweepwith GRASS_BATTLES as WILD_BATTLES; (4) PLZA: names only (no sim). #477 already useslaunch_failed.🤖 Generated with Claude Code
https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss