Skip to content

[+] More harness - #490

Draft
hykilpikonna wants to merge 1 commit into
Menci:mainfrom
AzaContrib:more-harness
Draft

[+] More harness#490
hykilpikonna wants to merge 1 commit into
Menci:mainfrom
AzaContrib:more-harness

Conversation

@hykilpikonna

Copy link
Copy Markdown

No description provided.

Add agent-setup harness installers for oh-my-pi, VSCode, Zed, and
opencode, writing converted settings to each agent's real config file
and authenticating with the provisioned API key:

- VSCode: merge the Floway group into chatLanguageModels.json (bash and
  PowerShell) with backup, staging, validation, and rollback.
- omp: stage FLOWAY_API_KEY into the agent .env (preserving unrelated
  lines) so the env-name reference in models.yml resolves to the real
  token.
- opencode: inject the API key into provider options and emit
  reasoning-effort variants, disabling heuristic levels the model does
  not support.
- zed: resolve the per-platform config dir (%APPDATA%\Zed on Windows)
  and direct the user to add the key.
- PowerShell: add an AGENT_SETUP_TEST_FORCE_WINDOWS platform hook and
  fix Windows PowerShell 5.1 array re-wrapping; set properties via
  Set-SetupProp.

Use each agent's own brand mark on the setup tabs and record provenance
in apps/web/src/assets/NOTICE. Regenerate script-assets.generated.ts and
extend the installer harness to cover file writes, merges, key
injection, and Windows config paths.
yyyr-p added a commit to yyyr-p/Floway that referenced this pull request Sep 11, 2026
@yyyr-p

yyyr-p commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Running pnpm run test:installers on macOS fails two of the vscode Bash cases this PR adds. Repro + a patch below.

Repro: on Darwin, run pnpm run test:installers. These two fail:

  • [vscode] Bash writes the converted groups into chatLanguageModels.jsonENOENT: ... /home/.config/Code/User/chatLanguageModels.json
  • [vscode] Bash preserves unrelated provider groups when mergingthe unrelated group survives alongside Floway — expected: 2, actual: 1

Cause: vscode.sh writes to ~/Library/Application Support/Code/User/chatLanguageModels.json on Darwin, but the test harness's vscodeSettingsPath(ws) reads ~/.config/Code/User/chatLanguageModels.json — the paths diverge. The PowerShell counterparts already pin the profile dir via extraEnv: { VSCODE_CONFIG_DIR: vscodeDir }, but the Bash tests don't — and couldn't even if they tried: runShellInstaller never handled options.extraEnv (only runPowerShellInstaller did), so VSCODE_CONFIG_DIR never reached the Bash installer.

Fix (two changes, both in packages/agent-setup/scripts/test-installers.ts):

  1. Thread extraEnv through runShellInstaller, matching the PowerShell runner:
if (options.extraEnv) Object.assign(env, options.extraEnv);
  1. Pass VSCODE_CONFIG_DIR in both vscode Bash tests, matching the PowerShell tests:
const vscodeDir = join(ws.home, '.config', 'Code', 'User');
const run = await runShellInstaller({ workspace: ws, baseUrl: modelServer.url, configuration: harnessConfig('vscode'), extraEnv: { VSCODE_CONFIG_DIR: vscodeDir } });

Full patch:

diff --git a/packages/agent-setup/scripts/test-installers.ts b/packages/agent-setup/scripts/test-installers.ts
index 2be8668da..3657fa70f 100644
--- a/packages/agent-setup/scripts/test-installers.ts
+++ b/packages/agent-setup/scripts/test-installers.ts
@@ -739,6 +739,7 @@ const runShellInstaller = (options: RunOptions): Promise<RunResult> => {
   if (options.disableJqDownload) env.AGENT_SETUP_TEST_NO_JQ_DOWNLOAD = '1';
   if (options.forceColor) env.AGENT_SETUP_TEST_FORCE_COLOR = '1';
   if (options.noColor) env.NO_COLOR = '1';
+  if (options.extraEnv) Object.assign(env, options.extraEnv);
 
   if (options.fakeRestoreFailure) {
     // A `mv` shim (binDir precedes SHIM_BIN on PATH) that refuses only the
@@ -2759,7 +2760,10 @@ test('opencode', 'Bash merges the converted provider into opencode.json', async
 test('vscode', 'Bash writes the converted groups into chatLanguageModels.json', async t => {
   if (!hostPython) skip('no python3 interpreter on this host');
   const ws = makeWorkspace();
-  const run = await runShellInstaller({ workspace: ws, baseUrl: modelServer.url, configuration: harnessConfig('vscode') });
+  // The Bash installer derives the Darwin default from ~/Library/Application
+  // Support, so pin the profile dir the same way the PowerShell tests do.
+  const vscodeDir = join(ws.home, '.config', 'Code', 'User');
+  const run = await runShellInstaller({ workspace: ws, baseUrl: modelServer.url, configuration: harnessConfig('vscode'), extraEnv: { VSCODE_CONFIG_DIR: vscodeDir } });
   t.equal(run.code, 0, `should succeed:\n${run.combined}`);
   t.includes(run.stdout, 'Written to', 'the installer reports the written path');
   const groups = JSON.parse(readFileSync(vscodeSettingsPath(ws), 'utf8')) as Array<Record<string, unknown>>;
@@ -2775,9 +2779,12 @@ test('vscode', 'Bash writes the converted groups into chatLanguageModels.json',
 test('vscode', 'Bash preserves unrelated provider groups when merging', async t => {
   if (!hostPython) skip('no python3 interpreter on this host');
   const ws = makeWorkspace();
-  mkdirSync(join(ws.home, '.config', 'Code', 'User'), { recursive: true });
+  // Pin the same profile dir the merge test reads back, so the Darwin
+  // default never diverges from the seeded file.
+  const vscodeDir = join(ws.home, '.config', 'Code', 'User');
+  mkdirSync(vscodeDir, { recursive: true });
   writeFileSync(vscodeSettingsPath(ws), '[{"name":"Other","vendor":"customendpoint","models":[{"id":"other"}]}]');
-  const run = await runShellInstaller({ workspace: ws, baseUrl: modelServer.url, configuration: harnessConfig('vscode') });
+  const run = await runShellInstaller({ workspace: ws, baseUrl: modelServer.url, configuration: harnessConfig('vscode'), extraEnv: { VSCODE_CONFIG_DIR: vscodeDir } });
   t.equal(run.code, 0, `should succeed:\n${run.combined}`);
   const groups = JSON.parse(readFileSync(vscodeSettingsPath(ws), 'utf8')) as Array<Record<string, unknown>>;
   t.equal(groups.length, 2, 'the unrelated group survives alongside Floway');

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants