fix(cheats): a debug teleport the game dropped is sent once more, so the control bridge's teleport arrives #1046
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!1046
Loading…
Reference in a new issue
No description provided.
Delete branch "d4nkn3ss/Longshot:fix/teleport-resend-dropped"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The debug teleport (the Cheats page, and the control bridge's
teleport, which scripted runs and testers use) sometimes doesn't happen. The game answers the request 0 and drops it: nothing reserved (Sequence_ReservedNextBanc ""), no event playing, Link where he was. The control bridge'steleport --arrivethen times out, and a measured run stands in the wrong place. On this PC it was 6 of 159 scripted requests, 4 of them the first request a few frames after a save had loaded.The follow-up 1.5 s after each request already read exactly this state, but it only logged it. Now it sends a dropped request once more, to the same destination, so the map changes and the bridge's wait sees it arrive. A request that is under way (a map reserved, an event playing, the map loading), or that has arrived, is left alone, and a resent one is never sent a third time. A press refused in between (the 8 s one-request guard) no longer cancels the resend: the follow-up checks the last request actually sent (
teleport.pending), not the bridge's reply, which a refused call clears.On main: load an adult save with
HOS_OOT_CHEATS=1andHOS_CONTROL, and as soon as it is in playpython -I scripts/longshot_ctl.py --sock <pipe> teleport 3 --arrive 60; over several starts some time out, with the log'scheats: teleport check: reserved "", current "HyruleField_Adult", event playing 0.Read first:
host/oot_teleport_check.h(the decision, a pure function) andoot_teleport_followup()inhost/hos_main.c;tests/test_teleport_check.py.Testing
Tested:
74116b2f, the review fix): 10 starts, the first teleport (to the Market) the moment the save is in play. 9 arrived, the game reserving the Market at once, so none needed the resend. 1 did not, on the first start after the build (cold caches, 379 and 490 ms submits just after the request):result 0, then at the checkreserved "", current "HyruleField_Adult", event playing 1, and no map change in the next 60 s. The follow-up leaves a request with an event playing alone, as main does, so this is unchanged here (see Risks). No device loss,VK_ERRORor FATAL line; every run closed normally.65987971): 27 starts. 25 arrived: 6 interleaved with main, 15 alone, and 4 of 6 in a first script that didn't retry a refusal (its other 2 were refused at once with "an event is playing": the game refusing, not a drop). One resend; no device loss,VK_ERRORor FATAL line; every run closed normally.python -I -B tests/test_teleport_check.py: fails on main (the follow-up has no resend). On the review fix's test commit alone it fails for the review's case (FAIL: the follow-up still sends the dropped A again: 1, wanted 2), and it passes with the fix. With the follow-up'steleport.resent = 1removed it fails too (4, wanted 2).host/hos_main.ccompiles with the build's host flags (-fsyntax-only, the lifted headers of this PC's build), as on main, andpython3 -I -B tests/test_teleport_check.pypasses. The whole Linux host wasn't linked here.python -I -B tests/run_all.py(Windows, llvm-mingw from the Longshot Builder;misenot installed here): 766 passed, 63 failed here, against 764 passed, 64 failed on main @89c3d21e(one more check here: test_teleport_check). The 63 are the same on both. The extra one on main,test_recording_admission, is flaky on this PC on both sides: its parallel case failed in 4 of 4 reruns here and 2 of 4 on main.test_job_queuewas run from Git Bash, because started from this PowerShell it gets a Ctrl+C that ends the run: 20 of its 21 pass,Environment.test_ram_file_systemfails.Still to test:
@Beanstalk, or by hand)Measurements
Verdict: fixed: a dropped teleport is sent again and arrives. In 15 starts of this PR, the one request the game dropped arrived after the resend (
result 0, then0x1), and all 15 reached the Market. Main dropped 4 of 19 such first requests in that day's A/B runs, none of which arrived.Setup: Windows 11 Pro 26300, RTX 3080 10 GB (NVIDIA 621.14), i9-12900K, 64 GB; an adult save in Hyrule Field, the first teleport (to the Market) the moment the save is in play, uncapped; one start per run, read from
longshot_log.txtand the bridge's reply. Main's side is main @ 1764fed2's build;host/hos_main.cis the same ate4d035e9, which this PR was on then. Not measured again on current main (89c3d21e): between1764fed2and it, the teleport's request changed only in checking the guest buffers its strings are written to (hos_guest_range), and the follow-up not at all, so the numbers hold. This head's own 10 starts are in Tested.1764fed2Risks
A request the game takes more than 1.5 s to reserve, with no event playing, would be sent twice. In 159 requests every slow one had an event playing or a map reserved by then, and the six with neither never arrived until another request came. A request the game answers 0 while an event is playing, and that the event then swallows, is still not sent again: the follow-up can't tell that event from the teleport's own one under way. It happened once in this PR's last 10 starts (and is the same on main); the bridge's
--arrivethen times out as before. Turning it off: a revert. A player notices nothing beyond a teleport that now arrives; the log gains thesent againline when it happens.When #823 (the expanded Teleport page) meets this, the resend has to send that request's whole target (map, spawn, boot event, carrier) rather than destination 0: whichever lands second carries that.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 11, RTX 3080 (NVIDIA 621.14): 27 starts of this build, each loading a save and teleporting to the Market through the control bridge; one request dropped by the game was sent again and arrived, all 27 arrived, no device loss or errors
WIP: fix(cheats): a debug teleport the game dropped is sent once more, so the control bridge's teleport arrivesto fix(cheats): a debug teleport the game dropped is sent once more, so the control bridge's teleport arrivesA correction to my in-game note above: not all 27 arrived. 25 did. The other 2 were in a first script that didn't retry a refusal, and the game refused both at once ("an event is playing"). That's the game refusing while the save's arrival plays, not a drop, and this PR doesn't change it. The 21 starts of the matching script (6 interleaved with main, then 15 alone) all arrived, one of them after the resend. The Testing section now says the same.
Posted by an AI agent (Claude Code) for d4nkn3ss.
Seen again while testing #434 (Windows 11, RTX 3080, NVIDIA 621.14), in a build of main @
3e4e7cabwith #434 merged (#434 touches only draw binding, not the teleport): a teleport to the Market (destination 3) asked for from Hyrule Field was dropped in one of about ten runs that day that teleported. The log shows the case this PR resends:Nothing reserved, no event playing, still in Hyrule Field, and
longshot_ctl teleport 3 --arrivetimed out. That run's Market measurement was taken in the field and was thrown out.Code-only review of
65987971ad; informational findings, with final approval left to another reviewer.P2 — Keep the pending retry's destination separate from the last attempted request's reply (
host/hos_main.c:1190). Send a teleport that the game drops, then press teleport again before its 1.5-second follow-up. The second call clearsteleport.bancat line 1001 before rejecting the request under the 8-second guard. The originalcheck_atremains armed, but the new follow-up passes NULL tooot_teleport_dropped(), which returns false, then clears the timer. The first request therefore never gets its promised retry. The clearing of the reply field is pre-existing; this PR introduces the dependency on that mutable field for retrying an earlier request. Store the pending target separately and replace it only when a new request is actually sent. Add a behavioral sequence test: sent-but-dropped A, rejected B, follow-up retries A exactly once. This is a source-derived case, not a reproduced game failure.The predicate fixture covers individual decisions, but the follow-up check only searches source strings. It would still pass if the post-call
teleport.resent = 1were removed:oot_teleport()resets the flag, allowing repeated retries. Exercising the actual follow-up with a stubbed request would protect the once-only rule as well as the rejected-request case.Merge coordination: the expanded Teleport page also changes this request path. Its
oot_travel_place()temporarily setsplace_target, callsoot_teleport(..., 0), and clears the override. Combining the branches unchanged would resend an arbitrary place as destination 0 after a drop. Preserve the complete original target (map, spawn, boot event and carrier mode) when integrating them; this is a combined-branches hazard, not a defect in this branch alone.Existing evidence includes the author's corrected Windows report (25 arrivals in 27 starts; two immediate refusals), one successful resend and game-free checks. The declared Linux host/check and manual Cheats-page run remain outstanding. I read the full diff, request/follow-up and bridge callers, test, existing comments and relevant sibling changes. No tests, builds or game runs were performed.
A second press before the follow-up drops the resend. I read head
65987971. It applies onto current main.oot_teleportclearsteleport.bancon entry, before the 8-second guard returns. A dropped request still has its follow-up armed. A press in that 1.5 seconds is ignored, and the follow-up then sees no destination, so it does not send the first request again. Keep the pending map and destination until a request is actually sent. The check that only searches the follow-up forteleport.resent = 1still passes if the line afteroot_teleportis removed, because the line before it remains. #823 also changes this request. Combined as they are, a dropped place would be sent again as destination 0. Keep the map, spawn, boot event and carrier when those two meet. The Linux Cheats-page teleports named in Must be tested are still open.Brought up to the ready-for-review standard (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know).
fix(cheats): a debug teleport the game dropped is sent once more, so the control bridge's teleport arrivesto WIP: fix(cheats): a debug teleport the game dropped is sent once more, so the control bridge's teleport arrivesBack to work in progress: the review's fix (keep the dropped request's target apart from the bridge's reply, and a sequence test of the follow-up) is done locally and goes up with the next push, then a run of it in the game before it is ready again.
Posted by an AI agent (Claude Code) for d4nkn3ss.
Pushed
3623460dand74116b2fon main @89c3d21e(merged in, not rebased), for the review by @TrashPanda and @bibiburl:teleport.pending, the map of the last request actually sent, set only when a request goes out. The bridge's reply,teleport.banc, which a refused call clears, is left as it was.teleport.destinationwas already set only for a request sent.tests/test_teleport_check.pyhas a sequence fixture now: teleport's state, the start ofoot_teleport(its refusals, the 8 s guard among them), its bookkeeping of a request sent, andoot_teleport_followup, all cut fromhost/hos_main.cand run with the game's reads stubbed. Cases: A dropped is sent again once and not a third time; A dropped, then B refused 0.5 s later, and A is still sent again once, to A's destination; A arrived is not sent again; a refusal alone sends nothing. On the test commit alone it fails for the review's case (the follow-up still sends the dropped A again: 1, wanted 2). With theteleport.resent = 1after the resend removed it fails as well (4, wanted 2).Back to WIP until I've run the fix in the game. The Linux build and the Cheats-page run are still in Still to test.
Posted by an AI agent (Claude Code) for d4nkn3ss.
The review fix (
74116b2f) ran in the game: 10 starts on Windows 11 with an RTX 3080 (NVIDIA 621.14), the first teleport to the Market the moment the save is in play.result 0, and at the check an event was playing with nothing reserved. The follow-up leaves that state alone, as main does, so it is unchanged here; Risks now says so.VK_ERRORor FATAL line, and every run closed normally.On Linux (Debian under WSL, gcc 14.2),
host/hos_main.ccompiles with the build's host flags (syntax only) andtests/test_teleport_check.pypasses. A full Linux build and Cheats-page teleports are left for the Test Farm.The Measurements numbers were taken on main @
1764fed2. They still hold on89c3d21e: between the two, main changed only the guest-buffer bounds checks on the request's strings, and didn't touch the follow-up.Marking it ready for review. @TrashPanda, both points from your review are in
74116b2f, as the earlier comment says.Posted by an AI agent (Claude Code) for d4nkn3ss.
WIP: fix(cheats): a debug teleport the game dropped is sent once more, so the control bridge's teleport arrivesto fix(cheats): a debug teleport the game dropped is sent once more, so the control bridge's teleport arrivesRecommendation: Approve. It fixes the dropped debug teleport where it happens, in the host's follow-up, and it resolves both of TrashPanda's code points. A resend can't fire during an event, a load or an arrival, or go out a second time. Players never arm this path. Recommend approval; not approved on the forge.
For testers and scripted runs (the Cheats page,
longshot_ctl teleport --arrive, the tours anddev.py ab), the game sometimes drops a teleport (result 0, nothing reserved, no event). The host now sends that request once more 1.5 s later, so it arrives and no longer times out. The code gets better: the follow-up already read this state and only logged it. The cost is 25 lines in a debug path and a pure, tested predicate.Does it help: Yes, by the author's runs (Windows 11, RTX 3080, NVIDIA 621.14). The first teleport after a save loads: main dropped 4 of 19 in the day's A/B runs, and none of those arrived. This PR: 1 of 15 was dropped, sent again, and all 15 arrived. On the review-fix head
74116b2fthere were 10 starts: 9 arrived without needing the resend, and 1 was the event-playing case the PR leaves alone, as main does (Risks). The counts are small, but the effect is binary (arrives or times out) and the log shows the resend working.Other systems: This is debug-only.
check_atis armed only byoot_teleport, and only the Cheats page, the control bridge and the age toggle call that, so a player without those never reaches the resend. Its state is touched only undercheats_lock(hos_oot_lift_player). The logic is OS- and GPU-independent C with no new game call beyondSequence_IsLoadingBanc, whichoot_teleportalready reads. Linux was compiled syntax-only, not linked. The bridge's reply (accepted,map) is computed from the original call and is unchanged. The age toggle's resend goes throughoot_teleport, notoot_toggle_age, so the age is not flipped twice.Switches: none.
Reviewed:
74116b2f08against89c3d21ea1(main's parent of the merge7d49aef455;host/hos_main.cis unchanged on main since, up to3df5c13ed2). I read in fullhost/oot_teleport_check.h,tests/test_teleport_check.py, and inhost/hos_main.c:teleport,oot_teleport,oot_toggle_age,oot_teleport_followup,oot_bridge_teleport_done,oot_update_player_cheatsup to the action dispatch, andhos_oot_lift_player's lock. I also read sibling #1922's diff andmap_changeinscripts/tours/drive.py. Nothing was run (a code review).Fixed in this review: nothing.
Checked and fine:
teleport.pending, which is set only after a request goes out (ok ? banc : NULL). A refusal clears onlybanc/why, the bridge's reply.destinationwas already set only on a send.oot_teleportprelude, its bookkeeping and the follow-up. The author reports that it fails with the post-callteleport.resent = 1removed (4, wanted 2) and for the refused-B case on the test commit alone.EventMgr+104) or a map is loading. If either begins between the check and the send,oot_teleport's own refusals (event playing, loading, no event manager) refuse the resend. The follow-up runs only from Link's update, i.e. in play. A save adds no new exposure: the resend is one request 1.5 s after the user's own, under the same refusals a manual press has.pendingis set only when a request is sent, and an arrived request (current == wanted) is left alone, as is one under way (map reserved).resentsurvives the resend's ownoot_teleport(set again after the call), so there is never a third send. The resend restarts the 8 s guard at its own time, so a press right after it is refused as usual. A refused resend leavescheck_at0, so nothing loops. The only remaining double is the slow reserve (>1.5 s with no event and nothing reserved), which Risks states and measures as not seen in 159 requests.pendingpoints into the staticoot_destinationsstrings, so its lifetime is fine.next/currentare now initialised, so a failed read compares"", not stack garbage.current == wantedreads as arrived. That is unchanged from main.Suggestions (the author may take or leave)
host/hos_main.c:1261: the predicate could also requireteleport.result == 0. Every drop in the description was answered 0, and a request the event manager took (accepted: true) is the one most likely to be merely slow to reserve. That would narrow the only double-send case in Risks at no cost.tests/test_teleport_check.py: the sequence fixture stubs the event-playing and loading reads to 0. So if the follow-up passed the wrong value intooot_teleport_dropped, the "no resend during a cutscene/load" rule would only be covered by the predicate's own cases, not end to end. One sequence case with an event playing at the check (expect 1 send) would close that.host/hos_main.c:1263: the firstteleport.resent = 1;before the call is redundant. A send resets it and the line after sets it again, and a refusal leavescheck_at0. It is harmless.Testing: The author ran 27 + 10 starts in the game on Windows 11 with an RTX 3080 (above), and reports the test failing on main and passing here, plus a Linux syntax-only compile under WSL. Still missing are the full Linux build with Cheats-page teleports (in Still to test;
@Beanstalkor by hand) and CI: its jobs show "Blocked by required conditions" on74116b2f. Neither should change the result, since the logic is platform-independent, but CI must pass before merge.Overlaps and merge order:
accepted: false). The two address the same symptom at different layers. This PR fixes the cause at the host, for every caller. The other one shortens the driver's wait. They are not duplicates, but they do not compose cleanly as they stand. With both merged, a dropped request (accepted false at t=0) is resent by the host at 1.5 s, and its arrival can land after 1922's 5 s wait. The driver then counts it unmoved, asks again, waits out the 8 s guard that the resend restarted, and teleports a second time into the map Link has just reached. Merge this one first. 1922 should then check the state before each re-ask (or treat the cooldown refusal and a load in progress as "in flight"), or keepNOT_TAKEN_Sabove the host's 1.5 s resend plus a load. Its own case (the event-swallowed drop this PR leaves alone) is still worth keeping.@ -1251,0 +1260,4 @@the control bridge's wait for the map sees it arrive. oot_teleport_check.h) */if (oot_teleport_dropped(next, current, teleport.pending, playing, loading, teleport.resent)) {hos_log("cheats: teleport to %s dropped by the game (nothing reserved, no event): sent again", teleport.pending);teleport.requested_at = 0;Nit: this first resent = 1 is redundant. A send resets it and the line after the call sets it again, and a refused resend leaves check_at 0.
@ -1251,0 +1258,4 @@hos_log("cheats: teleport check: reserved \"%s\", current \"%s\", event playing %d", next, current, playing);/* (dropped by the game, as a request a few frames after a save has loaded is: sent once more, the 8 s guard aside, sothe control bridge's wait for the map sees it arrive. oot_teleport_check.h) */if (oot_teleport_dropped(next, current, teleport.pending, playing, loading, teleport.resent)) {Suggestion: also require teleport.result == 0 here. Every drop in the description was answered 0, and a request the event manager took is the one most likely to be only slow to reserve, which is the double-send case in Risks.
@HumanBean thank you for the review. All three suggestions are taken, but this merged at
74116b2fbefore they were in, so they're in a follow-up: #1950.resent = 1is gone.It's mutation-checked, and it ran in the game: 6 first teleports, each answered 0x1 and none sent again; on this head with the same change, 10 starts with one drop resent and arrived.
On #1922 (merged too): arrivals take 7-9 s here, longer than its 5 s wait. After a host resend, the driver can ask again once the 8 s guard ends and reload the map Link just reached. I'm looking at that next.
Posted by an AI agent (Claude Code) for d4nkn3ss.
Correction to my comment above: arrivals take 3.0 to 3.9 s of wall time here (4 timed first teleports on the RTX 3080), not 7-9 s. I had counted frames at 60 a second, and these runs present at 100-200.
So a request the host resends at 1.5 s arrives at about 5 s, right at #1922's 5 s wait. The driver also reads the map when its wait runs out, so a second teleport needs the arrival to land just after that read: a narrow window, not the common case. Unless someone has seen it in a run, I'll leave #1922 as merged and not change the driver.
Posted by an AI agent (Claude Code) for d4nkn3ss.