turn phases not functioning simultnaneously. #84

Closed
opened 2026-09-30 00:07:00 +00:00 by robertismo · 3 comments

in #80 you say

hooks run in seat order before depositFlow; market-deposit-rates carries THIS turn's posted rates for seats before mine and last-turn rates for seats after.

if this is true then this is a bug, ALL players technically act simultaneously, there is no pre-existing info available for the turn.

in #80 you say > hooks run in seat order before depositFlow; market-deposit-rates carries THIS turn's posted rates for seats before mine and last-turn rates for seats after. if this is true then this is a bug, ALL players technically act simultaneously, there is no pre-existing info available for the turn.
Owner

Confirmed — it's a bug. You're right: all players act simultaneously in each phase, and the current engine leaks current-turn info by seat order.

Verified in the source. Three leaks:

  1. deposit-rate hooks run in seat order and each bank's rate is written immediately after its hook returns. A later seat calling market-deposit-rates / market-avg-rate reads THIS turn's rates from earlier seats (plus last turn's for later ones) — exactly the quote you caught from my #80 comment.
  2. bond-offers hooks: each seat's offer-bond hits the market immediately, so a later seat's market-bonds sees earlier seats' fresh offers and can undercut the price exactly.
  3. bond-take hooks: fills mutate the market immediately, so a later seat sees a market already thinned by earlier seats' takes.

Fix: each decision phase gets a phase-start snapshot, and the phase's reads serve the snapshot — every bank sees the same market regardless of seat:

  • deposit phase: snapshot all posted rates at phase start; market-deposit-rates and market-avg-rate read the snapshot.
  • bond-offers phase: snapshot the standing market at phase start; market-bonds reads it.
  • bond-take phase: new snapshot at the phase start (includes this turn's offers, excludes this turn's takes).
  • The human prompt moves to the FRONT of the bond phases so the screen shows exactly the market the engine fills against (no preview lies, per the #69 rule).

Regression tests will pin this: a two-seat game where seat 1's hook must NOT see seat 0's current-turn rate/offers/takes.

Implementing now on branch 84-simult, PRs only, progress comments per step. The v2 super-AI agent is being steered off the seat-order exploit simultaneously — its deposit model will use last-turn rival rates (opponent modeling), not current-turn reads.

**Confirmed — it's a bug. You're right: all players act simultaneously in each phase, and the current engine leaks current-turn info by seat order.** Verified in the source. Three leaks: 1. `deposit-rate` hooks run in seat order and each bank's rate is written immediately after its hook returns. A later seat calling `market-deposit-rates` / `market-avg-rate` reads THIS turn's rates from earlier seats (plus last turn's for later ones) — exactly the quote you caught from my #80 comment. 2. `bond-offers` hooks: each seat's `offer-bond` hits the market immediately, so a later seat's `market-bonds` sees earlier seats' fresh offers and can undercut the price exactly. 3. `bond-take` hooks: fills mutate the market immediately, so a later seat sees a market already thinned by earlier seats' takes. Fix: each decision phase gets a phase-start snapshot, and the phase's reads serve the snapshot — every bank sees the same market regardless of seat: - deposit phase: snapshot all posted rates at phase start; `market-deposit-rates` and `market-avg-rate` read the snapshot. - bond-offers phase: snapshot the standing market at phase start; `market-bonds` reads it. - bond-take phase: new snapshot at the phase start (includes this turn's offers, excludes this turn's takes). - The human prompt moves to the FRONT of the bond phases so the screen shows exactly the market the engine fills against (no preview lies, per the #69 rule). Regression tests will pin this: a two-seat game where seat 1's hook must NOT see seat 0's current-turn rate/offers/takes. Implementing now on branch `84-simult`, PRs only, progress comments per step. The v2 super-AI agent is being steered off the seat-order exploit simultaneously — its deposit model will use last-turn rival rates (opponent modeling), not current-turn reads.
Owner

Fixed and up for review: PR #85 — #85 (branch 84-simult, commit 4900d47).

The leak is closed with per-phase snapshots: every seat in a phase reads the same phase-start view. market-deposit-rates/market-avg-rate serve last turn's posted rates during the deposit phase; market-bonds serves the standing market at the phase's start during the bond phases (cleared at phase end, so reads in other phases stay live). The human now offers and takes first, against exactly the market their screen shows, and AI take wants clamp to the phase-start market cash.

Three regression tests pin it: seat 0 posts a rate / places an offer / takes from the market, and seat 1's hooks must see exactly the phase-start view — all three pass, full suite green, vet clean, both spectate rosters 0 [ai / 0 DIVERGENCE, bench smoke 0 FATALs.

Side effect you should know: brains now genuinely see last-turn rates during the deposit phase, so bench win distributions may shift a bit vs the old leaky baseline — that's the intended behavior. The v2 super-AI agent has been re-briefed to model rival rates instead of reading them, so nothing under development depends on the leak.

**Fixed and up for review: PR #85 — https://git.machinetele.com/Winnie/bankwars/pulls/85** (branch `84-simult`, commit 4900d47). The leak is closed with per-phase snapshots: every seat in a phase reads the same phase-start view. `market-deposit-rates`/`market-avg-rate` serve last turn's posted rates during the deposit phase; `market-bonds` serves the standing market at the phase's start during the bond phases (cleared at phase end, so reads in other phases stay live). The human now offers and takes first, against exactly the market their screen shows, and AI take wants clamp to the phase-start market cash. Three regression tests pin it: seat 0 posts a rate / places an offer / takes from the market, and seat 1's hooks must see exactly the phase-start view — all three pass, full suite green, vet clean, both spectate rosters 0 `[ai` / 0 DIVERGENCE, bench smoke 0 FATALs. Side effect you should know: brains now genuinely see last-turn rates during the deposit phase, so bench win distributions may shift a bit vs the old leaky baseline — that's the intended behavior. The v2 super-AI agent has been re-briefed to model rival rates instead of reading them, so nothing under development depends on the leak.
Owner

Merged via PR #85 (b1f9698 on master). Issue closed — ship note:

Simultaneous phases are the law now: during a decision phase every seat reads the same phase-start snapshot (last-turn deposit rates, phase-start bond market), the human acts first against the market their screen shows, and AI bond-take wants clamp to the phase-start market cash. Three regression tests (simult_test.go) pin all three leaks; docs/ai-api.md documents the contract.

The v2 super-AI agent on #80 has been re-briefed to predict rival rates from last-turn behavior instead of reading them, so nothing under development depends on the old leak.

Merged via PR #85 (b1f9698 on master). Issue closed — ship note: Simultaneous phases are the law now: during a decision phase every seat reads the same phase-start snapshot (last-turn deposit rates, phase-start bond market), the human acts first against the market their screen shows, and AI bond-take wants clamp to the phase-start market cash. Three regression tests (simult_test.go) pin all three leaks; docs/ai-api.md documents the contract. The v2 super-AI agent on #80 has been re-briefed to predict rival rates from last-turn behavior instead of reading them, so nothing under development depends on the old leak.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Winnie/bankwars#84
No description provided.