Skip to content

Renew the Warcraft III sign-in from Battle.net before Run Map - #1624

Merged
Frotty merged 5 commits into
masterfrom
codex/battlenet-map-launch
Nov 17, 2026
Merged

Frotty merged 5 commits into
masterfrom
codex/battlenet-map-launch

Conversation

@Frotty

@Frotty Frotty commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Behavior

  • Before Run Map and Hot Run start a Warcraft III 3.x install that Battle.net manages, the language server renews the sign-in that -editor launches use, from the signed-in Battle.net app. The map then starts with the usual direct command (-launch -editor -windowmode windowed -loadfile ...), signed in.
  • wc3LaunchMode:
    • auto (default) renews when Battle.net is open, and otherwise launches on the stored sign-in, which may ask for a login.
    • battlenet asks the editor to offer Retry, Use Legacy Launch, and Cancel when it cannot renew.
    • legacy never renews.
  • Battle.net's settings are not edited, and the app is never restarted.

Why not launch through Battle.net

The first version of this PR staged the map in Battle.net's stored launch arguments and launched through the app. Measured on 3.0.1 and Battle.net 2.53, a client the app starts with -loadfile naming an existing file shows the in-game login panel anyway, so that never signed in. A client started with -editor signs in with EDITOR_TOKEN (HKCU\Software\Blizzard Entertainment\Warcraft III) and replaces it on each sign-in; once it lapses, every Run Map asks for a login.

Just before the app starts the game, it writes a one-time WEB_TOKEN. BattleNetSignIn.renew():

  1. asks the app to start Warcraft III;
  2. kills that client before it signs in, matching only a new Warcraft III.exe whose parent is Battle.net.exe;
  3. stores the token as EDITOR_TOKEN.

This takes about a second. It holds a shared loopback lock until the launched client has signed in, which the client shows by replacing EDITOR_TOKEN about ten seconds after launch; it waits at most two minutes. Released earlier, another tool could replace the token before this client read it.

Validation

  • Tests pass:

    • BattleNetSignInTest (3)
    • InitialBuildProgressTest (8)
    • MapRequestPatchTargetTests (17)
    • WurstBuildConfigTests (14)
    • BuildDiagnosticsTests (10)
    • MapModelReuseTests (56)

    The lock port is pinned to the value every tool computes for the same path.

  • Live on Windows, with an expired EDITOR_TOKEN put back first: BattleNetSignIn.renew() took 1.1 s, and the direct -launch -editor -windowmode windowed -loadfile launch then reached the map's loading screen with no login panel.

  • Live, renew, launch, then releaseWhenSignedIn(): the lock was held through the renewal and freed 10.5 s and 11.6 s after launch in two runs, and the map loaded signed in.

  • A Run Map started from VS Code has not been tried.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T12:57:02.993499Z 76c2872 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dcbf51ef07

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Frotty

Frotty commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: db48e969ed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…h it

A client Battle.net starts with -loadfile shows the in-game login panel
whenever the file exists, so staging the map in Battle.net's launch arguments
never signed in. Run Map's -editor launch signs in with EDITOR_TOKEN, which
lapses. BattleNetSignIn now has the app start the game, closes that client
before it spends the one-time WEB_TOKEN, stores the token as EDITOR_TOKEN, and
Run Map launches directly as before. Battle.net's settings are no longer
edited, so the restore command and its capability flag are gone.

Mechanism and shared lock: wc3-e2e-harness docs/BattleNetSignIn.md.
@Frotty Frotty changed the title Launch Wurst run maps through Battle.net Renew the Warcraft III sign-in from Battle.net before Run Map Nov 17, 2026
Releasing the lock right after the renewal let another tool's renewal
replace EDITOR_TOKEN before this client had read it, leaving two clients
one token. The lock now stays held until the client replaces EDITOR_TOKEN,
which it does as it signs in (about ten seconds after launch), or for at
most two minutes. This matches wc3-e2e-harness, which holds it until its
map reports.
@Frotty

Frotty commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 637082e8ff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…nceled

A run canceled during the "running" progress notification threw before the
cleanup that releases the lock, so the lock stayed held. The notification
now sits inside that cleanup.

A renewal canceled after it asked Battle.net for a client left that client
to open and keep running. Once the app has been asked, a failed or canceled
renewal now keeps the lock for 30 seconds and closes any client the app
starts, sparing games that were already running.
@Frotty

Frotty commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 76c28728bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant