Skip to content

refactor(inspector): serve inspector from manager (localhost:6420/ui)#4228

Closed
jog1t wants to merge 1 commit into02-18-refactor_inspector_separate_inspector_app_from_dashboardfrom
02-19-refactor_inspector_serve_inspector_from_manager_localhost_6420_ui_
Closed

refactor(inspector): serve inspector from manager (localhost:6420/ui)#4228
jog1t wants to merge 1 commit into02-18-refactor_inspector_separate_inspector_app_from_dashboardfrom
02-19-refactor_inspector_serve_inspector_from_manager_localhost_6420_ui_

Conversation

@jog1t
Copy link
Contributor

@jog1t jog1t commented Feb 18, 2026

Description

This PR adds support for serving the inspector UI directly from the Rivet manager server, making it accessible at /ui/ instead of requiring a separate deployment. This simplifies the inspector setup and improves the developer experience.

Key changes:

  • Added a new endpoint in the manager router to serve the inspector UI static files
  • Created a script to package the inspector UI into a tarball for distribution
  • Updated the inspector URL generation to use the local /ui/ path
  • Added browser-safe exports for the inspector client code
  • Fixed imports in the frontend to use the new browser-safe paths
  • Updated the build configuration to properly handle browser vs. Node.js code

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

The changes have been tested by:

  • Building the inspector UI and verifying it can be served from the manager
  • Testing the browser-safe exports to ensure they work correctly in frontend code
  • Verifying the inspector functionality works with the new URL structure

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4228 February 18, 2026 23:52 Destroyed
@railway-app
Copy link

railway-app bot commented Feb 18, 2026

🚅 Deployed to the rivet-pr-4228 environment in rivet-frontend

Service Status Web Updated (UTC)
frontend-inspector ❌ Build Failed (View Logs) Web Feb 19, 2026 at 10:13 pm
frontend-cloud ❌ Build Failed (View Logs) Web Feb 19, 2026 at 10:13 pm
website 😴 Sleeping (View Logs) Web Feb 19, 2026 at 12:04 am
mcp-hub ✅ Success (View Logs) Web Feb 18, 2026 at 11:54 pm
ladle ❌ Build Failed (View Logs) Web Feb 18, 2026 at 11:53 pm

@jog1t jog1t marked this pull request as ready for review February 18, 2026 23:52
@jog1t jog1t mentioned this pull request Feb 18, 2026
8 tasks
Copy link
Contributor Author

jog1t commented Feb 18, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 18, 2026

Graphite Automations

"Test" took an action on this PR • (02/18/26)

1 assignee was added to this PR based on Kacper Wojciechowski's automation.

Comment on lines +604 to +609
onNotFound: async (_path, c) => {
await serveStatic({ root, path: "index.html" })(
c,
next,
);
},
Copy link
Contributor

Choose a reason for hiding this comment

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

The onNotFound handler does not return the result of the serveStatic call, which will cause the SPA fallback routing to fail. When a non-existent route like /ui/some/route is accessed, the handler will serve nothing instead of the index.html file.

Fix:

onNotFound: async (_path, c) => {
    return serveStatic({ root, path: "index.html" })(
        c,
        next,
    );
},
Suggested change
onNotFound: async (_path, c) => {
await serveStatic({ root, path: "index.html" })(
c,
next,
);
},
onNotFound: async (_path, c) => {
return serveStatic({ root, path: "index.html" })(
c,
next,
);
},

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@claude
Copy link

claude bot commented Feb 18, 2026

PR Review: refactor(inspector): serve inspector from manager (localhost:6420/ui)

This PR is a solid improvement to the developer experience by co-locating the inspector UI with the manager server. The approach is sound overall. Here are my findings:


Bugs / Correctness Issues

1. Stale files from version upgrades in serve-ui.ts

The tarball is always extracted to a fixed path (os.tmpdir() + '/rivetkit-inspector'), and mkdir({ recursive: true }) won't fail if it already exists. Files from a previous version are never cleaned up. If a new release removes files present in an old extraction, those stale files will persist and be served.

Consider including a content hash in the tmpdir name, or deleting and recreating the directory before extraction:

```ts
const dest = path.join(os.tmpdir(), 'rivetkit-inspector-VERSION_HASH');
// or:
await nodeFs.rm(dest, { recursive: true, force: true });
await nodeFs.mkdir(dest, { recursive: true });
```

2. Failed extraction is permanently cached in serve-ui.ts

If extraction fails (e.g., tarball not found), extractionPromise is set to the rejected promise and is never reset. All subsequent requests to /ui/* will silently fail with the same error without retrying. Consider resetting on failure:

```ts
extractionPromise = (async () => {
try {
// ... existing logic
} catch (err) {
extractionPromise = undefined; // allow retry on next request
throw err;
}
})();
```


Behavioral / UX Concerns

3. Inspector URL hardcodes 127.0.0.1 — breaks Docker and remote setups

```ts
// inspector/utils.ts
const base = config.inspector.defaultEndpoint ?? `http://127.0.0.1:\${managerPort}\`;
return new URL("/ui/", base).href;
```

The old code used https://inspect.rivet.dev with an optional ?u= query parameter. The new code generates a URL that always points to localhost by default. Anyone running the manager in Docker, a VM, or a remote server will see a logged inspector URL that their browser cannot reach unless they manually set defaultEndpoint. This is a quiet regression worth documenting or mitigating.

4. Lazy extraction causes a slow first request

The tarball is extracted on the first /ui/* request. Users will experience a noticeable hang the first time they open the inspector. Extracting eagerly at startup (when inspector.enabled is true) would give a better experience and surface errors earlier rather than on the first user interaction.


Code Quality

5. Double blank line in router.ts

```ts
if (config.inspector.enabled) {
let inspectorRoot: string | undefined;
// <- extra blank line here
router.get("/ui/*", async (c, next) => {
```

Minor, but inconsistent with surrounding style.

6. Missing newline at end of src/utils/node.ts

The diff shows \ No newline at end of file. This should be fixed.

7. Indentation inconsistency in new files

tsup.browser.config.ts and the mod.browser.ts files use 4-space indentation, while the surrounding TypeScript in this project uses tabs. These should use tabs for consistency.


Build / CI

8. CI workflow uses npx turbo instead of the workspace-managed binary

```yaml

  • run: npx turbo build:publish -F rivetkit ...
    ```

Using npx turbo downloads turbo at runtime rather than using the version pinned in the workspace. Prefer pnpm turbo or add turbo to the workspace devDependencies to ensure version consistency.

9. _gen.ts Vercel deploy URLs reference the rivet-gg GitHub org

All deployUrl entries in the auto-generated _gen.ts point to github.com/rivet-gg/rivet. If the canonical repository has moved to rivet-dev/rivet, these URLs point to the wrong fork. Worth verifying.


Minor Notes

  • The mod.browser.ts for the client simply re-exports ./mod. This is fine today but it is worth ensuring the main mod.ts pulls in no Node.js-only transitive imports, since the browser build config marks node:* as external and a miscategorized import would produce a runtime error rather than a build error.
  • The SPA fallback in onNotFound (serving index.html) is the correct pattern for client-side routing.
  • The promise-based singleton in serve-ui.ts correctly prevents concurrent extractions — nice.

Comment on lines +792 to +797
const { id, promise } = actionsManager.current.createResolver<
unknown[]
>({
name: "getDatabaseTableRows",
timeoutMs: 10_000,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

The formatting of the createResolver function call was changed, which doesn't match Biome's expected formatting style. Run 'pnpm lint --fix' to automatically fix the formatting.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +178 to +179
const loopName =
nameRegistry[segment.loop] ?? `loop-${segment.loop}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

The variable assignment was reformatted with a line break that doesn't match Biome's expected style. Run 'pnpm lint --fix' to automatically fix the formatting.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +223 to +225
const allCompleted =
history.length > 0 &&
history.every((h) => h.entry.status === "completed");
Copy link
Contributor

Choose a reason for hiding this comment

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

The variable assignment was reformatted with line breaks that don't match Biome's expected style. Run 'pnpm lint --fix' to automatically fix the formatting.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@jog1t jog1t force-pushed the 02-19-refactor_inspector_serve_inspector_from_manager_localhost_6420_ui_ branch from 1c9cb1e to 4a58c66 Compare February 19, 2026 22:03
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 19, 2026

More templates

@rivetkit/cloudflare-workers

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/cloudflare-workers@4228

@rivetkit/framework-base

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/framework-base@4228

@rivetkit/next-js

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/next-js@4228

@rivetkit/react

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/react@4228

rivetkit

pnpm add https://pkg.pr.new/rivet-dev/rivet/rivetkit@4228

@rivetkit/sql-loader

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sql-loader@4228

@rivetkit/sqlite-vfs

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sqlite-vfs@4228

@rivetkit/traces

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/traces@4228

@rivetkit/workflow-engine

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/workflow-engine@4228

@rivetkit/virtual-websocket

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/virtual-websocket@4228

@rivetkit/engine-runner

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner@4228

@rivetkit/engine-runner-protocol

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner-protocol@4228

commit: 76f77cc

@jog1t jog1t force-pushed the 02-19-refactor_inspector_serve_inspector_from_manager_localhost_6420_ui_ branch from 4a58c66 to 6a877f5 Compare February 19, 2026 22:12
@railway-app railway-app bot temporarily deployed to rivet-frontend / rivet-pr-4228 February 19, 2026 22:12 Destroyed
@jog1t jog1t force-pushed the 02-19-refactor_inspector_serve_inspector_from_manager_localhost_6420_ui_ branch 2 times, most recently from d4eab78 to 76f77cc Compare February 19, 2026 22:31
@NathanFlurry NathanFlurry force-pushed the 02-19-refactor_inspector_serve_inspector_from_manager_localhost_6420_ui_ branch from 76f77cc to 8648aed Compare February 19, 2026 23:05
@NathanFlurry NathanFlurry force-pushed the 02-18-refactor_inspector_separate_inspector_app_from_dashboard branch from 84d3f2b to 7c3c423 Compare February 19, 2026 23:05
@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 19, 2026

Merge activity

  • Feb 19, 11:17 PM UTC: NathanFlurry added this pull request to the Graphite merge queue.
  • Feb 19, 11:18 PM UTC: CI is running for this pull request on a draft pull request (#4244) due to your merge queue CI optimization settings.
  • Feb 19, 11:19 PM UTC: Merged by the Graphite merge queue via draft PR: #4244.

graphite-app bot pushed a commit that referenced this pull request Feb 19, 2026
…#4228)

# Description

This PR adds support for serving the inspector UI directly from the Rivet manager server, making it accessible at `/ui/` instead of requiring a separate deployment. This simplifies the inspector setup and improves the developer experience.

Key changes:
- Added a new endpoint in the manager router to serve the inspector UI static files
- Created a script to package the inspector UI into a tarball for distribution
- Updated the inspector URL generation to use the local `/ui/` path
- Added browser-safe exports for the inspector client code
- Fixed imports in the frontend to use the new browser-safe paths
- Updated the build configuration to properly handle browser vs. Node.js code

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

## How Has This Been Tested?

The changes have been tested by:
- Building the inspector UI and verifying it can be served from the manager
- Testing the browser-safe exports to ensure they work correctly in frontend code
- Verifying the inspector functionality works with the new URL structure

## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
@graphite-app graphite-app bot closed this Feb 19, 2026
@graphite-app graphite-app bot deleted the 02-19-refactor_inspector_serve_inspector_from_manager_localhost_6420_ui_ branch February 19, 2026 23:19
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