Skip to content

[5566] fix(ci): Fail the Railway preview bootstrap when a service is missing - #5588

Merged
mmabrouk merged 2 commits into
release/v0.106.2from
fix/railway-bootstrap-verify
Jul 31, 2026
Merged

[5566] fix(ci): Fail the Railway preview bootstrap when a service is missing#5588
mmabrouk merged 2 commits into
release/v0.106.2from
fix/railway-bootstrap-verify

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

In the #5560 preview environment, bootstrap reported success even though the cron service was never created: a transient Railway API failure during railway add was swallowed by >/dev/null 2>&1 || true, so the setup job went green while the environment was permanently missing a service. Every later deploy then failed deterministically with "Service 'cron' not found", and "Re-run failed jobs" could never repair it because the green setup job never re-runs.

The fix

  • After all the railway add calls, bootstrap reads the environment's actual service list from railway status --json and re-attempts creation for anything missing. After 3 attempts (tunable via RAILWAY_SERVICE_VERIFY_ATTEMPTS / RAILWAY_SERVICE_VERIFY_DELAY) it exits non-zero and names the missing services, so the setup job goes red and a plain re-run repairs the environment.
  • ensure_volume had the same silent-swallow pattern; a failed volume create is now a hard error.
  • configure.sh now explains that "Re-run all jobs" is the fix when it hits a missing service, instead of leaving the reader with an unrecoverable-looking red deploy.

What stays tolerant, and why

Service creation is still tolerant of "already exists", so re-bootstrapping a healthy environment remains a no-op. Environment create, domain create, and the read-side guards keep their existing tolerance too: they are either idempotent by nature or checked downstream, and hard-failing them would break the re-bootstrap path this fix is meant to protect.

Verification

  • bash -n on both scripts.
  • A stubbed-railway functional test covering three scenarios: healthy re-bootstrap (exit 0), transient failure that self-heals on retry (exit 0), and persistent failure (exit 1 with the missing service named).

Closes #5566

https://claude.ai/code/session_01Qitvc9dCiunLishsJYRzbp

…#5566)

A transient Railway API failure during 'railway add' was silently swallowed, so the setup job went green while the environment was permanently missing a service, and every later deploy failed deterministically. Bootstrap now verifies the environment's actual service list after creation, retries anything missing (RAILWAY_SERVICE_VERIFY_ATTEMPTS/_DELAY), and exits non-zero naming the missing services so a plain re-run repairs the environment. The same silent swallow in ensure_volume is now a hard error, and configure.sh tells the user that 'Re-run all jobs' is the fix when it hits a missing service.

Claude-Session: https://claude.ai/code/session_01Qitvc9dCiunLishsJYRzbp
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 30, 2026
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Jul 30, 2026 5:51pm

Request Review

@dosubot dosubot Bot added the ci/cd label Jul 30, 2026
@mmabrouk

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved Railway environment bootstrapping by verifying that all required services are created before configuring storage volumes.
    • Bootstrap now retries missing service creation and fails clearly when required services remain unavailable.
    • Volume setup errors are surfaced instead of being silently ignored.
    • Added clearer guidance when a service cannot be found, including instructions to rerun all deployment jobs.

Walkthrough

Railway bootstrap now tracks and verifies expected services, retries missing service creation, and fails on volume errors. Volume setup runs only after service verification. Configure diagnostics now instruct operators to rerun all jobs when a service remains missing.

Changes

Railway bootstrap recovery

Layer / File(s) Summary
Service creation and verification
hosting/railway/oss/scripts/bootstrap.sh
Expected services are registered, missing services are retried and verified, and Redis and SeaweedFS are added before verification and volume setup.
Volume failure handling
hosting/railway/oss/scripts/bootstrap.sh
Service-selection and volume-creation failures now return errors instead of being ignored.
Configure diagnostics
hosting/railway/oss/scripts/configure.sh
A final “not found” failure reports that bootstrap may have missed the service and advises running “Re-run all jobs”.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • Agenta-AI/agenta#5322: Updates configure.sh with related service visibility and CLI-variable resolution handling.
  • Agenta-AI/agenta#5576: Implements overlapping Railway bootstrap verification and missing-service recovery changes.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implements the requested service verification, failure on missing services, and re-run-all-jobs guidance for #5566.
Out of Scope Changes check ✅ Passed The changes stay focused on Railway bootstrap and related diagnostics, with no obvious unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly summarizes the main change: Railway preview bootstrap now fails when a service is missing.
Description check ✅ Passed The description directly explains the missing-service failure, retry behavior, fatal volume errors, recovery guidance, and verification.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/railway-bootstrap-verify

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 commented Jul 30, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: edac381c-e3eb-4e90-a7cc-d4e266de2445

📥 Commits

Reviewing files that changed from the base of the PR and between 9ac0c55 and 24b82bc.

📒 Files selected for processing (2)
  • hosting/railway/oss/scripts/bootstrap.sh
  • hosting/railway/oss/scripts/configure.sh

Comment on lines +187 to +190
if printf '%s' "$output" | grep -qi "not found"; then
printf "Service '%s' is missing from the Railway environment — bootstrap likely failed to create it.\n" "$service" >&2
printf "Fix: use 'Re-run all jobs' (re-running only failed jobs skips the green setup job, so bootstrap never gets a chance to recreate the missing service).\n" >&2
fi

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

Do not report success after this missing-service error.

_cli_set_vars returns 1 here, but both fallback branches in upsert_service_vars discard that status and return 0 (Lines 219-220 and 229-231). A service can remain unconfigured while the job succeeds. Return the CLI helper’s status instead.

Proposed fix
-        _cli_set_vars "$service" "$@"
-        return 0
+        _cli_set_vars "$service" "$@"
+        return $?

Apply this in both fallback branches.

…le-set failures (#5566)

Railway throttles back-to-back volume adds ("Whoa there pal"), which railway_call's generic rate-limit matcher does not recognize. ensure_volume now re-checks the volume list before each of up to RAILWAY_VOLUME_ADD_ATTEMPTS attempts, so a half-succeeded add is never duplicated on the same mount path. upsert_service_vars now propagates the CLI helper's failure status instead of swallowing it, per CodeRabbit's review.

Claude-Session: https://claude.ai/code/session_01Qitvc9dCiunLishsJYRzbp
@mmabrouk

Copy link
Copy Markdown
Member Author

good catch @coderabbitai — applied in both branches.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@mmabrouk Thanks for addressing it in both branches! 🐇


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

You are interacting with an AI system.

@mmabrouk
mmabrouk changed the base branch from release/v0.106.1 to release/v0.106.2 July 31, 2026 16:48
@mmabrouk
mmabrouk merged commit 9999bb1 into release/v0.106.2 Jul 31, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant