Skip to content

fix(server): MCP project create and update save scripts where reads look - #42157

Closed
2SinceJuly wants to merge 1 commit into
pingdotgg:mainfrom
2SinceJuly:fix/42108-project-create-scripts
Closed

2SinceJuly wants to merge 1 commit into
pingdotgg:mainfrom
2SinceJuly:fix/42108-project-create-scripts

Conversation

@2SinceJuly

Copy link
Copy Markdown
Contributor

Problem

t3_project_create and t3_project_update accept a scripts array and report success, but on installs whose project settings were folded into Settings the scripts are never saved where anything reads them.

Reproduced as in #42108 on 0.1.12-nightly.20261124.5178: create a project with one script, then read it back.

  • t3_project_create returns "scripts": []
  • t3_project_read right after also returns "scripts": []
  • no error or warning, so neither the agent nor the user learns the script was dropped

The setup-script runner reads scripts the same way, so a runOnWorktreeCreate script saved this way would never run either.

Change

Both tools resolved scripts from Settings through resolveProjectScripts (packages/shared/src/projectScripts.ts), which returns projectSettingsOverrides[id].defaultProjectScripts first and, when projectSettingsFolded is set, never falls back to the project record. The handlers wrote only to the project record, so the two never met.

t3_project_create and t3_project_update now save scripts through ServerSettings.updateSettings with a per-project defaultProjectScripts override, which is the same place reads and the setup runner resolve them from. Everything else about both tools is unchanged.

  • Other overrides for the project are kept: the settings patch merges the entry rather than replacing it.
  • A create whose settings write fails now reports it. The project is already committed at that point, so the failure is reported as a warning message rather than as a failed create.

Scope

Fixes #42108. Bug fix only.

Verification

Added scripts an agent saves on create are the ones a later read returns in apps/server/src/mcp/toolkits/project/handlers.test.ts. It folds project settings as a real install does, creates a project through the MCP handler with one script, then reads it back through the same handler.

  • On main (fix stashed): t3_project_read returns "scripts": [] while the create response reports the script was saved. Test fails.
  • With the fix: create returns the script and t3_project_read returns the same script. Test passes.
$ npx vp test run apps/server/src/mcp/toolkits/project/handlers.test.ts -t "scripts an agent saves"
 Tests  1 passed | 21 skipped (22)

Full file: 21 passed. The one remaining failure, a defaulted worktree launch stays shared only when Git says HEAD has no commit, fails identically on unmodified main in this checkout (expected [] to deeply equal [ 'root' ]) and is unrelated.

effect-tsgo tsrs --noEmit in apps/server reports no errors in either changed file.

Not checked: I did not drive a live desktop session against a real Claude thread. The reproduction above is at the handler level, which is where the two write and read paths diverge.

Model: Claude Code (this harness) wrote the change and the test; the diagnosis and test design were reviewed by hand.

On installs that folded project settings into Settings, t3_project_create and
t3_project_update wrote scripts onto the project record, while every reader
(t3_project_read, t3_project_list, the setup-script runner) resolved them from
Settings. The agent was told the scripts were saved, then a read returned an
empty list.

Scripts now go through Settings for both tools. Other overrides for the project
are kept. A create whose Settings write fails reports it instead of succeeding
silently, as the project itself is already committed.

Fixes pingdotgg#42108
@github-actions github-actions Bot added the vouch:unvouched Author is not yet trusted in the VOUCHED list. label Nov 24, 2026
@github-actions github-actions Bot added the size:M 30-99 changed lines (additions + deletions). label Nov 24, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Thanks for this. #42128 makes the same change and is the one being kept.

#42128 fixes the same scripts persistence problem in the shared project service. That covers the MCP tools and other project callers, whereas this change fixes only the MCP handlers.

Your diagnosis and create-then-read regression are useful. We’ll continue with the shared-service fix so script persistence follows the same path for every caller.

Closing as a duplicate.

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

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: t3_project_create silently drops the scripts parameter

2 participants