t3code icon indicating copy to clipboard operation
t3code copied to clipboard

MCP per-project setup scripts ignored by folded settings resolver

Open brandus1 opened this issue 4 weeks ago • 1 comments

Request

Please expose/fix supported per-project worktree setup configuration through the MCP API. A synchronous setup script (runOnWorktreeCreate: true, async: false) is needed to prepare a real, hardlinked node_modules directory before provider startup. No settings-file edits or provider-bootstrap workarounds are desired.

Installed version reports 0.1.6-nightly.20261030.3917.

Source-based reproduction

The bundled ProjectService.update forwards t3_project_update(scripts: ...) to project metadata. The bundled resolveProjectScripts uses the folded settings first:

const override = settings.projectSettingsOverrides[project.id]?.defaultProjectScripts;
if (override !== undefined) return override;
if (settings.projectSettingsFolded) return settings.defaultProjectScripts;
// legacy fallback below considers project.scripts

With migrated settings containing projectSettingsFolded: true, empty global defaults, and no per-project override, supplying a project with a new setup script still resolves to the empty global script list. I exercised the resolver extracted from the installed binary in isolation with this fixture; no live configuration was changed.

The hook runner itself supports the desired behavior: the worktree is its cwd, it receives T3CODE_PROJECT_ROOT/T3CODE_WORKTREE_PATH, and ThreadLaunchService awaits a successful synchronous setup before releasing the provider agent.

Expected

A supported per-project API should update/read the effective setup script after migration, preserving other project settings. Setup failure should hold provider startup. Please clarify an existing supported operation if there is one. The exposed environment-preferences API does not include the effective project-script field.

brandus1 avatar Nov 02 '26 04:11 brandus1

Thanks for the detailed source trace. This is the same bug as https://git.cafe/pingdotgg/t3code/issues/14991 (https://git.cafe/pingdotgg/t3code/issues/14991), which is open and confirmed: once projectSettingsFolded is set, t3_project_update (and t3_project_create) still write scripts to the project record. Launch, ProjectSetupScriptRunner and the scripts menu only read projectSettingsOverrides[projectId].defaultProjectScripts. No MCP tool writes that per-project entry today.

I checked current main (d890e5c401). resolveProjectScripts in packages/shared/src/projectScripts.ts and ProjectService.update in apps/server/src/project/ProjectService.ts still behave the way you describe. No open PR fixes it yet.

Until it's fixed, the supported way to set a per-project setup action is the project's Actions settings in the app. It writes the effective per-project override, and the launch path then waits for a synchronous runOnWorktreeCreate script before starting the provider.

Closing as a duplicate so the discussion stays in one place. Please follow https://git.cafe/pingdotgg/t3code/issues/14991 for the fix.

juliusmarminge avatar Nov 02 '26 04:11 juliusmarminge