Skip to content

fix(steam): roll back failed proxy preparation - #304

Merged
bobtista merged 3 commits into
developmentfrom
fix/steam-proxy-rollback
Jul 29, 2026
Merged

fix(steam): roll back failed proxy preparation#304
bobtista merged 3 commits into
developmentfrom
fix/steam-proxy-rollback

Conversation

@bobtista

@bobtista bobtista commented Jul 27, 2026

Copy link
Copy Markdown

Summary

Prevent failed Steam proxy preparation from leaving the proxy installed.

Changes

  • Validate filesystem prerequisites before replacing the executable.
  • Roll back mutations after failures or cancellation.
  • Preserve pre-existing backups and artifacts.
  • Retain recovery files when rollback cannot safely proceed.
  • Add focused filesystem regression tests.

Testing

  • Release solution build passed.
  • All 1,228 tests passed.

Risks and rollback

Process termination can bypass managed rollback. File locks or concurrent changes may prevent restoration; recovery files are retained and reported.

Related issues

Fixes #303

Greptile Summary

Prevents failed Steam proxy preparation from leaving installation mutations behind.

  • Serializes Steam launch setup by canonical installation path, including symbolic-link and junction aliases.
  • Validates filesystem prerequisites before replacing the game executable.
  • Restores captured files after preparation failures or cancellation and retains recovery artifacts when restoration is unsafe.
  • Rejects unverified backups instead of treating stale backup contents as authoritative.
  • Adds focused regression tests for cleanup, rollback, cancellation, backup handling, and concurrent launches.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported installation serialization, filesystem-alias, and stale-backup issues are addressed by the current locking and verification paths.

Important Files Changed

Filename Overview
GenHub/GenHub/Features/Launching/GameLauncher.cs Serializes the complete Steam setup window by canonical installation path and now aborts when pre-launch cleanup cannot safely restore the installation.
GenHub/GenHub/Features/Launching/InstallationPathLockKey.cs Canonicalizes existing symbolic-link and junction components so aliases of one physical installation share the same lock key.
GenHub/GenHub/Features/Launching/SteamLauncher.cs Adds mutation serialization, prerequisite validation, verified backup handling, transactional rollback, and conflict-preserving recovery behavior.
GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Launching/GameLauncherTests.cs Adds coverage proving that concurrent launches through physical and aliased installation paths serialize their Steam setup.
GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Launching/SteamLauncherTests.cs Adds filesystem regression coverage for preparation, cleanup, rollback, cancellation, stale backups, recovery states, and concurrent mutation attempts.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Steam profile launch] --> B[Canonicalize installation path]
    B --> C[Acquire installation launch lock]
    C --> D[Verify and clean prior proxy state]
    D --> E[Validate workspace and filesystem prerequisites]
    E --> F[Capture original files and executable]
    F --> G[Deploy proxy and write configuration]
    G --> H{Preparation succeeds?}
    H -->|Yes| I[Commit prepared state]
    H -->|No or canceled| J[Roll back current mutations]
    J --> K{Safe restoration possible?}
    K -->|Yes| L[Restore original state]
    K -->|No| M[Retain recovery files and report conflict]
Loading

Reviews (3): Last reviewed commit: "fix(steam): canonicalize installation lo..." | Re-trigger Greptile

Context used:

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@bobtista, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 14 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1adff5e1-4d27-453b-8b13-1e20b7454c04

📥 Commits

Reviewing files that changed from the base of the PR and between 5ba2a51 and a4565f6.

📒 Files selected for processing (5)
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Launching/GameLauncherTests.cs
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Launching/SteamLauncherTests.cs
  • GenHub/GenHub/Features/Launching/GameLauncher.cs
  • GenHub/GenHub/Features/Launching/InstallationPathLockKey.cs
  • GenHub/GenHub/Features/Launching/SteamLauncher.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/steam-proxy-rollback

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.

Comment thread GenHub/GenHub/Features/Launching/SteamLauncher.cs
Comment thread GenHub/GenHub/Features/Launching/SteamLauncher.cs Outdated
{
var backupStagingPath = CreateTemporaryPath(_backupPath);
_temporaryFiles.Add(backupStagingPath);
File.Copy(_targetExePath, backupStagingPath, overwrite: 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.

CRITICAL: Missing file existence check before copying target executable

The code attempts to copy _targetExePath without checking if it exists. This can fail when the target executable doesn't exist but the backup file does (e.g., after previous proxy deployment).

The validation in PrepareForProfileAsync (line 129) allows this scenario, so File.Copy(_targetExePath, backupStagingPath, overwrite: false) at line 544 will throw FileNotFoundException if _targetExePath doesn't exist.

Suggested change
File.Copy(_targetExePath, backupStagingPath, overwrite: false);
if (!File.Exists(_backupPath))
{
var backupStagingPath = CreateTemporaryPath(_backupPath);
_temporaryFiles.Add(backupStagingPath);
if (_targetInitiallyExisted)
{
File.Copy(_targetExePath, backupStagingPath, overwrite: false);
File.Move(backupStagingPath, _backupPath, overwrite: false);
_temporaryFiles.Remove(backupStagingPath);
_backupCreated = true;
}
}

Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Launching/GameLauncherTests.cs
  • GenHub/GenHub/Features/Launching/GameLauncher.cs
  • GenHub/GenHub/Features/Launching/InstallationPathLockKey.cs
  • GenHub/GenHub/Features/Launching/SteamLauncher.cs
Previous Review Summaries (2 snapshots, latest commit 99a3b69)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 99a3b69)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (4 files)
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Launching/GameLauncherTests.cs
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Launching/SteamLauncherTests.cs
  • GenHub/GenHub/Features/Launching/GameLauncher.cs
  • GenHub/GenHub/Features/Launching/SteamLauncher.cs

Previous review (commit 2ad21f2)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
GenHub/GenHub/Features/Launching/SteamLauncher.cs 544 Missing file existence check before copying target executable
Files Reviewed (2 files)
  • GenHub/GenHub/Features/Launching/SteamLauncher.cs - 1 issues
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Launching/SteamLauncherTests.cs - 0 issues

Fix these issues in Kilo Cloud


Reviewed by glm-4.7 · Input: 56.1K · Output: 6.2K · Cached: 343.6K

@bobtista bobtista self-assigned this Jul 28, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 28, 2026
Comment thread GenHub/GenHub/Features/Launching/GameLauncher.cs Outdated
@bobtista
bobtista merged commit 5e29ec4 into development Jul 29, 2026
7 checks 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