Skip to content

feat(settings): Add Development knobs for the Harness attachment - #537

Merged
omesser merged 1 commit into
mainfrom
feat/447-development-knobs
Sep 8, 2026
Merged

omesser merged 1 commit into
mainfrom
feat/447-development-knobs

Conversation

@omesser

@omesser omesser commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Why

Three Harness knobs had nowhere to live but a shell export.

  • The Completer timeout row said "Timeout, in seconds" and nothing else, but since feat(harness): Speak ACP to a spawned Harness as the session Completer (#300) #433 it budgets a Harness session/prompt as well as an HTTP Completer request, and expiry cancels the turn. A reader had no way to know a cancelled Harness turn came from that field.
  • The auth-retry interval was hardcoded at 60s in harness.rs. A test or a smoke run that has to watch the retry cannot wait a minute for it.
  • AI_BUDDY_MCP_BIN was env / beside-exe only, so pointing a run at a different stdio MCP server meant relaunching the app with the variable set.

What changed

FormRow::TextField gained help: Option<String> — the hint every other row kind already had. A label says what a row is and a placeholder says what blank means; neither had room for what the timeout costs. All three renderers draw it under the field, the same way they draw a checkbox's help. Section comments were the cheaper alternative and were rejected: the Win32 window does not render them at all.

The two new rows sit in a new Harness attachment section on the Development tab, not on Director. Neither is a choice anyone makes to get a buddy working; both exist so a test or a CI job can be told where to look and how long to wait.

  • AI_BUDDY_HARNESS_AUTH_RETRY_SECS → Settings.harness_auth_retry_secs, seeded into dev_flags::harness_auth_retry_secs(). Session::new reads it exactly where it already reads dev_flags::director_timeout_secs(), so a change lands on the next attach.
  • AI_BUDDY_MCP_BIN → Settings.mcp_bin, seeded into dev_flags::mcp_bin(). mcp_server() reads it at attach rather than at construction, so a path typed in the window is the one the next attach hands over. A Mutex<String> rather than an atomic, because a path is not a number; it is locked on a seed and at attach only.

Both follow the ownership pattern the other Completer limits use: the exported variable outranks the file, freezes the row and names itself in the label, and dev_flags::seed re-reads the environment on every applied patch.

Deliberately not done, per the issue's scope fence: spawn backoff first/cap and the attach-timeout floor stay hardcoded until #434 / #437 show they need dials. No credential row, no always-approve control.

How to verify

cargo test -p ai-buddy — 318 passed, 0 failed. The five written first, each watched red before it went green:

test dev_flags::tests::an_exported_auth_retry_outranks_the_file ... ok
test dev_flags::tests::an_exported_mcp_bin_outranks_the_file ... ok
test settings::form::tests::the_timeout_row_says_it_budgets_a_harness_turn ... ok
test settings::form::tests::the_harness_knobs_are_development_rows ... ok
test settings::tests::the_harness_knobs_round_trip_through_a_patch ... ok

every_development_row_has_a_value_in_the_view already covered the other half — a Development row whose id is missing from the view draws blank over a value that is in force — and it passes with both new rows on the tab.

Then cargo clippy --all-targets -- -D warnings clean, and pre-commit run --files <the eight touched> clean after staging one cargo fmt rewrite.

Notes

CI is the first thing that compiles two of these files. Only aarch64-apple-darwin is installed here, so platform/x11/settings_window.rs and platform/windows/settings_window.rs were edited by matching the existing rows and never built. The x11 change is the help field in the destructuring plus one help_line call; the Windows change is the same field plus a static hint copied from the checkbox arm — with the label arm's CString binding rather than the checkbox arm's temporary, which dangles.

Not verified by hand: the rendered look of the three windows. I did not launch the app, so the AppKit hint spacing under a text field is untested, and neither is the Win32 hint's y advance.

Not verified end to end: that a Harness actually retries session/new on a five-second interval typed into the row, or that a path typed into the MCP row reaches a real child. Both read sites are covered by unit tests on the value they receive; nothing here drove a live Harness.

Collisions. #520 and #512 are open against the same surface. Neither moves the rows added here — #520 is the Director tab's endpoint picker and #512 is the capturable switch — but both touch settings/form.rs, and #512 also touches dev_flags.rs, settings.rs and the docs/DEVELOPMENT.md env table. Expect textual conflicts on merge order, not semantic ones.

Closes #447

— Claude Code, on @omesser's behalf.

@omesser

omesser commented Sep 8, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto e76c7054. Two conflicts, both from #491 and #497 landing after this branch opened, and both resolved by keeping main's structure and this branch's behaviour.

src-tauri/src/harness.rs. main had renamed the function to mcp_stdio() and documented it as the first of three stdio routes; this branch had renamed the same function to mcp_server(), which now collides with main's mcp_server(handshake). The resolution keeps main's name and its three-route documentation, and takes this branch's body — the path comes from dev_flags::mcp_bin() rather than std::env::var_os(MCP_BIN), which is what makes the Development row do anything, and it is still read at attach so a typed path lands on the next one. The nearby comment lost its stale #166 pointer, since that loopback follow-up shipped in #491.

docs/DEVELOPMENT.md. The AI_BUDDY_MCP_BIN row was rewritten on both sides. Merged rather than picked: main's architecture half is kept in full — three stdio routes, all dispatching through stubs, and the loopback server as the only path whose speak reaches a buddy (ADR-0023) — with this branch's two sentences about the Settings override and attach-time reads folded in. The new AI_BUDDY_HARNESS_AUTH_RETRY_SECS row follows it untouched.

Verification after the rebase: 333 tests in the shell, 463 in core, 23 and 2 in the smaller crates, 0 failed. cargo clippy --all-targets -- -D warnings clean. Every pre-commit hook passes on the touched files.

Unchanged from the original: platform/x11/ and platform/windows/ were edited without being compiled — only aarch64-apple-darwin is installed here, so CI is the first thing that builds them.

— Claude Code, on @omesser's behalf.

@omesser
omesser force-pushed the feat/447-development-knobs branch from 3d1fea4 to 149e89a Compare September 8, 2026 03:20
Auth-retry interval and MCP server binary as Development rows with env
overrides, and help text on the Completer timeout saying it budgets a
Harness turn too. x11 and Windows renderers were edited blind: only
aarch64-apple-darwin builds here, so CI compiles them first.
@omesser
omesser force-pushed the feat/447-development-knobs branch from 149e89a to 5e93131 Compare September 8, 2026 15:29
@omesser
omesser merged commit af65734 into main Sep 8, 2026
5 checks passed
@omesser
omesser deleted the feat/447-development-knobs branch September 9, 2026 15:48
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.

feat(settings): Development Completer/Harness knobs (timeout help, auth-retry, MCP bin)

1 participant