Skip to content

fix(env): preserve hosted detection during client recovery - #7445

Merged
waleedlatif1 merged 1 commit into
stagingfrom
codex/fix-hosted-detection-recovery
Sep 3, 2026
Merged

fix(env): preserve hosted detection during client recovery#7445
waleedlatif1 merged 1 commit into
stagingfrom
codex/fix-hosted-detection-recovery

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Use the browser hostname for hosted detection when runtime configuration is unavailable during client recovery from server-rendering errors.
  • Preserve configured URL precedence and server behavior; cover hosted API key visibility before and after configuration arrives.

Type of Change

  • Bug fix

Testing

The recovery regression fails before the fix and passes afterward. Passed 70 focused Vitest tests, lint, all 45 repository audits, API validation, the env-flag audit, block-registry checks, and docs-manifest validation.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 3, 2026 8:27pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR preserves hosted-mode detection during client recovery when runtime configuration is temporarily unavailable, while retaining configured URL precedence and server-side behavior.

  • Falls back to the browser hostname until runtime configuration is available.
  • Adds browser-recovery coverage for hosted API-key visibility.
  • Adds Node coverage confirming configured self-hosted URLs retain precedence.
  • Updates runtime-environment documentation for Next.js error recovery.

Confidence Score: 5/5

The PR appears safe to merge with no concrete blocking or independently actionable non-blocking issues identified.

The fallback is limited to browser initialization without usable runtime configuration, while valid configured URLs continue to take precedence and server behavior remains unchanged.

Important Files Changed

Filename Overview
apps/sim/lib/core/config/env-flags.ts Adds browser-hostname fallback for hosted detection while preserving valid configured URL precedence and env-only server behavior.
apps/sim/lib/core/config/env.ts Updates documentation to describe runtime-environment availability during Next.js error-document recovery.
apps/sim/lib/core/config/env-flags.dom.test.ts Covers hosted model and API-key visibility before and after runtime configuration is installed during client recovery.
apps/sim/lib/core/config/env-flags.test.ts Verifies that a configured self-hosted URL overrides the browser hostname in production.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[env-flags module initializes] --> B{Runtime app URL available?}
  B -->|Yes and valid| C[Use configured URL hostname]
  B -->|No or invalid| D{Browser environment?}
  D -->|Yes| E[Use document hostname]
  D -->|No| F[Use empty hostname]
  C --> G[Compute hosted mode]
  E --> G
  F --> G
Loading

Reviews (1): Last reviewed commit: "fix(env): preserve hosted detection duri..." | Re-trigger Greptile

@waleedlatif1
waleedlatif1 merged commit fdbc7a7 into staging Sep 3, 2026
23 checks passed
@waleedlatif1
waleedlatif1 deleted the codex/fix-hosted-detection-recovery branch September 3, 2026 20:31
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