Repository navigation
refactor(agent): give each project one runtime owned by a registry - #59
Merged
Merged
Conversation
The agent rebuilt its executor, store, shell manager and watchers on every project switch, and each switch started another goroutine reading the same fsnotify channel. The config watcher also took its state and gen directories from the agent's environment, which only describes the project the agent was started in. A runtime registry now owns one runtime per project root. The legacy current-project fields alias the current runtime, so switching back reuses it instead of starting duplicate watchers. Each runtime has its own config watcher with paths derived from its root, other projects' runtimes are evicted after ten idle minutes, and shutdown stops them all. Watchers still start only once the server is serving. This is the ownership model per-request project selection (ADR 0005) builds on: v1 handlers will resolve a project's runtime from the same registry. Refs: stackpanel-thq.8.1
cooper (czxtm)
had a problem deploying
to
docs-preview
September 23, 2026 13:36 — with
GitHub Actions
Failure
Contributor
|
Preview |
Contributor
|
Docs preview |
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part 1 of per-request project selection (ADR 0005).
The agent rebuilt its executor, store, shell manager and watchers on every project switch. Each switch also added another goroutine reading the same fsnotify channel. And the config watcher took its directories from the agent's startup environment, which only describes the project the agent was started in.
With this change:
runtimeRegistryininternal/agent/serverowns one runtime per project root: executor, store, shell manager, flake watcher and config-file watcher.s.exec/s.store/s.shellManager/s.flakeWatcherfields become aliases for the current runtime, set inreinitializeExecutor. Switching back to a project reuses its runtime instead of starting duplicate watchers.Verification:
-race. In the devshell, build and vet pass, and the only test failure ininternal/agentis the known baseline one.go build ./...andgo vet ./internal/agent/...pass.go test ./internal/agent/...fails onlyTestSetupAcknowledgementRequiresAuthAndProjectEvidence, which already fails on main.-race.Refs stackpanel-thq.8.1