Repository navigation
Fork: assistant setup (switch, built-in assistant profile, Make assistant) - #953
Conversation
…tant) The switch assistant.enabled (off by default) offers "Make assistant" in Settings. It makes a thread in the Scratch project and names it the assistant in one person-path settings save: threadRoles.assistant (the server's role guard decides) and the thread's MCP profile pick "assistant". The new built-in profile "assistant" has no outside servers, no built-in tools (builtinTools "none", Claude only) and the T3 groups orchestration, threads and projects. The web list of built-ins now reads the one table in contracts. Assistant PR 2 of 18. Docs: docs/fork/assistant.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- FORK_CHANGES row: all five cells, naming server.assistant (the fork-changes-list test failed without it). - Make assistant saves the profile pick before it makes the thread, so a setup that stops half-way never leaves a wider "Assistant" thread; the role is a second save once the thread exists. - The button stays busy until the saves settle; a ref stops a double click from making two threads. - An archived assistant reads as not active (the client's thread list holds active threads only), not as deleted. - The button row is locked when a policy owns mcpThreadProfiles. - Docs: what the three T3 tool groups can do, the upgrade note for an own profile called "assistant", and the half-way states. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
lens: code · reviewer: lens agent (Opus, read-only) · read at: b1a7658 |
|
lens: code · reviewer: lens agent (Opus, read-only), replaces my report above (it missed two CI failures) · read at: b1a7658 |
…d runs, plain tool-group text (#953) - React Compiler: Make assistant runs as a promise chain with no try/finally; makeAssistantThread never rejects, so the button always leaves busy. - The built-in `assistant` stays in every thread's profile menu (it only narrows and gives no role); the menu test lists it. - Resolver: the threadRoles.assistant thread never runs wider than the built-in `assistant`, even when a managed policy drops its pick; the pointer is read on the text and kept-keys paths too. - A run that stops after the pick deletes its empty thread and, once the client sees it gone, removes the pick. - Settings text and docs say plainly what the three tool groups allow (forced project delete, clone, configure, interrupt, workflows, environments), move launch under projects, point at owner question #954, and note how an older build saves `assistant`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
lens: code r2 · reviewer: lens agent (Opus, read-only) · read at: c324947 🤖 Generated with Claude Code |
|
lens: state r2 · reviewer: lens agent (Opus, read-only) · read at: c324947 🤖 Generated with Claude Code |
|
Both round-2 lenses: safe to merge. The minors are in follow-up #980 (most go into the tool-split PR). Queued for merge after #958. 🤖 Generated with Claude Code |
Assistant PR 2 of 18 (#879). Builds on #927 (
builtinTools: "none") and #928 (threadRoles).What and why
The assistant is one long thread you talk to across projects. This PR lets you set it up. It is off by default.
Settings block
assistant(server, person-only, whole-managed).assistant.enabledis off by default. When it is off, Settings shows no Make assistant button. A bad or missing value reads as off.Built-in MCP profile
assistant:servers: []builtinTools: "none"(no shell, file or web tools; Claude only, as in fork: MCP profile builtinTools "none" (assistant PR 1) #927)t3Tools:orchestration,threads,projects, plus the tools every profile keeps.allandt3-onlyin the one built-in table in contracts. The web list of built-ins now reads that table instead of keeping its own copy.Settings → Fork → Assistant: a switch, then a row with Make assistant. The button makes two settings saves from the person at the screen:
mcpThreadProfiles[id] = "assistant"for a new thread id, before the thread exists;threadRoles.assistant = id;Because the pick comes first, a thread called "Assistant" never runs with a wider profile, even if setup stops half-way. The role goes through the existing
threadRolesserver guard (thread exists, top-level, own project; person-only key). No agent path writes a role or a profile pick. If the run stops after the pick, the new thread is deleted while it is still empty (onlyIfUnused) and, once the client sees it gone, its pick is removed. The button stays busy until the run ends (it always ends, also when a step throws), and a ref stops a double click. The row is locked when a managed policy ownsthreadRolesormcpThreadProfiles, and it shows whether the assistant thread is active or not.The assistant thread never runs wider than
assistant(resolver, so server turn check, launch and the web menu all agree): whatever its pick, thethreadRoles.assistantthread gets at most the built-inassistant. A narrower pick stands; anything wider is cut toassistant.Docs: new
docs/fork/assistant.md, including exactly what the three T3 tool groups allow today (see "Fix round" below). Indocs/fork/README.md: a table row and section forserver.assistant, and the built-ins text now lists three. AFORK_CHANGES.mdline.Owner answers used (#153–#158, all yes): the assistant may start work without a tap (#158), so it runs full-access with no built-in tools.
Size
The plan said at most 400 changed lines. This PR is 585+ / 20−: 361 code, 130 test, 94 docs. I did not split it. Without its tests and docs it is under 400, and none of the parts is useful on its own: the setting, the profile and the button only make sense together. #927 grew the same way (531+ against a plan of 250).
Upstream fit
ForkSettingsPanel.useScratchProject,threadEnvironment.create/delete,waitForThreadShelland the settings save.threadRoles), with no new server path.General vs project
All general. There are no project names, paths or facts. The profile is a general least-privilege set; any thread can pick it. Which provider and model to use comes from the environment's providers.
State question
threadRoles.assistantto it. The old thread keeps itsassistantpick and is not touched. Nothing is lost. A double click makes one thread, because a ref guards the run and the button stays busy until the saves settle.threadRolesrule). The pointer and pick stay until the next Make assistant replaces the pointer.assistantsaved before this version: the entry makes the built-in "broken", so every thread that picks it is refused (fail closed) until it is removed. This uses the same rule asallandt3-only, and the test is extended to coverassistant. The docs carry an upgrade note: rename your own profile and move its picks first, because after removal those picks get the built-in.assistantis read leniently: anything butenabled: trueis off, and other settings are kept (tested). A badthreadRolesreads as no roles (Calm sidebar part 1: threadRoles and calmSidebarEnabled settings #928). A thread whose profile cannot be read is refused, never widened.assistantprofile and no role; Settings still says there is no assistant. If the run stops after the pick (thread not made, not seen, role refused, or an error), the empty thread is deleted and, once this client sees it gone, its pick is removed. A thread that stays (someone wrote in it, or the delete did not go through) keeps its narrow pick.assistant.assistant) is refused as an unknown profile, nothing is made, and nothing is widened.Known limits (later PRs)
docs/fork/assistant.mdand left for PR 3.Tests (each fails without the change)
I ran the new and changed tests against origin/main's source files with this PR's tests in place:
packages/contracts/src/assistant.test.ts: 2 fail (noassistantkey).packages/shared/src/forkSettingsPatch.test.ts"takes a pick of the assistant's built-in": fails (the pick is refused as unknown).packages/shared/src/forkDocs.test.ts: 3 fail (README row and section with no setting)..github/scripts/fork-changes-list.test.cjs: fails with the first version of theFORK_CHANGES.mdrow (noserver.assistantnamed), and passes now.apps/server/src/fork/mcpProfile.test.ts: 2 fail. A hand-writtenassistantentry is accepted, and the built-in is "not set up".apps/server/src/golive/forkReport.test.ts: 1 fails.apps/web/.../assistantSetup.logic.test.ts: fails (the module is missing). It checks that the pick save passes the save check before the thread exists, that the pick alone already resolves tobuiltinTools: "none", and then the role save.mcpProfileSettings.logic.test.ts: 2 fail (only two built-ins;assistantcan be saved as a custom profile).The tests use real behaviour: the patch goes through
applyServerSettingsPatchandforkSettingsWriteProblem, and its pick through the real resolver. No mocks.Checks run
McpProfileSettings9, all passing..github/scripts/*.test.cjs: 368 passing.vp fmt --checkon the touched files passes.node .github/scripts/fork-seam-check.cjs --config-ref origin/main origin/main HEADreturns 0.Fix round (code lens report on b1a7658)
reactCompilerCoverage.test.ts):AssistantSettings.tsxusedtry/finallywithoutcatch, which the compiler does not compile. The run now lives inmakeAssistantThread(logic file, plaintry/catch), and the component runs it as a promise chain:.then(...)shows the error or opens the thread,.finally(...)clears busy. Notryin the component.threadMcpProfile.logic.test.ts): keptassistantin every thread's menu and updated the test. Why: pickingassistantonly narrows a thread (no shell, files, web or outside servers); it never widens and gives no role. What makes a thread the assistant isthreadRoles.assistant, which only Settings' person-only save sets. The design calls it a general least-privilege built-in, listed next toallandt3-onlyfrom one table. A non-Claude thread that picks it is refused with a reason (fail closed). With fix 4, the assistant thread itself cannot be widened from the menu either.docs/fork/assistant.mdlists the tools per group;t3_thread_launchis now underprojects(it was wrongly underthreads). Both point at owner question Owner question: may the assistant delete projects and change other threads? (split tool groups) #954 (splitting the groups). The groups are not changed in this PR.threadRoles.assistantthread within the built-inassistant: a result within it stands, a wider one (no pick, so the project or server default; or a wider pick) is cut toassistantwith sourceassistant-role("the assistant thread's limit" in Settings), its children are cut too, and a brokenassistantbuilt-in refuses the thread. The server's text and kept-keys read paths now carrythreadRolesas an MCP profile key, so a settings file that does not fully decode still knows which thread is the assistant. Limit: a policy that ownsthreadRolesand drops the pointer makes the thread ordinary again (documented).makeAssistantThreadnever rejects; any step that throws or rejects ends the run with an error, and the component clears busy in.finally. (ApersistServerthat throws already reachesonFailedthroughPromise.allSettledin upstream'suseScopedSettings; a synchronous throw now rejects the save promise, which the run catches.useScopedSettingsis upstream and not touched.)onlyIfUnused, waits until this client sees it gone (5 s), and only then removes its pick (mcpThreadProfiles[id] = null). A refused pick save cleans up nothing (nothing was saved). A thread that stays keeps its narrow pick, because removing it would give the thread the wide defaults. BecauseonlyIfUnusedreturns success without deleting a used thread, the pick is removed only once the thread is really gone.assistantfields: not fixable in this PR (an old build only knows{ enabled }). Documented indocs/fork/assistant.md; todayenabledis the only field, so nothing is lost, and a later PR that adds a field must read a missing field as its default.Each fix fails without it
reactCompilerCoverage.test.ts:32,threadMcpProfile.logic.test.ts:119); both pass now.mcpProfile.test.ts2 fail ("a managed policy that drops its pick…", "refuses, never widens…").mcpProfileSettingsText.tsfrom b1a7658: 1 fails ("a file that does not decode still gives threadRoles.assistant…").makeAssistantThreadwithout itscatch: 2 fail ("always ends with an outcome when a step throws or rejects…", and the clean-up after a throw).The run tests use fake steps that log what they did; the patches themselves go through the real
applyServerSettingsPatch, and the resolver tests use the real resolver.Checks run on this round
mcpThreadProfiles, assistant or reactCompilerCoverage (216 files): contracts 4 files/56, shared 13/398, web unit 39/934 plusreactCompilerCoverageand the touched logic tests (1522), web browserMcpProfileSettings9/9. Server: 137 of 141 files pass; the 4 others fail on this machine only and not because of this PR (the local Node lacksUint8Array.fromBase64andStatementSync.stat, andAgentSessionScannerhooks time out under load). The other 19 browser files froze locally under load; PR CI runs them.vp fmt --check, seam check (0 upstream files beyond the pinned seams): pass.State question (this round)
threadRolesor a bad one reads as no assistant and the cut does not apply; a settings file that does not decode still gives the pointer, so the cut still applies.Review
One Opus lens (high effort, read-only, asked the state question). It found:
FORK_CHANGES.mdrow had one cell, not five, and did not nameserver.assistant.mcpThreadProfiles.assistantand what the tool groups can do.projectsandthreadsgroups give the assistant more than starting and messaging work: it can delete or clone projects and configure other threads. This PR documents it; a finer split of the groups is a later decision.🤖 Generated with Claude Code