[fix] Repair incomplete Railway previews [AGE-4023] - #5576
Conversation
|
@huige66631 is attempting to deploy a commit to the agenta projects Team on Vercel. A member of the Team first needs to authorize it. |
|
✅ Thanks @huige66631! This PR now meets the contribution requirements and has been reopened. A maintainer will review it soon. |
📝 WalkthroughSummary by CodeRabbit
WalkthroughRailway preview bootstrap now skips existing services, verifies all 13 required services before success or volume creation, and reports recovery guidance for missing services. Mocked CLI scenarios and a targeted GitHub Actions workflow validate the scripts. ChangesRailway preview recovery
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Bootstrap
participant RailwayCLI
participant RailwayEnvironment
participant Configure
Bootstrap->>RailwayCLI: Query service status
RailwayCLI->>RailwayEnvironment: List services
RailwayEnvironment-->>Bootstrap: Existing service names
Bootstrap->>RailwayCLI: Add missing services
Bootstrap->>RailwayCLI: Verify expected services
RailwayCLI-->>Bootstrap: Service visibility
Configure->>RailwayCLI: Set service variables
RailwayCLI-->>Configure: Missing-service error
Configure-->>Configure: Print re-run-all-jobs guidance
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
hosting/railway/oss/scripts/bootstrap.sh (1)
27-41: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRequired-service list is duplicated across bootstrap.sh and its test. Both files independently define the same 13-service array; a future change to one without the other lets the mock test pass while no longer reflecting bootstrap's actual reconciliation set.
hosting/railway/oss/scripts/bootstrap.sh#L27-L41: keep as the canonicalEXPECTED_SERVICESdefinition, but consider making it easy to source (e.g., factor into a small sourced file or emit it via a--list-servicesflag) so the test can consume it directly.hosting/railway/oss/scripts/tests/test_preview_bootstrap.sh#L11-L11: derive this array from bootstrap.sh's canonical list instead of hardcoding a second copy..github/workflows/39-railway-script-tests.yml (1)
17-17: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low valueConsider
persist-credentials: falseon checkout.Minor defense-in-depth: this job checks out and runs PR-supplied scripts; disabling credential persistence avoids leaving the (already read-only) token in
.git/configfor the remainder of the job.Source: Linters/SAST tools
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2e1a2a5f-ed0e-4cfc-b362-880e58207cd6
⛔ Files ignored due to path filters (1)
docs/design/railway-preview-bootstrap-recovery/mock-test-output.pngis excluded by!**/*.png
📒 Files selected for processing (9)
.github/workflows/39-railway-script-tests.ymldocs/design/railway-preview-bootstrap-recovery/README.mddocs/design/railway-preview-bootstrap-recovery/context.mddocs/design/railway-preview-bootstrap-recovery/plan.mddocs/design/railway-preview-bootstrap-recovery/research.mddocs/design/railway-preview-bootstrap-recovery/status.mdhosting/railway/oss/scripts/bootstrap.shhosting/railway/oss/scripts/configure.shhosting/railway/oss/scripts/tests/test_preview_bootstrap.sh
| # Pin a 4.37-era SeaweedFS: its advanced IAM (the STS path mounts need) regressed in other releases. | ||
| SEAWEEDFS_IMAGE="${SEAWEEDFS_IMAGE:-chrislusf/seaweedfs:4.37}" |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
SeaweedFS image pin appears to be out of this fix's declared scope.
context.md's Out Of Scope section states: "Changing service names, images, volumes, or the preview workflow's public inputs." This line pins a new SEAWEEDFS_IMAGE default, which is exactly the kind of change the design doc excludes. Either drop this from the fix (track it separately) or update context.md/plan.md to acknowledge the expanded scope so the design docs stay accurate.
|
Thanks for the catch. |
|
Thanks @huige66631 for the investigation and the careful write-up. The problem you identified is real, and your instinct (verify actual Railway state before reporting success) is the right one. We're closing the PR anyway, for three reasons:
The mocked Railway CLI test harness was a genuinely good idea and we may borrow the pattern. Thanks again for contributing. |
Summary
Repair Railway pull request previews when a transient service-creation failure
would otherwise leave the environment permanently incomplete.
Demo
The mocked Railway CLI test exercises the recovery paths described below.
Context
A transient Railway API error could prevent preview bootstrap from creating a
service, while
bootstrap.shstill printedBootstrap completed. The deploythen failed with
Service 'cron' not found. Re-running only failed jobs couldnot repair the preview because the successful bootstrap job did not run again.
Before this change, service creation used:
That command hid the error and treated a missing service as a successful setup.
Changes
Bootstrap now reads the linked Railway environment and reconciles the 13
required services before it reports success. It skips services that already
exist. For a missing service, it runs
railway addand leaves any error in thejob log.
The final Railway status check decides the result. A failed add can mean that
Railway rejected the request, or that Railway created the service before the
CLI timed out. Bootstrap succeeds only when Railway lists every required
service. Otherwise it fails and names the missing services before it creates
volumes.
When
configure.shseesService '<name>' not found, it now tells the user tore-run all jobs. That runs bootstrap again and gives it a chance to repair the
preview.
The design workspace is in
docs/design/railway-preview-bootstrap-recovery/.Tests / notes
bash hosting/railway/oss/scripts/tests/test_preview_bootstrap.shwitha mocked Railway CLI. It verifies existing services, a failed
croncreatethat leaves it absent, a CLI timeout that still creates
cron, and theconfigure recovery message.
bash -nfor the changed Bash scripts andgit diff --check.jqand runs the mocktest when Railway scripts change.
Railway credentials. That is the remaining end-to-end check.