Skip to content

grill run: renew the Battle.net sign-in and start the game in the user's own registry view - #91

Merged
Frotty merged 3 commits into
masterfrom
battlenet-outside-registry
Nov 17, 2026
Merged

Frotty merged 3 commits into
masterfrom
battlenet-outside-registry

Conversation

@Frotty

@Frotty Frotty commented Nov 17, 2026

Copy link
Copy Markdown
Member

Problem

grill run renews the -editor sign-in from the Battle.net app by copying the one-time WEB_TOKEN to EDITOR_TOKEN, then starts the game. Battle.net, the renewal and the game hand the sign-in to each other through HKCU.

A process started from a packaged (MSIX) app, such as the Claude desktop app or an editor started from inside one, reads and writes HKCU through the package's private copy, and so does everything it starts. Grill's reg.exe calls, the Battle.net it asked to launch and the game it started could each see a different registry from the rest of the machine. Tokens got lost, and clients stopped at the login panel.

This is the same change as wurstscript/WurstScript#1629 for Run Map.

Change

  • OutsideStart (new) starts a process through WMI (Win32_Process.Create), in the user's own context, on the same desktop. If WMI cannot start it, it falls back to ProcessBuilder.
  • The renewal now runs an embedded battlenet-token.ps1 that way, hidden. Grill reads its outcome from a redirected output file:
    • it reads only complete lines;
    • it reads again after the script exits;
    • it removes the file only after the script has let it go.
  • This replaces the Kotlin polling loop. The lock and the window watcher are kept.
  • New outcome token-not-visible: Battle.net started the game but no new token appeared. The user is told to quit Battle.net from its tray icon and start it from the Start menu.
  • grill run starts the game through OutsideStart on Windows, in the client's folder as before. Wine launches are unchanged.
  • AGENTS.md and templates/AGENTS.md no longer point at a tool that is not public.

Validation

  • ./gradlew test: 154 tests pass. BattleNetSignInTests (18) adds tests for:
    • the shipped renewal script and its command line (quoting, including typographic quotes);
    • UTF-16 output parsing, including a partial last line;
    • a script that ended, and one that is ended at its timeout;
    • every outcome's message;
    • command-line quoting;
    • a real WMI start of java, checking that arguments with spaces, quotes and trailing backslashes, and the working directory, arrive intact.
  • Live, from inside a Claude desktop session: a renewal through BattleNetSignIn.find().renew() succeeded in 3.3 s.
  • Not done: a full grill run of a map.

…r's own registry view

A process started from a packaged (MSIX) app, such as the Claude desktop app
or an editor started from inside one, reads and writes HKCU through the
package's private copy, and so does everything it starts. Battle.net, the
sign-in renewal and the game hand the sign-in to each other through HKCU, so
grill's reg.exe calls, the Battle.net it asked to launch and the game it
started could each see a different registry from the rest of the machine:
tokens were lost and clients stopped at the login panel.

OutsideStart starts a process through WMI (Win32_Process.Create), in the
user's own context on the same desktop, and falls back to ProcessBuilder when
WMI cannot start it. The renewal now runs an embedded battlenet-token.ps1 that
way, hidden, and reads its outcome from a redirected output file: complete
lines only, read again once the script has exited, and removed only after the
script has let it go. It replaces the Kotlin polling loop; the lock and the
window watcher stay. A renewal in which the app started the game but no new
token appeared reports that Battle.net itself was started from such an app,
and tells the user to start it from the Start menu. grill run starts the game
through OutsideStart on Windows, in the client's folder as before. This is the
same change as WurstScript's Run Map.

AGENTS.md and the project template no longer point at a tool that is not
public.
@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-17T22:22:40.435988Z bf6889b 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: 395d691d39

ℹ️ 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".

Comment thread templates/AGENTS.md Resolved
Projects whose notes came from the previous template get the refresh warning.
@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: 4ba1a49b5e

ℹ️ 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".

Comment thread src/main/kotlin/file/BattleNetSignIn.kt Resolved
After a renewal, grill read EDITOR_TOKEN through reg.exe in its own view to see
the launched client replace it. Inside a packaged app whose private copy
already held an EDITOR_TOKEN, that read never changed, so grill run stayed
blocked for the full 120 s after the client had signed in. A small watcher
script now starts outside grill's view right after the renewal, notes the
renewed token before the game starts, and reports once the client replaces
it. If it cannot start, grill reads the token from its own view as before.
@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. More of your lovely PRs please.

Reviewed commit: bf6889bb2f

ℹ️ 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 merged commit 9836ecf into master Nov 17, 2026
1 check passed
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