Skip to content

Commit f2ae4f0

Browse files
committed
gpt-6.1-sol-max: bind native story replays to observed calculation counts
Observe actual gameplay-counter increments after native setup gates without moving the existing trace/RNG hook. Recording reports distinguish accepted-path calculations, controller-only transitions and total branch effort. Verification hashes the exact parsed action stream. Preserve original execution proofs; separately qualify new accounting and archive receipts. Require matching action/replay hashes, identities, terminal stage/score, RNG and exact row counts before exporting replays. Reject contradicting original metadata and retain every additional verification cost. Validation: native CTest 35/35; after report hardening, 34/34 excluding unchanged long real-data case; core 29/29. Full corpus retains the same 106/108 outcomes and all 108 row counts/fingerprints. Complete story: 232408 updates = 232403 observed calculations + five measured controller-only transitions; natural RPY agrees. Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning) Assisted-by: Sakuya (gensokyo-skills:sakuya-checkpointed-execution)
1 parent e4850bc commit f2ae4f0

15 files changed

Lines changed: 788 additions & 47 deletions

‎cmake/Headless.cmake‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ if(BUILD_TESTING)
104104
endif()
105105

106106
add_executable(th08_replay_check tools/replay_check.cpp)
107-
target_link_libraries(th08_replay_check PRIVATE th08_native_headless)
107+
target_link_libraries(th08_replay_check PRIVATE th08_native_headless OpenSSL::Crypto)
108108
target_include_directories(th08_replay_check PRIVATE "${th08_native}/src")
109109
target_compile_options(th08_replay_check PRIVATE -ffp-contract=off "-include${th08_native}/src/modern/linux/linux_compat.hpp")
110110
add_executable(th08_plan tools/plan.cpp)

‎docs/ARCHITECTURE.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Do not infer complete-world behavior from a supported parser, opcode or kernel.
2626
| Native execution/tapes/reports | `tools/headless.cpp`; opt-in `cmake/Headless.cmake` |
2727
| Native fork planner, proposals and process checkpoints | `tools/plan.cpp`; `plan_contracts.hpp`, `plan_observation.hpp`, `plan_beam.hpp` |
2828
| Replay projection and strict corpus gate | `modern/headless/replay_check.*`, `tools/replay_check.cpp`, `tools/replay_suite.cpp` |
29+
| Sanitized campaign evidence and verified replay export | `tools/planner_report.cpp`; retains original proofs, separate accounting/archive receipts and their costs |
2930
| Sampled hazard stability diagnosis | `tools/hazard_probe.cpp`, `hazard_probe.hpp` |
3031
| Independent native input interventions | `tools/headless_probe.cpp`; serial fresh-process branches over a fixed tape |
3132

@@ -69,6 +70,14 @@ not the GUI/message update logic. This profile does not split visual RNG streams
6970
Initialization and loading completion are explicit adapter boundaries, described in
7071
[Scenarios](SCENARIOS.md); no claim about original menu entry is needed.
7172

73+
`State::calculation_updates` observes the actual `gameplayFrameCounter` increment,
74+
after native setup gates. The observer survives stage counter resets and process forks,
75+
consumes no RNG, and leaves the existing entry trace hook unchanged. Stage-control
76+
calls can return before that increment and all later replay callbacks. Accepted-path
77+
counts/events remain process-private and travel with checkpoint state; only effort
78+
over all branches uses shared atomic counters. [Planner](PLANNER.md) owns the recording
79+
and report contracts for these distinct counts.
80+
7281
In recording mode the supervisor samples controller input at priority 0, Player moves
7382
at 9, BulletManager updates/collides at 14, and ReplayManager latches movement input
7483
at 17. Player therefore reads the previous latch. The headless adapter preserves this

‎docs/PLANNER.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ their recordings can guide another proposal. Only validated prefixes are committ
3838
Checkpoint-holder processes enable backtracking without replaying the whole prefix.
3939
All attempted rollouts, including failures and reconstruction, belong in cost totals.
4040

41+
An API update is not always a gameplay calculation. Native stage handoff calls can
42+
return before the gameplay counter and replay callbacks; replay playback can instead
43+
restart the calculation chain within one API call. The planner observes actual
44+
gameplay-counter increments without changing the existing trace/RNG hook. Recording
45+
mode accepts one calculation or an observed control-only stage change and rejects
46+
unexplained skipped/batched calculations. Reports preserve exact event indices and
47+
separate path counts from costs over all attempted branches. Natural `.rpy` validation
48+
uses observed calculations, never an assumed offset based on the number of stages.
49+
4150
`--prefix ACTIONS` reconstructs an earlier input tape through the same native
4251
session before checkpoint holders fork. Use its original stage/story/difficulty/
4352
seed/shot settings. Raw actions have no checkpoint header; another configuration
@@ -87,6 +96,11 @@ independent before concurrent children are enabled. The imported DAT entry reade
8796
closes/reopens its handle for each entry; audit other inherited descriptors rather
8897
than assuming all reads share or avoid offsets. Current fork rollouts remain serial.
8998

99+
A measured spell-92 run spent about one quarter of search CPU time in collision
100+
queries; beam expansion/selection also mattered. That sample does not justify adding
101+
threads to the collision kernel. Independent complete solver jobs currently provide
102+
useful CPU parallelism while retaining separate native worlds and evidence.
103+
90104
On shared hosts, bound jobs and process count using measured memory. Use low CPU/I/O
91105
weights, a hard memory limit and a lower high-water limit, with no additional swap;
92106
check available memory before launch. CPU parallelism does not justify risking OOM

‎include/th08/plan_contracts.hpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ inline bool fits_tape(std::size_t bullets, std::size_t lasers, std::size_t regio
5858
return bullets <= bullet_capacity && lasers <= laser_capacity && regions <= region_capacity;
5959
}
6060

61+
// Recording mode executes one GameManager calculation, or a controller-only
62+
// stage handoff. Playback may batch calculations and is outside this contract.
63+
inline bool supported_recording_step(std::uint64_t calculations, bool stage_changed) {
64+
return calculations == 1 || (calculations == 0 && stage_changed);
65+
}
66+
6167
struct ChildResult {
6268
bool waited = false;
6369
int status = 0;

‎include/th08/plan_observation.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ inline bool same_observation(const headless::State &a, const headless::State &b)
2727
a.gauge == b.gauge && same_float(a.lives, b.lives) &&
2828
same_float(a.hurt_half_x, b.hurt_half_x) && same_float(a.hurt_half_y, b.hurt_half_y) &&
2929
a.latched_input == b.latched_input && a.sampled_input == b.sampled_input &&
30-
a.youkai == b.youkai;
30+
a.youkai == b.youkai && a.calculation_updates == b.calculation_updates;
3131
}
3232

3333
} // namespace th08::plan

‎tests/plan_contract_tests.cpp‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@ void observation_contract() {
161161
committed.youkai = !expected.youkai;
162162
check(!th08::plan::same_observation(expected, committed),
163163
"same-input commit hid a source-owned player form change");
164+
committed = expected;
165+
++committed.calculation_updates;
166+
check(!th08::plan::same_observation(expected, committed),
167+
"same-position commit hid a native calculation boundary change");
168+
check(th08::plan::supported_recording_step(1, false) &&
169+
th08::plan::supported_recording_step(0, true) &&
170+
!th08::plan::supported_recording_step(0, false) &&
171+
!th08::plan::supported_recording_step(2, true),
172+
"unexplained skipped or batched recording calculations were accepted");
164173
}
165174

166175
void spatial_beam_contract() {

0 commit comments

Comments
 (0)