Skip to content

fix: Ability to force the game to start for a benchmark. - #17

Open
webbrain-one wants to merge 1 commit into
AsynchronousAI:mainfrom
webbrain-one:webbrain/issue-7
Open

fix: Ability to force the game to start for a benchmark.#17
webbrain-one wants to merge 1 commit into
AsynchronousAI:mainfrom
webbrain-one:webbrain/issue-7

Conversation

@webbrain-one

@webbrain-one webbrain-one commented Aug 12, 2026

Copy link
Copy Markdown

Closes #7

Summary by CodeRabbit

  • New Features
    • Added an optional playtime mode for benchmark execution.
    • When enabled, users are prompted to automatically start game simulation for benchmarks.
    • Added a “Do not show again” option to save the prompt preference.
    • Benchmark execution can now wait to start until the user accepts the simulation prompt.

Add `Playtime = true` configuration attribute. When enabled, displays a popup
prompting the user to start the game via RunService:Run() with an option to
suppress the message.

Closes AsynchronousAI#7
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The plugin adds a disabled-by-default PLAYTIME configuration flag. When enabled, it prompts for benchmark game simulation, persists the suppression choice, and defers RunService.Run() when accepted.

Changes

Playtime benchmark startup

Layer / File(s) Summary
Playtime configuration
src/configurations.ts
Adds the exported PLAYTIME boolean under Benchmark Execution. The default is false.
Conditional startup flow
src/index.server.tsx
Imports PLAYTIME, checks the persisted suppression setting, prompts for confirmation, stores the “Do not show again” choice, and defers game simulation when accepted.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: asynchronousai

Sequence Diagram(s)

sequenceDiagram
  participant BenchmarkPlugin
  participant PersistentSetting
  participant ConfirmationPrompt
  participant RunService
  BenchmarkPlugin->>PersistentSetting: Check suppression setting
  BenchmarkPlugin->>ConfirmationPrompt: Prompt when playtime is enabled
  ConfirmationPrompt-->>BenchmarkPlugin: Return confirmation and do-not-show-again choice
  BenchmarkPlugin->>PersistentSetting: Store suppression choice
  BenchmarkPlugin->>RunService: Defer Run() when accepted
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: forcing the game to start for benchmarks.
Linked Issues check ✅ Passed The changes add the PLAYTIME configuration, show the RunService:Run() prompt, and persist the suppression choice required by issue #7.
Out of Scope Changes check ✅ Passed All changes support benchmark playtime configuration and game-start prompting; no unrelated changes are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/index.server.tsx`:
- Line 20: Update the setting lookup in the suppressed initialization to call
Plugin.GetSetting with only the Scriptbench_SuppressPlayPrompt key, then apply a
strict boolean check to the returned Variant so an unset result does not enable
suppression.
- Around line 27-28: Update the checked branch around plugin settings and the
deferred RunService.Run call to persist the accepted decision in its own
setting, separate from Scriptbench_SuppressPlayPrompt. On subsequent plugin
loads, read that stored decision and defer RunService.Run only when it is
accepted; preserve the declined behavior. Add regression coverage for accepted
and declined checked flows across two loads.
- Around line 22-26: Replace the unsupported plugin.PromptGlobalConfirm call in
the confirmation flow with a supported PluginGui API, preserving the auto-start
prompt and “Do not show again” behavior. Use the resulting supported GUI
interaction to determine the accepted and checked states without relying on
undeclared methods or adding a runtime shim.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ddaa5519-5642-491f-a8a0-b6ca08dd1ee1

📥 Commits

Reviewing files that changed from the base of the PR and between f58e09e and 2cf715f.

📒 Files selected for processing (2)
  • src/configurations.ts
  • src/index.server.tsx

Comment thread src/index.server.tsx
if (RunService.IsRunMode()) return;

if (PLAYTIME) {
const suppressed = plugin.GetSetting("Scriptbench_SuppressPlayPrompt", false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

rg -n --hidden --glob '!node_modules' --glob '!dist' 'GetSetting|Scriptbench_SuppressPlayPrompt|interface Plugin|class Plugin' .

Repository: AsynchronousAI/scriptbench

Length of output: 1827


🌐 Web query:

Roblox Plugin GetSetting API signature optional second argument

💡 Result:

The Roblox Plugin:GetSetting API does not have an optional second argument [1][2][3]. The official method signature is defined as Plugin:GetSetting(key: string): Variant [1][2]. It accepts only a single string argument representing the key of the setting to retrieve [1][4]. If you need to provide a default value when a setting does not exist, you should handle the nil return value in your Lua code [1][5]. A common pattern is to use the or operator: local value = plugin:GetSetting("MyKey") or defaultValue [5]

Citations:


🏁 Script executed:

printf '%s\n' '--- package and type files ---'
git ls-files | rg '(^|/)(package\.json|tsconfig[^/]*\.json|.*\.d\.ts)$'
printf '%s\n' '--- relevant source ---'
cat -n src/index.server.tsx | sed -n '1,45p'
printf '%s\n' '--- Plugin and GetSetting declarations ---'
rg -n -C 4 --hidden --glob '!node_modules' --glob '!dist' \
  'GetSetting\s*\(|declare.*Plugin|interface Plugin|type Plugin' \
  . --glob '*.d.ts' --glob '*.ts' --glob '*.tsx' --glob '*.luau'

Repository: AsynchronousAI/scriptbench

Length of output: 13625


🏁 Script executed:

node - <<'JS'
const fs = require('fs');
const path = 'src/index.server.tsx';
const source = fs.readFileSync(path, 'utf8');
const match = source.match(/plugin\.GetSetting\(([^)]*)\)/);
if (!match) throw new Error('GetSetting call not found');
const args = match[1].split(',').map(s => s.trim()).filter(Boolean);
console.log(JSON.stringify({ call: match[0], argumentCount: args.length, arguments: args }));
JS

Repository: AsynchronousAI/scriptbench

Length of output: 313


Call Plugin:GetSetting with one argument. Plugin:GetSetting accepts only the setting key. Use a strict boolean check for the unset Variant result.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/index.server.tsx` at line 20, Update the setting lookup in the suppressed
initialization to call Plugin.GetSetting with only the
Scriptbench_SuppressPlayPrompt key, then apply a strict boolean check to the
returned Variant so an unset result does not enable suppression.

Source: MCP tools

Comment thread src/index.server.tsx
Comment on lines +22 to +26
const [accepted, checked] = plugin.PromptGlobalConfirm(
"Auto-Start Game",
"Would you like to automatically start the game simulation for benchmarks?",
"Do not show again"
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find project-local declarations or implementations.
rg -n '\bPromptGlobalConfirm\b' . || true

# Inspect installed roblox-ts declarations when dependencies are present.
if [ -d node_modules/@rbxts/types ]; then
  rg -n '\bPromptGlobalConfirm\b|\binterface Plugin\b' \
    node_modules/@rbxts/types || true
fi

Repository: AsynchronousAI/scriptbench

Length of output: 252


🏁 Script executed:

set -euo pipefail

printf '%s\n' '--- tracked files ---'
git ls-files | sed -n '1,120p'

printf '%s\n' '--- project metadata ---'
for f in package.json tsconfig.json src/index.server.tsx; do
  if [ -f "$f" ]; then
    printf '\n--- %s ---\n' "$f"
    cat -n "$f"
  fi
done

printf '%s\n' '--- Plugin API references ---'
rg -n '\bPlugin\b|PromptGlobalConfirm|PLAYTIME|plugin\.' src package.json tsconfig.json 2>/dev/null || true

Repository: AsynchronousAI/scriptbench

Length of output: 22539


🏁 Script executed:

set -euo pipefail

printf '%s\n' '--- local type declarations ---'
fd -a -t f . | rg '(^|/)(types|.*\.d\.ts)(/|$)' | sed -n '1,160p'
rg -n '\bPromptGlobalConfirm\b|\binterface Plugin\b|\bdeclare (global|const) plugin\b' \
  --glob '!bun.lock' --glob '!Scriptbench.rbxm' . || true

printf '%s\n' '--- locked Roblox types version ---'
rg -n -C 3 'node_modules/@rbxts/types|`@rbxts/types`@' bun.lock || true

printf '%s\n' '--- PLAYTIME definition and references ---'
cat -n src/configurations.ts | sed -n '1,70p'
rg -n -C 3 '\bPLAYTIME\b' src

Repository: AsynchronousAI/scriptbench

Length of output: 5615


🌐 Web query:

Official Roblox Creator Hub Plugin class API reference: determine whether Plugin:PromptGlobalConfirm exists and identify the supported confirmation-dialog API, if any.

💡 Result:

The method Plugin:PromptGlobalConfirm does not exist in the official Roblox Plugin class API [1][2]. There is no built-in, native API provided by the Plugin class for creating generic confirmation dialogs [1][2]. Developers requiring such functionality typically implement custom dialog systems by creating a GUI using a PluginGui (such as a DockWidgetPluginGui) and managing the input events manually [3][4]. While developers often seek native solutions, common practice involves building modular UI components or using community-created libraries to handle confirmation flows, as no standardized, engine-level confirmation-dialog method is exposed for plugins [5][6]. Additionally, PluginGui:BindToClose can be used to intercept the closing of a plugin window, where a custom confirm button can be injected to require user interaction before the window closes [3][4].

Citations:


🏁 Script executed:

set -euo pipefail

tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT

curl -fsSL \
  'https://registry.npmjs.org/@rbxts%2ftypes/1.0.880' \
  -o "$tmpdir/metadata.json"

tarball="$(jq -r '.dist.tarball' "$tmpdir/metadata.json")"
curl -fsSL "$tarball" -o "$tmpdir/types.tgz"

if tar -tzf "$tmpdir/types.tgz" | grep -qE '(^|/)PromptGlobalConfirm|(^|/)Plugin\.d\.ts'; then
  tar -xzf "$tmpdir/types.tgz" -C "$tmpdir"
  rg -n '\bPromptGlobalConfirm\b|\binterface Plugin\b' "$tmpdir/package" || true
else
  printf '%s\n' 'No matching Plugin declaration file or PromptGlobalConfirm symbol in the package archive.'
fi

Repository: AsynchronousAI/scriptbench

Length of output: 254


🏁 Script executed:

set -euo pipefail

tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT

curl -fsSL \
  'https://registry.npmjs.org/@rbxts%2ftypes/1.0.880' \
  -o "$tmpdir/metadata.json"

tarball="$(jq -r '.dist.tarball' "$tmpdir/metadata.json")"
curl -fsSL "$tarball" -o "$tmpdir/types.tgz"
tar -xzf "$tmpdir/types.tgz" -C "$tmpdir"

printf '%s\n' '--- matching declarations ---'
rg -n '\bPromptGlobalConfirm\b|\binterface Plugin\b|\bclass Plugin\b' \
  "$tmpdir/package" || true

printf '%s\n' '--- declaration files containing Plugin ---'
find "$tmpdir/package" -type f \( -name '*.d.ts' -o -name '*.d.luau' \) \
  -print0 | xargs -0 rg -l '\bPlugin\b' | sed -n '1,80p'

Repository: AsynchronousAI/scriptbench

Length of output: 985


Replace the unsupported PromptGlobalConfirm call. Plugin in @rbxts/types@1.0.880 and the Roblox API do not define this method. The repository has no declaration or runtime shim. Implement the confirmation flow with a supported PluginGui API.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/index.server.tsx` around lines 22 - 26, Replace the unsupported
plugin.PromptGlobalConfirm call in the confirmation flow with a supported
PluginGui API, preserving the auto-start prompt and “Do not show again”
behavior. Use the resulting supported GUI interaction to determine the accepted
and checked states without relying on undeclared methods or adding a runtime
shim.

Source: MCP tools

Comment thread src/index.server.tsx
Comment on lines +27 to +28
if (checked) plugin.SetSetting("Scriptbench_SuppressPlayPrompt", true);
if (accepted) task.defer(() => RunService.Run());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 8 \
  'Scriptbench_SuppressPlayPrompt|accepted|checked|RunService\.Run' .

Repository: AsynchronousAI/scriptbench

Length of output: 6694


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- tracked candidates ---'
git ls-files | rg '(^|/)(src/index\.server\.tsx|.*(test|spec).*\.(ts|tsx|lua|luau)|package\.json|tsconfig.*|README.*)$' | head -200

printf '%s\n' '--- index.server.tsx ---'
cat -n src/index.server.tsx

printf '%s\n' '--- PromptGlobalConfirm and setting API references ---'
rg -n -C 6 'PromptGlobalConfirm|GetSetting|SetSetting|Scriptbench_SuppressPlayPrompt|RunService\.Run' src package.json README.md 2>/dev/null || true

printf '%s\n' '--- package scripts ---'
if [ -f package.json ]; then
  node -e 'const p=require("./package.json"); console.log(JSON.stringify(p.scripts||{}, null, 2))'
fi

Repository: AsynchronousAI/scriptbench

Length of output: 14240


🌐 Web query:

Roblox Studio Plugin PromptGlobalConfirm return values checked do not show again

💡 Result:

There is no native method named PromptGlobalConfirm in the Roblox Plugin API. It is likely you are either referring to a custom-implemented UI module or are encountering a misunderstanding regarding available Studio plugin dialogs [1][2][3]. Because there is no native "PromptGlobalConfirm" method, there is no built-in "do not show again" return value functionality associated with it. If you are using a third-party plugin or custom module that provides a message box or confirmation dialog, you must handle "do not show again" logic manually using standard plugin data storage methods [4][5]. To implement a "do not show again" feature in your own plugin, follow these steps: 1. Use plugin settings to store the user's preference. Roblox plugins provide the:SetSetting and:GetSetting methods specifically for persisting small bits of data, such as user preferences, across sessions [5]. 2. Before displaying your custom dialog or confirmation GUI, check the stored setting using:GetSetting. 3. If the setting indicates the user has chosen not to see the prompt again, skip the display logic. 4. If the user checks a "do not show again" box in your custom UI, save that choice using:SetSetting so it persists for future sessions [4][5]. If you were looking for standard ways to prompt users in Studio, the Plugin object provides methods like PromptForExistingAssetId, but these do not include "do not show again" persistence out of the box [6][3]. For custom interfaces, developers typically create a custom PluginGui (via Plugin:CreateDockWidgetPluginGui) and manage the UI state manually [2][7][8].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

python3 - <<'PY'
def current_startup(suppressed, accepted=None, checked=None):
    runs = False
    writes = []
    if not suppressed:
        if checked:
            writes.append(("Scriptbench_SuppressPlayPrompt", True))
        if accepted:
            runs = True
    return runs, writes

cases = [
    ("accepted-and-checked", False, True, True),
    ("declined-and-checked", False, False, True),
]
for name, suppressed, accepted, checked in cases:
    first = current_startup(suppressed, accepted, checked)
    second = current_startup(True)
    print(name)
    print(" first_load:", first)
    print(" next_load:", second)
PY

printf '%s\n' '--- test infrastructure and prompt API declarations ---'
git ls-files | rg '(^|/)(.*\.(test|spec)\.(ts|tsx|lua|luau)|.*\.d\.ts$|package\.json)$' | head -200
rg -n 'PromptGlobalConfirm|interface Plugin|declare.*Plugin|GetSetting\(' . --glob '!src/index.server.tsx' --glob '!src/settings.ts' 2>/dev/null || true

Repository: AsynchronousAI/scriptbench

Length of output: 3264


Persist and apply the auto-start decision.

When checked is true, persist accepted separately from Scriptbench_SuppressPlayPrompt. On later plugin loads, run RunService.Run() when the stored decision is accepted, and do not run it when the stored decision is declined. Add regression coverage for both checked flows across two loads.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/index.server.tsx` around lines 27 - 28, Update the checked branch around
plugin settings and the deferred RunService.Run call to persist the accepted
decision in its own setting, separate from Scriptbench_SuppressPlayPrompt. On
subsequent plugin loads, read that stored decision and defer RunService.Run only
when it is accepted; preserve the declined behavior. Add regression coverage for
accepted and declined checked flows across two loads.

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.

Ability to force the game to start for a benchmark.

1 participant