Skip to content

Force classic SCP for GCP deployment copies - #189

Merged
lawrencecchen merged 5 commits into
mainfrom
fix/gcp-classic-scp
Aug 7, 2026
Merged

lawrencecchen merged 5 commits into
mainfrom
fix/gcp-classic-scp

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

What

  • route every GCP deployment copy through one classic-SCP wrapper
  • cover the wrapper with a behavior test

Why

The default SFTP transport stalled for roughly four minutes during the v0.1.72 staging golden run. The same copy with --scp-flag=-O completed in about three seconds. The stall pushed the held Codex HTTP request past its five-minute application timeout before listener handoff.

Verification

  • regression commit fails because the wrapper is absent
  • focused test passes after the fix
  • go test ./...
  • shell syntax checks for every touched deployment script
  • live staging SCP probe completed in about three seconds

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Force classic SCP for all GCP deployment copies via a gcloud-scp.sh wrapper, with a fallback for older scp clients. This prevents SFTP stalls that caused multi-minute delays and timeouts.

  • Bug Fixes
    • Added deploy/gcp/gcloud-scp.sh that probes scp -O support and passes --scp-flag=-O only when supported.
    • Updated all GCP deploy scripts to use the wrapper for file copies.
    • Expanded tests to run the wrapper with fake gcloud/scp, asserting legacy mode when available and argument preservation.

Written for commit 3377306. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Improvements

    • Improved Google Cloud VM file transfers by consistently using a compatibility mode for legacy SCP connections.
    • Preserved existing project, zone, secure tunneling, quiet-mode, and source/destination options across deployment and migration workflows.
    • Added clearer command validation and usage feedback when required transfer arguments are missing.
  • Tests

    • Added coverage confirming legacy SCP protocol settings and transfer arguments are applied correctly.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

GCP SCP wrapper adoption

Layer / File(s) Summary
Legacy SCP wrapper and integration test
deploy/gcp/gcloud-scp.sh, cmd/subrouter/deploy_scripts_test.go
Adds argument validation and forces --scp-flag=-O. The integration test verifies forwarded arguments.
Deployment script adoption
deploy/gcp/*.sh
Routes GCP file transfers through gcloud-scp.sh while preserving existing destinations and transfer options.

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

Sequence Diagram(s)

sequenceDiagram
  participant DeploymentScript
  participant gcloud-scp.sh
  participant gcloud
  DeploymentScript->>gcloud-scp.sh: Pass transfer arguments
  gcloud-scp.sh->>gcloud: Run compute scp with --scp-flag=-O
  gcloud-->>gcloud-scp.sh: Return transfer status
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: forcing classic SCP for GCP deployment copies.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/gcp-classic-scp

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.

🧹 Nitpick comments (1)
cmd/subrouter/deploy_scripts_test.go (1)

30-35: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Run the wrapper as production runs it.

Deployment scripts invoke gcloud-scp.sh directly. This test invokes bash wrapper, so it does not verify the executable bit or the shebang. Invoke wrapper directly.

Proposed test adjustment
 command := exec.Command(
-		mustLookPath(t, "bash"), wrapper, fakeGcloud,
+		wrapper, fakeGcloud,
🤖 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 `@cmd/subrouter/deploy_scripts_test.go` around lines 30 - 35, Update the
command construction in the deployment script test to execute wrapper directly
instead of invoking it through the bash executable. Preserve the existing
arguments, environment setup, and output/error assertions so the test exercises
the wrapper’s executable permission and shebang.
🤖 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.

Nitpick comments:
In `@cmd/subrouter/deploy_scripts_test.go`:
- Around line 30-35: Update the command construction in the deployment script
test to execute wrapper directly instead of invoking it through the bash
executable. Preserve the existing arguments, environment setup, and output/error
assertions so the test exercises the wrapper’s executable permission and
shebang.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1e98bf86-12b9-4164-ae29-aafbe3b3c9cd

📥 Commits

Reviewing files that changed from the base of the PR and between b8f7f28 and 78bcc3c.

📒 Files selected for processing (11)
  • cmd/subrouter/deploy_scripts_test.go
  • deploy/gcp/create-subrouter-vm.sh
  • deploy/gcp/deploy-live-upgrade.sh
  • deploy/gcp/finalize-legacy-retirement.sh
  • deploy/gcp/finalize-slot-retirement.sh
  • deploy/gcp/gcloud-scp.sh
  • deploy/gcp/migrate-to-front-slots.sh
  • deploy/gcp/normalize-staging-predecessor.sh
  • deploy/gcp/publish-subrouter.sh
  • deploy/gcp/rollback-slot.sh
  • deploy/gcp/switch-front-migration.sh

@lawrencecchen
lawrencecchen merged commit 390cc0e into main Aug 7, 2026
7 checks passed
@lawrencecchen
lawrencecchen deleted the fix/gcp-classic-scp branch August 7, 2026 03:02
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