Skip to content

fix(desktop): don't persist ephemeral preview-proxy URLs (CODE-373)#241

Open
lucas77778 wants to merge 1 commit into
masterfrom
chenyu/code-373
Open

fix(desktop): don't persist ephemeral preview-proxy URLs (CODE-373)#241
lucas77778 wants to merge 1 commit into
masterfrom
chenyu/code-373

Conversation

@lucas77778

Copy link
Copy Markdown
Member

Summary

  • add a shared browser URL predicate for the daemon's ephemeral <kind>--<id>.localhost preview namespace
  • clear blob and preview-proxy URLs during desktop shell serialization and rehydration while preserving normal HTTPS URLs
  • cover blob, file, artifact, service preview, and durable URL persistence behavior

Testing

  • devenv shell -- pnpm check:ci
  • devenv shell -- pnpm test (213 files, 1657 tests)

Linear: https://linear.app/arcbox/issue/CODE-373/fixdesktop-dont-persist-ephemeral-preview-proxy-urls-in-the-browser

Copilot AI review requested due to automatic review settings July 22, 2026 05:19
@linear-code

linear-code Bot commented Jul 22, 2026

Copy link
Copy Markdown

CODE-373

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR prevents temporary preview URLs from surviving desktop restarts. The main changes are:

  • A shared predicate for daemon-style .localhost preview URLs.
  • Browser URL filtering during desktop serialization and rehydration.
  • Tests for blob, file, artifact, service-preview, and HTTPS URLs.

Confidence Score: 4/5

The preview-host predicate can erase unrelated local browser URLs and needs a narrower namespace check.

  • Serialization and rehydration apply the filter consistently.

  • The package export matches the existing desktop import path.

  • Any durable .localhost service with -- in its label loses its browser location after restart.

T-Rex T-Rex Logs

What T-Rex did

  • Reproduced and confirmed that the durable local URL is discarded during both serialization and rehydration in the desktop persistence test.
  • Inspected the verbose failing test output to verify the input, serialized, and rehydrated URL values, which showed nulls indicating discard.
  • Ran the Vitest suite for the shell-state tests and confirmed all tests passed with exit code 0.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
packages/presentation/ui/src/shell/browser/normalize.ts Adds preview-host detection, but also matches unrelated .localhost hosts containing a double hyphen.
apps/desktop/src/renderer/src/shell/store/model.ts Filters blob and preview URLs consistently during serialization and rehydration.
packages/presentation/ui/src/shell/browser/index.ts Exports the new predicate through the existing browser package entry point.
apps/desktop/src/renderer/src/tests/shell-state.test.ts Adds persistence coverage for temporary preview URLs and a durable HTTPS URL.

Reviews (1): Last reviewed commit: "fix(desktop): exclude preview URLs from ..." | Re-trigger Greptile

if (!hostname.endsWith(LOCALHOST_SUFFIX)) return false;
const label = hostname.slice(0, -LOCALHOST_SUFFIX.length);
return label.includes('--') && PREVIEW_LABEL_RE.test(label);
} catch {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Durable Local URLs Are Discarded

Any single-label .localhost hostname containing -- passes this predicate, including an unrelated local service such as http://my--app.localhost:3000. Navigating there is valid, but desktop serialization now clears the URL, so the browser location disappears after restart.

Artifacts

Repro: focused desktop persistence Vitest test

  • Contains supporting evidence from the run (text/typescript; charset=utf-8).

Repro: focused Vitest configuration

  • Contains supporting evidence from the run (text/typescript; charset=utf-8).

Repro: verbose failing test output showing the input, serialized, and rehydrated URL values

  • Keeps the command output available without making the summary code-heavy.

View artifacts

T-Rex Ran code and verified through T-Rex

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.

2 participants