Add use case: Game Server Management via API#58
Add use case: Game Server Management via API#58mcjkrs wants to merge 3 commits intohesamsheikh:mainfrom
Conversation
Order, configure, and control dedicated game servers for 17+ games (Valheim, Palworld, Rust, ARK, Factorio, etc.) through a REST API. Covers server lifecycle, config management, console commands, and logs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Note
|
| Cohort / File(s) | Summary |
|---|---|
Documentation & README README.md, usecases/game-server-management.md |
Added a new use case entry to README and introduced usecases/game-server-management.md. The new document details ordering and lifecycle APIs (start/stop/update), JWT auth flows, monitoring/logs/console access, supported games, per-game configs, setup steps, CRITICAL purchase/login token guidance, and example conversations. |
Sequence Diagram(s)
sequenceDiagram
participant User as "User (operator)"
participant Agent as "OpenClaw Agent"
participant API as "Game Server Hosting API"
participant GS as "Game Server Instance"
User->>Agent: "Order new server (game, region, config)"
Agent->>API: POST /servers {game, sku, config, jwt}
API-->>Agent: 201 Created {server_id, status=provisioning}
Agent->>User: "Server provisioning started (server_id)"
Agent->>API: GET /servers/{server_id}/status
API-->>Agent: 200 {status=running, ip, port}
User->>Agent: "Send console command /inspect"
Agent->>API: POST /servers/{server_id}/console {cmd}
API->>GS: deliver console command
GS-->>API: console output
API-->>Agent: console output
Agent->>User: console output
User->>Agent: "Stop server"
Agent->>API: POST /servers/{server_id}/actions {action: stop}
API-->>Agent: 202 Accepted {status=stopping}
Agent->>User: "Stop initiated"
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
🐰 I hopped through docs with joyful ears,
I nudged a server past provisioning fears,
A twitch, a ping, the console sings,
Start, stop, and logs on tiny wings,
Rabbit cheers for deployed game gears. 🎮
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title 'Add use case: Game Server Management via API' accurately and specifically describes the main change in the pull request, which adds a new use case document for game server management. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
Tip
Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.
Comment @coderabbitai help to get the list of available commands and usage tips.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@README.md`:
- Line 53: Update the use-case count badge in the README to reflect the new
entry: increment the number shown in the badge from 36 to 37 so it matches the
added "Game Server Management" table row (the badge token showing "36" in the
README header must be changed to "37").
In `@usecases/game-server-management.md`:
- Around line 46-55: Update the "Game Server Management" section added to
AGENTS.md to include an explicit warning that JWT bearer tokens must not be
pasted or stored in AGENTS.md (or any committed repo file); mention that tokens
should be stored in environment/secret storage (e.g., secrets manager, .env
excluded from VCS) and referenced at runtime, and add a brief sentence pointing
readers to the login-link/purchase flow as the source of the token rather than
manual paste; modify the "Game Server Management" heading content in AGENTS.md
accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 735824e7-113d-4975-91d2-f9807556c089
📒 Files selected for processing (2)
README.mdusecases/game-server-management.md
- Update use case count badge from 36 to 37 - Add explicit warning not to store JWT tokens in AGENTS.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@usecases/game-server-management.md`:
- Around line 58-73: The template lacks a mandatory confirmation step for the
billable endpoint POST /orders/purchase; update the operating rules and the
user-flow steps so the agent always asks for explicit confirmation before
calling POST /orders/purchase and, in that confirmation prompt, restates the
selected game, plan, region, billing term, and total price; modify the "Confirm
destructive operations" rule to include purchases and ensure any handler that
triggers POST /orders/purchase validates an explicit affirmative confirmation
containing those details before proceeding.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 92675a7a-1df4-4ed0-94f3-3b449c722e3f
📒 Files selected for processing (2)
README.mdusecases/game-server-management.md
- Add critical warning: send checkout/login URL to user before calling any tools - Add cron polling recommendation (every 30s) instead of while/sleep loops - Add purchase and claim endpoints to agent config example - Clarify purchase does not require auth Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
♻️ Duplicate comments (1)
usecases/game-server-management.md (1)
71-75:⚠️ Potential issue | 🟠 MajorRequire explicit confirmation for purchases and console actions.
Line 74 still limits confirmation to restart/config changes, but this doc also exposes a billable
POST /orders/purchaseflow and potentially destructivePOST /servers/{id}/consoleactions. Please require explicit confirmation for both, and for purchases restate the game, plan, region, billing term, and total price before calling the endpoint.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@usecases/game-server-management.md` around lines 71 - 75, Update the confirmation policy to require explicit user confirmation for purchases and console actions in addition to restarts/config changes: add explicit confirmation steps before invoking POST /orders/purchase and POST /servers/{id}/console, and for purchases require the assistant to restate and obtain confirmation of the game title, plan, region, billing term, and total price (clear summary) before calling the purchase endpoint; ensure the doc's checklist and any procedural text referencing restarts/config changes (the current "Confirm destructive operations") is broadened to include these two endpoints and the exact fields to be reiterated for purchases.
🧹 Nitpick comments (1)
usecases/game-server-management.md (1)
82-84: Document when the cron poller must stop.The polling flow says to create a 30s cron, but it never says to cancel it once
/auth/claimreaches a terminal state. Without that, agents can leave orphaned jobs running indefinitely and keep hammering the claim endpoint.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@usecases/game-server-management.md` around lines 82 - 84, Add explicit stop conditions for the 30s cron that polls GET /auth/claim: cancel the cron as soon as the claim response enters any terminal state (e.g., status:"ready" — after securely saving the JWT token — or status:"failed"/"expired"/"cancelled"), and also cancel on repeated non-recoverable HTTP errors or after a configurable max retry count/timeout to avoid orphaned jobs; document these terminal states and the requirement to clear the cron immediately after saving the JWT token (or on other terminal responses).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@usecases/game-server-management.md`:
- Around line 71-75: Update the confirmation policy to require explicit user
confirmation for purchases and console actions in addition to restarts/config
changes: add explicit confirmation steps before invoking POST /orders/purchase
and POST /servers/{id}/console, and for purchases require the assistant to
restate and obtain confirmation of the game title, plan, region, billing term,
and total price (clear summary) before calling the purchase endpoint; ensure the
doc's checklist and any procedural text referencing restarts/config changes (the
current "Confirm destructive operations") is broadened to include these two
endpoints and the exact fields to be reiterated for purchases.
---
Nitpick comments:
In `@usecases/game-server-management.md`:
- Around line 82-84: Add explicit stop conditions for the 30s cron that polls
GET /auth/claim: cancel the cron as soon as the claim response enters any
terminal state (e.g., status:"ready" — after securely saving the JWT token — or
status:"failed"/"expired"/"cancelled"), and also cancel on repeated
non-recoverable HTTP errors or after a configurable max retry count/timeout to
avoid orphaned jobs; document these terminal states and the requirement to clear
the cron immediately after saving the JWT token (or on other terminal
responses).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 37a0bede-c73c-4ed0-a6f3-a16a68139311
📒 Files selected for processing (1)
usecases/game-server-management.md
Summary
What the use case covers
Verification
This use case is based on a production API at claws.supercraft.host powering Supercraft game server hosting. The API is live, documented, and has been tested with AI agents.
Summary by CodeRabbit