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 — test(core): pin location reload reaps the prior graph by titoune33 · Pull Request #55548 · anomalyco/opencode

test(core): pin location reload reaps the prior graph #55548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
titoune33 wants to merge 1 commit into anomalyco:dev from titoune33:location-reload-reap-guard
+51 −0
Closed

test(core): pin location reload reaps the prior graph #55548

Changes from all commits
Commits
Show all changes
1 commit
Select commit
2204960
test(core): pin location reload reaps the prior graph
titouwajd Oct 14, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

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

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

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

Diff view
Diff view
test(core): pin location reload reaps the prior graph
  • Loading branch information

Uh oh!

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

@titouwajd
titouwajd committed Oct 14, 2026
commit 2204960739db3f8a692f86265b5ed76e6e5aae91

There are no files selected for viewing

51 changes: 51 additions & 0 deletions 51 packages/core/test/location-layer.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,57 @@ describe("LocationServiceMap", () => {
)
}

// Guard for #51003: reload boots a fresh location graph, so the prior entry's
// scope (which owns its stdio MCP fleet) must close or those processes leak.
// The entry scope closes eagerly for an idle graph and once borrowers release
// for a borrowed one. If either path stops closing, reload leaks a full fleet.
for (const held of ["idle", "borrowed"] as const) {
it.live(`reaps the reloaded ${held} graph's scope`, () =>
Effect.gen(function* () {
const builds = { started: 0 }
const finalized: number[] = []
const layer = AppNodeBuilder.build(LayerNode.group([Database.node, Bus.node, LocationServiceMap.node]), [
Global.node.replace(tempGlobalLayer),
offlineModels,
LocationWatcher.node.replace(
LocationWatcher.node.mapLayer((layer) =>
layer.pipe(
Layer.tap(() =>
Effect.gen(function* () {
const build = ++builds.started
yield* Effect.addFinalizer(() => Effect.sync(() => finalized.push(build)))
}),
),
),
),
),
])
yield* Effect.gen(function* () {
const dir = yield* tmpdirScoped()
const ref = Location.Ref.make({ directory: AbsolutePath.make(dir.path) })
const locations = yield* LocationServiceMap.Service
// For "borrowed", hold a borrow that outlives the reload (refCount > 0).
// For "idle", boot and release so the reload sees an unheld entry.
const scope = yield* Effect.acquireRelease(Scope.make(), (scope) => Scope.close(scope, Exit.void))
yield* locations.contextEffect(ref).pipe(Scope.provide(scope))
expect(builds.started).toBe(1)
if (held === "idle") yield* Scope.close(scope, Exit.void)

yield* LocationServiceMap.reload()
// Reload detached the old entry and booted a replacement.
expect(builds.started).toBe(2)

// An idle entry reaps eagerly; a borrowed one reaps on final release.
if (held === "borrowed") {
expect(finalized).not.toContain(1)
yield* Scope.close(scope, Exit.void)
}
expect(finalized).toContain(1)
}).pipe(Effect.provide(layer))
}),
)
}

itWithActivity.effect("does not refresh lifetime from inferred Session routing", () =>
Effect.gen(function* () {
const locations = yield* LocationServiceMap.Service
Expand Down
Loading
Oops, something went wrong.

Uh oh!

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

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 01402792 — 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.