GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor(app): break the current-server import cycle by opencode-agent[bot] · Pull Request #64454 · anomalyco/opencode

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Nov 17, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Issue for this PR

None. This is one of the last two runtime import cycles found by the weekly V2 import-graph audit.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Breaks the app current-server import cycle (runtime.tsx → client.tsx / notification.tsx → current.tsx → runtime.tsx). The codemode VM cycle is in #64455.

current.tsx imported useGlobal from runtime.tsx only to read the server's health and controller, and runtime.tsx imports modules that call useServer. Now:

  • The Server context takes health as a prop and imports only types from ./runtime.
  • ServerProvider, which needs useGlobal, moves to runtime.tsx. Its 7 importers now import it from @/runtime/server/runtime.
  • The stories mock for @/runtime/server/current exports ServerContextProvider instead of its own ServerProvider, so stories render through the real provider.

How did you verify your code works?

  • An eager-import SCC check over packages/app/src (with @/ resolved) finds no cycles. The only remaining hits are the intentional export * as X from "./self" namespace self-imports.
  • packages/app: bun run typecheck and bun run test:unit (2738 pass).
  • bun run lint:changed is clean.
  • The stories Vite build gets through bundling, so the mock exports resolve. It then runs out of memory while computing gzip sizes in this sandbox.

Screenshots / recordings

No UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Requested by: @jlongster (James Long via Slack)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
James Long @opencode-agent
refactor(app): break the current-server import cycle
771dac4
current.tsx no longer imports runtime.tsx. The Server context takes the
server's health as a prop, and ServerProvider, which reads useGlobal,
moves to runtime.tsx.
@opencode-agent opencode-agent Bot assigned jlongster Nov 17, 2026
@github-actions github-actions Bot added the contributor label Nov 17, 2026
This was referenced Nov 17, 2026
refactor: break the last two runtime import cycles (app current-server, codemode VM) #64449
Closed
refactor(codemode): break the VM import cycle #64455
Open
opencodejr[bot]
opencodejr Bot reviewed Nov 17, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Requesting changes. The import cycle is gone, and type-check (tsc --noEmit) plus bun run test:unit (2738 pass) are clean in packages/app. Public API unchanged: these are app-internal modules only.

Two things to fix before merge:

  1. The commit undoes two recent fixes. Besides the refactor, it reverts #64443 (the browser pane stays live while resizing on macOS: panel-motion.ts and its macOS test in browser-pane.spec.ts) and #64450 ("Use main checkout" stays on one line in selector.tsx). The commit's parent already contains both, so this looks like a stale working tree. Please drop those three files from the PR.
  2. Stories no longer use the mocked server context. runtime.tsx imports ./current with a relative path, but the stories Vite alias only matches @/runtime/server/current. I checked with Vite's resolver: in stories, ServerProvider now provides the real current.tsx context, while components read the mock's useServer. Story components under ServerProvider therefore get the mock's fallback data, and the new ServerContextProvider in the mock is never used. Importing from @/runtime/server/current in runtime.tsx fixes this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/app/src/runtime/server/runtime.tsx Outdated
import { useServerHealth } from "@/runtime/server/health"
import { selectServerHostname } from "@/runtime/server/health-machine"
import { createServerSdkContext } from "./client"
import { ServerContextProvider } from "./current"

@opencodejr opencodejr Bot Nov 17, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

In stories, this relative import skips the ^@/runtime/server/current$ alias in packages/stories/vite.config.ts (Vite resolves ./current to the real current.tsx). So ServerProvider provides the real context, while story components read the mock's useServer and fall back to its default data. The mock's new ServerContextProvider is never used. import { ServerContextProvider } from "@/runtime/server/current" keeps the mock in place.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/app/src/shell/panel-motion.ts Outdated

/** Pass to a resize handle's `onDraggingChange` when its drag moves a panel that can hold a native view. */
export const setPanelResizing = (dragging: boolean) => setResizing(dragging && !/Mac/.test(navigator.platform))
export const setPanelResizing = (dragging: boolean) => setResizing(dragging)

@opencodejr opencodejr Bot Nov 17, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This reverts #64443 (the macOS check that keeps native views live during resize), and the macOS test in component-tests/browser-pane.spec.ts is removed with it. Neither is part of the import-cycle change, so please drop both files from this PR.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/app/src/new-session/workspace/selector.tsx Outdated
<span class="shrink-0 whitespace-nowrap">
{language.t("session.new.workspace.useMainCheckout")}
</span>
<span>{language.t("session.new.workspace.useMainCheckout")}</span>

@opencodejr opencodejr Bot Nov 17, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This reverts #64450 (keeping "Use main checkout" on one line). It's unrelated to the refactor, so please drop it from this PR.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
James Long @opencode-agent
fix(app): keep #64443 and #64450, import current through its alias
f683b1a
The previous commit was cut from a stale tree and reverted panel-motion.ts,
its macOS browser-pane test and selector.tsx. Restore them from dev.

runtime.tsx imports ServerContextProvider as @/runtime/server/current so
the stories alias replaces it with the mock.
@opencode-agent

opencode-agent Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Addressed in f683b1a: restored panel-motion.ts, its macOS test in browser-pane.spec.ts, and selector.tsx from dev, which undoes the accidental reverts of #64443 and #64450. runtime.tsx now imports ServerContextProvider from @/runtime/server/current, so the stories alias swaps in the mock. The diff is now only the 10 intended files. App typecheck and unit tests (2738) pass, and the cycle check is still clean.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

opencodejr[bot]
opencodejr Bot reviewed Nov 17, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

All earlier points are fixed. The unrelated reverts of #64443 and #64450 are gone. runtime.tsx now imports ServerContextProvider through the @/runtime/server/current alias, and I confirmed with the stories Vite config that this resolves to the mock. The type check (tsc --noEmit) and bun run test:unit (2738 pass) are clean in packages/app. Public API unchanged. Nothing new to raise.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@jlongster jlongster

Labels

contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@jlongster
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.