Conversation
…ider Two increments recovered from the feat/webui-react branch, rebased onto the current main rather than merged from it. Where the branch and main overlap, main's implementation wins outright; nothing from the branch's frontend package is carried over. 1. acp.mjs: the engine's acp entry spawns its own MCP plugin tree. `stop()` signalled only the direct child, so the whole tree was orphaned on every restart. The child is now spawned `detached` on POSIX, making its pid the process-group id, and `stop()` signals the group (SIGTERM, then SIGKILL after 3s) instead of just the child. Windows has no group to signal and keeps the direct-child kill. acp-client.js: stop a non-alive singleton before overwriting the reference. A client whose `alive` is false can still own a child on its way down; overwriting the pointer leaked it the same way. 2. routes/model.js: partition /api/models by provider. The engine encodes a selection as m:<provider>:<model>:v:<variant>, so the provider falls out of the id and `groups` is always consistent with `models`. An optional models.json (MCODE_WEBUI_MODELS_CONFIG, else ./models.json) is re-read per request and overlays display metadata — group label, model label, contextLimit. It is an overlay, not a replacement: the engine's session config option still decides which models exist, so an overlay cannot invent a model the engine does not offer, and a missing or malformed file is not an error. The client renders one section per provider when more than one exists and otherwise keeps the flat list exactly as before. The branch's changes to browseWorkspace's no-path behaviour, to handleAnswer's response contract, and to the fs.js body-size limit are not carried over: the first reopens a directory enumeration oracle that lib-workspace-containment pins closed, the second is a contract regression its own test catches, and the third would drop a cap main already has. The branch's WebSocket transport is also not carried over. Its server side ports cleanly, but main's frontend consumes the state stream over SSE, and its only WebSocket client lives in the branch's webui-react package — so adding the endpoint alone would ship a transport with no consumer, while using it means replacing main's stream client. That is a transport decision rather than an absorbed increment, and it belongs in its own change.
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.
Recovers the two increments from #22 that still apply to
main, reimplementedagainst
mainrather than merged from it. Where the branch overlappedmain,main's implementation wins outright; nothing from the branch'swebui-reactpackage is carried over.
1. Reap the mcode acp process group
packages/webui/acp.mjs— the engine's acp entry spawns its own MCP plugintree.
stop()signalled only the direct child, so the tree was orphaned onevery restart. The child is now spawned
detachedon POSIX (making its pid theprocess-group id), and
stop()signals the group — SIGTERM, then SIGKILL after3s. Windows has no group to signal and keeps the direct-child kill.
packages/webui/server/lib/acp-client.js— stop a non-alive singleton beforeoverwriting the reference. A client whose
aliveis false can still own a childon its way down; overwriting the pointer leaked it the same way.
Regression test spawns a real child with a real grandchild and asserts neither
outlives
stop(). Verified it fails against the previous implementation(
child(alive=false) grandchild(alive=true)), so it pins the actual leak ratherthan restating the new code.
2. Group
/api/modelsby providerpackages/webui/server/routes/model.js— the engine encodes a selection asm:<provider>:<model>:v:<variant>, so the provider falls out of the id andgroupsis always consistent withmodels.An optional
models.json(MCODE_WEBUI_MODELS_CONFIG, else./models.json) isre-read per request and overlays display metadata: group label, model label,
contextLimit. It is deliberately an overlay, not a replacement — theengine's session config option still decides which models exist, so an overlay
cannot invent a model the engine does not offer, and a missing or malformed file
is not an error.
The client renders one section per provider when more than one exists, and
otherwise keeps the flat list exactly as before.
Deliberately not carried over
browseWorkspacedefaulting to the first allowed root — reopens thedirectory enumeration oracle that
lib-workspace-containmentpins closed.handleAnswerdroppingdeprecated: true— a response-contractregression that the branch's own test catches.
fs.jslosing the sharedreadJsonbody-size cap —mainhas the cap.files' dependencies exist on
main), butmain's frontend consumes the statestream over SSE and the only WebSocket client lives in
webui-react— soadding the endpoint alone ships a transport with no consumer, while using it
means replacing
main's stream client. That is a transport decision ratherthan an absorbed increment, and it interacts with the fact that Feat/webui nextjs framework #18 removed
feat(webui): ws event stream, worker embed transport, capability negotiation #20's WebSocket implementation; it belongs in its own change.
Verification
pnpm verify— 17 gates on linux, all passing. Within that:pnpm build(6253 source files),
pnpm typecheck,pnpm test:webui(1337 tests, 0 fail),pnpm test:webapp(186/186),check:source,check:standalone,check:webui-bundle,check:tsconfig,test:release-tools.release/public-source.jsonregenerated for the one added test file.Skipped on this platform:
test:windows,test:sandbox,test:release-package.Relates to #22. Does not close it — that PR's frontend and its three
regressions above still need a decision.