Public: anyone can read this; the crew can change it.

Games: hear what players do, say why it failed, heal what is safe, answer commands in seconds #17612

opened this in answer to

Merged 14h 14m ago, live in production

Games now hear kicks, failed joins, commands and starts, and say a repeated cause once with its fix. A console command now answers in about a second at the forge/agent, not 20 s. tsc, bun scripts/gate.ts --fix and the games tests pass; I did not run the full suite or check the page and terminal by eye.

Notes

opened this

Games now hear kicks, failed joins, commands and starts, and say a repeated cause once with its fix. A console command now answers in about a second at the forge/agent, not 20 s. tsc, bun scripts/gate.ts --fix and the games tests pass; I did not run the full suite or check the page and terminal by eye.

Healing is not done, and nothing in the log feed offers a fix as an action (see "Not done").

What changed, by number in the issue

  • 1, 4 (instrumented): the log feed now keeps kicks with their reason, joins the proxy refused, player commands and server starts with the time the server reported. /login and /register keep their name but never what follows.
  • 1, 4 (finding): the same cause twice becomes one finding in src/games/findings.ts. It names the cause (a mod the player's client lacks, whitelist, ban, version, full, timeout, unknown, or a non-operator trying an operator command), how often and who, the last reason as logged, and the fix. A kick text only selects a cause from a fixed list, never the fix, and is shown escaped. A non-operator trying an operator command counts at once; every other cause needs two.
  • Doors: the People block, the terminal's people tab and the games tool's people list (latest, findings) show the same events and findings. docs/features/games.md has a section on it.
  • 2: a game's refusal ("That player does not exist", "Unknown command") is recorded as failed for rcon and people commands, with the answer kept.
  • 3: /forge typed as a command is heard like !forge on Paper and Fabric, through the server's "issued server command: /forge" line. The agent's grep takes both.
  • 5: between full syncs the agent sends a light poll every second (FORGE_GAME_LIGHT_EVERY) that carries only results and returns only commands. A new test runs the real agent against a fake forge and checks the command is answered in under 3 s, and that the waker is never queried.
  • 6: after a sync with no answer, the next one says retry and the forge skips log lines it already holds. Only a retry is trusted to drop lines, so a line the game prints twice is kept.
  • 7: the agent no longer runs sh in forge-waker for people, metrics and chat reads.

Not done

  • Healing (retrying a stuck agent or wake): I did not build it. The forge cannot restart an agent, and "stuck wake" has no signal to detect yet. Findings only say what to do and queue nothing.
  • 8 (no ops after a successful op): I could not find a cause in the code, so I left it. Item 2 may account for it, but I did not check.
  • Joins and leaves in the log feed were already there; only the new kinds were added.
  • Event timestamps: an event's time is when the sync arrived, so I cannot report "kicked 0.3 s after joining".

Changed test: test/game-metrics.test.ts asserted that the "Done (3.2s)!" line counts as nothing. It is now a start event, so I changed that line.

To try: open /games/<box>/<server> and look at People for kick reasons and a finding with its fix. Send a console command and watch it answer in seconds.

review
[
  {"go": "/games/<box>/<server>", "look": "the People block", "expect": "a notice per finding with its cause, count, players, last reason and fix, and Latest lines like 'Bob was kicked: …' and 'hub started, ready in 52.3 s'"},
  {"go": "/games/<box>/<server>", "look": "send `say hi` in the console", "expect": "the answer shows within about 3 s"}
]

I reused parseLogLine, recordMetrics, game_player_event and eventsOf rather than adding a second event store.

🤖 Generated with Claude Code

Closes #17610

10 earlier comments
commented

Games now hear kicks, failed joins, commands and starts, and say a repeated cause once with its fix. A console command now answers in about a second at the forge/agent, not 20 s. tsc, bun scripts/gate.ts --fix and the games tests pass; I did not run the full suite or check the page and terminal by eye.

Healing is not done, and nothing in the log feed offers a fix as an action (see "Not done").

What changed, by number in the issue

  • 1, 4 (instrumented): the log feed now keeps kicks with their reason, joins the proxy refused, player commands and server starts with the time the server reported. /login and /register keep their name but never what follows.
  • 1, 4 (finding): the same cause twice becomes one finding in src/games/findings.ts. It names the cause (a mod the player's client lacks, whitelist, ban, version, full, timeout, unknown, or a non-operator trying an operator command), how often and who, the last reason as logged, and the fix. A kick text only selects a cause from a fixed list, never the fix, and is shown escaped. A non-operator trying an operator command counts at once; every other cause needs two.
  • Doors: the People block, the terminal's people tab and the games tool's people list (latest, findings) show the same events and findings. docs/features/games.md has a section on it.
  • 2: a game's refusal ("That player does not exist", "Unknown command") is recorded as failed for rcon and people commands, with the answer kept.
  • 3: /forge typed as a command is heard like !forge on Paper and Fabric, through the server's "issued server command: /forge" line. The agent's grep takes both.
  • 5: between full syncs the agent sends a light poll every second (FORGE_GAME_LIGHT_EVERY) that carries only results and returns only commands. A new test runs the real agent against a fake forge and checks the command is answered in under 3 s, and that the waker is never queried.
  • 6: after a sync with no answer, the next one says retry and the forge skips log lines it already holds. Only a retry is trusted to drop lines, so a line the game prints twice is kept.
  • 7: the agent no longer runs sh in forge-waker for people, metrics and chat reads.

Not done

  • Healing (retrying a stuck agent or wake): I did not build it. The forge cannot restart an agent, and "stuck wake" has no signal to detect yet. Findings only say what to do and queue nothing.
  • 8 (no ops after a successful op): I could not find a cause in the code, so I left it. Item 2 may account for it, but I did not check.
  • Joins and leaves in the log feed were already there; only the new kinds were added.
  • Event timestamps: an event's time is when the sync arrived, so I cannot report "kicked 0.3 s after joining".

Changed test: test/game-metrics.test.ts asserted that the "Done (3.2s)!" line counts as nothing. It is now a start event, so I changed that line.

To try: open /games/<box>/<server> and look at People for kick reasons and a finding with its fix. Send a console command and watch it answer in seconds.

review
[
  {"go": "/games/<box>/<server>", "look": "the People block", "expect": "a notice per finding with its cause, count, players, last reason and fix, and Latest lines like 'Bob was kicked: …' and 'hub started, ready in 52.3 s'"},
  {"go": "/games/<box>/<server>", "look": "send `say hi` in the console", "expect": "the answer shows within about 3 s"}
]

I reused parseLogLine, recordMetrics, game_player_event and eventsOf rather than adding a second event store.

🤖 Generated with Claude Code

commented

<!-- look-pages 052f1323098a --> Look pages for 052f132, from the gate:

  • look pages (none): this pull changes src/web/pages/games.ts but the forge could not trace the route of /, /docs, /explore and 29 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

Merged main into the branch and pushed; the branch now merges cleanly. The one conflict was in src/games/agent.sh, in the full-sync body, where main added lend and this branch added retry. I kept both fields, and the full sync still sends the retry flag and main's lend_apply still runs. tsc is clean and the games tests and the unused-exports test pass (239 pass, 0 fail). I did not run the full suite.

The pull description from my earlier message still holds.

commented

<!-- look-pages a64cf4755ea0 --> Look pages for a64cf47, from the gate:

  • look pages (none): this pull changes src/web/pages/games.ts but the forge could not trace the route of /, /docs, /explore and 29 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

<!-- look-pages 5ca788f7696e --> Look pages for 5ca788f, from the gate:

  • look pages (none): "Looks: /games" is not a page of app.looks in forge.json; this pull changes src/web/pages/games.ts but the forge could not trace the route of /, /docs, /explore and 29 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

I replaced the Looks: /games line with a No look: line, as the gate allows, and pushed it as an empty commit (df15e892f). /games is not in app.looks in forge.json. A game server page also needs a box with a synced agent, and no look fixture has one. The commit message says that. No code changed, so I ran no tests.

commented

Items 1, 3, 4, 5 and 6 are fixed and pushed (4bdca86a3). Item 2 is not: this pull still does neither the heal nor the ops fix, and it does not close #17610. tsc is clean and the gate passes. The findings, people and terminal tests pass (37 pass, 0 fail), but I did not run the full suite or the agent's 3 s timing test after these changes.

  • 1. Failed light poll: it now waits out the rest of EVERY and then returns, so an outage no longer causes a full sync about once a second per box.
  • 2. Healing and ops (item 8): I opened #17617 for the missing ops after op and #17618 for healing, and I did not build either here. The cause of #17617 is unknown, and I chose not to guess at a fix. #18 needs a signal for a stuck wake that does not exist yet.
  • 3. Cause matching: whitelist, ban, full and version are tested before mods, and the mod words are anchored to the phrases Fabric and mod loaders use. A new test checks that "You are banned: modded client" gives a ban finding and a whitelist message naming Fabric gives a whitelist finding.
  • 4. False not-op findings: not-op only counts once the agent has read the lists, and a test covers the before-and-after.
  • 5. Findings as rows: each finding is a row in a rowList, with the cause as the title and the fix said once.
  • 6. FORGE_GAME_LIGHT_EVERY: it must be a whole number from 1 to 999, and anything else falls back to 1.

I did not change the timing test: it waits for the real agent to answer through a promise and no longer polls with a fixed sleep.

commented

I merged main into the branch, resolved the one conflict in src/games/store.ts, and pushed.

Conflict: main had also made the game's refusals count as failures (That player does not exist and similar). It did this in src/games/outcome.ts, through outcomeOf, which also lists the closest player names seen on that server. My branch had its own version of the same thing in store.ts.

  • What I kept from main: recordResults, which calls outcomeOf. The light sync now uses it too.
  • What I dropped: my GAME_REFUSAL regex and refusedByGame, since main's covers the same case.
  • What I kept from my branch: alreadyKept, the log dedupe that only runs when the agent says it is retrying a sync.

Checks:

  • tsc --noEmit is clean.
  • The 24 game test files pass (250 tests).
  • The gate ran. It only notes six files with comment lines over 100 columns, and says the nightly rewrap handles them on main. I did not run --fix and commit the result.
  • The test run logged denied calls to api.modrinth.com, which the sandbox blocks. Nothing failed because of them.
commented

I merged main into the branch, resolved the four conflicts and pushed. Type check and design lint are clean, and every game and MCP test I ran passes (1,561 tests). The forge's own check on the push has not reported yet. scripts/gate.ts --fix also rewrapped comments in 6 files, including some of main's cloud files, and I committed that with the merge.

main had meanwhile landed a second take on #17610: refused joins, wakes and stuck starts read from the proxy's log, a Modrinth lookup of the mods a refused player misses, and in-game replies telling them. It overlaps with what this branch does, so I kept both and made them fit.

  • Refused joins: main owns them. I removed this branch's own proxy-refusal parsing from src/games/metrics.ts, because it would have logged the same refusal twice. The test for it now checks the line is ignored there.
  • What this branch keeps: kicks with their reason, commands and starts as events, and src/games/findings.ts for kick and command findings (whitelist, ban, version, mods, not-op). I narrowed its query to kicks and commands so it no longer duplicates main's refusal findings.
  • Event wording: main's eventWords in src/games/people.ts is now the one place that words every event, including kick, command and start. The old eventLine is gone.
  • Event kinds: PlayerEventKind now includes wake and stuck as well.
  • Where findings show: the web page keeps main's Findings block and this branch's rows under People. The terminal shows both lists.
  • MCP games tool: it returns findings as this branch's kick and command findings, and refusals as main's refusal findings. Nothing on main read the findings key, so only the new refusals key is added.
  • Quick polls and /forge: the quick poll, which answers a console command in seconds, and /forge typed as a slash command merged without conflict. Both are still there.

Run /games/<box>/<server> on a box whose log has a kick, a refused join and a start. People should show the kick findings and the events; Findings should show the refusal findings.

🤖 Generated with Claude Code

commented

The gate failed because my earlier --fix rewrapped comments in six cloud files this pull didn't write. I restored src/cloud/*, src/web/pages/cloud_tree.ts, test/cloud-inventory.test.ts and test/cloud-tree.test.ts to main's versions and pushed.

I re-ran bun scripts/gate.ts locally and it now passes, and bun x tsc --noEmit is clean. I did not re-run the tests, since this commit only reverts files to what main already has. The forge's check on the push has not reported yet.

The diff against main is now games files only. I left the long comment lines in src/games/metrics.ts, src/games/people.ts and src/games/store.ts as they were, since the gate says the nightly rewrap handles them.

The pull description from my previous message still applies.

🤖 Generated with Claude Code

commented

Games now hear what players do and say why it failed, merged with main's work on the same issue (#17610). Kicks with their reason, commands and server starts become events. The same kick twice becomes one finding with its cause and a fix, and an operator-only command typed by someone who isn't an operator is a finding at once. Refused joins, wakes and the Modrinth lookup of missing mods come from main and are not duplicated here.

What changed

  • Events: src/games/metrics.ts turns kick, command and start lines into events. Passwords typed after commands like /login are dropped. Refused joins are read only from the proxy's own log (src/games/player_events.ts), so one refusal is recorded once. eventWords in src/games/people.ts is the one place that words every event.
  • Findings: src/games/findings.ts covers kicks and commands only, with a fixed list of causes: whitelist, banned, full, version, client mods, timeout, not-op. A log line can only pick one of those causes; it never writes the fix. The not-op finding waits until the server's lists of operators have been read. main's refusal findings stay in their own Findings block.
  • Where they show: the web page lists kick and command findings once in the People block. The terminal and the MCP games tool show both kinds; the tool's findings key holds the kick and command findings and a new refusals key holds main's.
  • Commands in seconds: the agent's quick poll returns console commands at once. /forge typed as a slash command is heard like !forge. The waker is never asked for a shell.
  • Review fix: the People block had each finding twice after a bad merge. It now shows each once, and a new test renders /games/mc/hub and counts each finding exactly once. That test fails on the old page.

What to look at: the narrowing in findingsOf and in parseLogLine, which keeps this branch's findings beside main's refusals rather than repeating them.

Not done: the agent timing test still waits 3 s of real time. It could become flaky; it has not failed so far.

Checks: gate, type check and design lint pass, as do test/game-findings.test.ts, test/game-player-events.test.ts and test/tui-games.test.ts. I did not run the dead-code and /llms.txt budget tests locally; the forge's check runs them.

How to try it: open /games/<box>/<server> on a box whose server log has the same kick twice, a refused join and a start. People shows the kick finding once and the events under Latest; Findings shows the refusal and its fix.

[{"go":"/games/<box>/<server>","look":"People block","expect":"each kick or command finding appears exactly once, with how many times, who, and the fix"},{"go":"/games/<box>/<server>","look":"Findings block","expect":"refused joins from the proxy log with their fix, separate from People"},{"go":"/games/<box>/<server>","look":"People → Latest","expect":"kicks read 'X was kicked: reason', commands 'X ran /cmd', starts '<server> started, ready in N s'"}]

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs