WIP: feat(agent): send the game's performance statistics when a plan asks #113
No reviewers
Labels
No labels
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
priority
critical
priority
high
priority
low
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Beanstalk!113
Loading…
Reference in a new issue
No description provided.
Delete branch "gab9281/Beanstalk:feat/perf-statistics"
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?
The farm's PCs run the same scenes the same way on many GPUs, but their frame times never reach the team's performance dashboards. With this PR, a test plan can ask for them: the farm's game starts then send Longshot's own performance statistics, the way a player's launcher does when Send performance statistics is ticked.
What
[[probe]] kind = "perf_statistics"(plan schema 10), lets a PR's.farm/test.toml, a maintainer's/beanstalk planwords, or the planner (only when the PR asks) request the statistics. Plans without it send nothing. Agents now sayplan_schema = 10, so a schema-10 plan only goes to agents that read it.perf_statistics = falseinpolicy.toml, or the new Settings tick (on by default), always wins. The agent reads it again just before sending. A localrunnever sends.longshot_perf.ini:send=1,keep_sent=0), so the game leaves a summary inperf_pending/every 5 minutes of play and at exit.Core/PerfStatistics.cs,JobPipeline.SendPerfAsync).perf_reportsnames in main'snx2/addresses.ini.client: "Beanstalk", kept apart from the players' summaries. Each also carries anidentifier: the job, its side, and the build variant and attempt when there are more than one (jb_0123456789abcdef-pr,…-baseline-v3,…-pr-a2). On the dashboards, Client = Beanstalk plus that Identifier shows one run on its own. The relay has taken this optional v2 label since Longshot-api #26 (merged and deployed). The dashboards default to Client = Longshot, the players.perf_statisticscan't also have agpu_passesorscreenshotprobe, ashotstep, or a cold cache (driver_cold,cold). Those slow the frames, and the summary wouldn't say so. Both plan readers refuse such plans, on shared fixtures. Adriver_warmscenario's unmeasured start sends nothing.docs/test-plan.mdlists what stays unlabeled:[scenario.env]switches and build variants, which only the identifier names. One identifier covers a whole side; the summaries split it by map.perf_pending/.After: this PR. Settings gains the tick; before, there was none. Rendered from the app's own view, headless, with a throwaway agent home.
Security (CONTRIBUTING.md: this changes what the agent uploads)
Why upload this. The farm's frame times, by map and by GPU, are what the performance dashboards lack. A summary holds what a player's launcher already sends (Longshot's
docs/user/performance-report.md): hardware and driver models, which the farm already reports; frame-time histograms and hitches by map; and Link's position to the nearest 100 units. Nothing comes from the volunteer's files, saves, user name or PC name. Inside the sandbox, the user and the hostname are bothbeanstalk.perf_pending/is written by PR code and read outside the sandbox. The agent:.jsonfiles: never through a link, never a FIFO or socket (opening a FIFO would wait for a writer forever), and never whenperf_pending/or the runtime folder is itself a link. It never writes the tick into a linked runtime folder either;kMaxBody) that still fits the relay's limit once relabeled. Anything else is dropped unsent. It always overwritesclientandidentifier;perf_pending/only after every sandboxed process is gone (the session's process tree is killed, and bwrap's--die-with-parent), so nothing can swap a file between the check and the read.Hardlinks to a volunteer's file can't be made from the sandbox. Each writable folder is a separate bind mount, and a hardlink can't cross a mount (EXDEV). The volunteer's home is never mounted.
Reviews and tests
/code-review high), 10 findings:perf_statisticsintopolicy.tomlfollows thehiddenkey's pattern./security-review high): no finding at or above the bar. Its one hardening suggestion, refusing a linked runtime folder, is in.agent/tests/agent_core/PerfStatisticsChecks.cshas 56 checks. They cover the policy key and the plan gate; the tick; the relay address (https only); the relabel (no escaping growth, a duplicate key, empty, oversized, the relay's limit); the identifier, with variant and attempt; the send outcomes; and the files that must never be read: a symlink to a "volunteer's file", a FIFO, an empty file, a linkedperf_pending/or runtime folder, and a warm-up start's summaries.python3 -I -B agent/tests/test_agent_core.py --strict: 2277 checks pass. That includes the coordinator and the agent normalizing every plan fixture the same way, the 6 new ones too.pytestpasses the plan and planner tests, includingtest_perf_statisticsand its refusals. Locally the full suite has 8 failures intests/test_regression.py, and the same 8 fail on a cleanorigin/mainhere. CI is the judge.dotnet build agent/Beanstalk.Agent.slnx -c Release: 0 warnings, 0 errors.PerfStatistics.SendAsyncsent a summary to the live relay. It arrived in Prometheus asclient="Beanstalk",identifier="jb_e2echeck-pr", with 250 s of Kokiri Forest. A symlink planted next to it was neither read nor sent. Players' series stay without an identifier.To test
A maintainer or volunteer with a farm PC: run a job whose
.farm/test.tomladdsThe agent's log should end with
performance statistics: N summaries sent to the team's Grafana. On Longshot performance, with Client = Beanstalk, the job's identifier should be listed under Identifier.🤖 Generated with Claude Code
https://claude.ai/code/session_015KgSKnCVhRNx6p3Y8Zabk4
After: this PR, Settings' new tick (the app's window, rendered headless with a throwaway agent home).
WIP: feat(agent): send the game's performance statistics from the farm's runsto WIP: feat(agent): send the game's performance statistics when a plan asksView command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.