Skip to content

fix(desktop): stop the create-agent provider config probe from erasing keystrokes - #4411

Merged
tlongwell-block merged 2 commits into
mainfrom
eva/where-to-run-probe-clobber
Aug 3, 2026
Merged

fix(desktop): stop the create-agent provider config probe from erasing keystrokes#4411
tlongwell-block merged 2 commits into
mainfrom
eva/where-to-run-probe-clobber

Conversation

@tlongwell-block

Copy link
Copy Markdown
Collaborator

What

Fixes the create-agent dialog's "Run on" provider config fields eating keystrokes — reported by Tyler in buzz-remote-agents (channel 29414326, thread db76677a): the Kubernetes Kubeconfig context field would not accept typing.

Why it happened (the Typewriter Eraser, shipped in #4289)

WhereToRunSection's probe useEffect depended on the whole draft:

  1. every keystroke changed the draft → effect re-fired → provider binary re-probed;
  2. each probe result is a fresh object written into the draft → the effect re-triggered itself, respawning the provider binary in a loop for as long as the dialog sat on a provider;
  3. every probe resolution reset providerConfig to schema defaults — erasing whatever was typed. A field with no schema default (context) snapped back to empty, i.e. "won't let me type". Unrelated to how many kubeconfig contexts you have.

Fix

  • Probe once per provider selection, keyed on the provider's stable binaryPath — not the draft, not the provider object (a useBackendProvidersQuery refresh must not reprobe an unchanged selection).
  • Latest-state resolution via React.useEffectEvent + a new pure applyProbeResult helper: schema defaults merge beneath the current providerConfig, so a probe landing after the user typed can never clobber in-flight input (per Wren's pre-patch red-team: changing deps alone leaves a stale closure).

Existing cancelled cleanup keeps provider-switch/unmount safe; selection reset (emptyWhereToRunDraft) and the fail-closed probe-error path are unchanged.

Tests

  • Unit (whereToRunIntent.test.mjs): applyProbeResult merge semantics — defaults under typed values, user-cleared fields stay cleared, schema-less results, unrelated fields preserved.
  • E2E (new where-to-run-config.spec.ts, added to the smoke project, red-first verified: all 3 fail against the unfixed component):
    • typing into a defaultless provider field sticks, and probe_backend_provider fires exactly once per selection;
    • the config form is gated on probe resolution (slow probe: no half-rendered form, defaults prefill once);
    • provider → local → provider re-probes and resets cleanly.
  • Mock bridge gains backendProviders / backendProviderProbeResult / backendProviderProbeDelayMs seams (defaults preserve prior behavior).

Verification at 8eb7680

  • pnpm check + tsc clean, pnpm test 3926/3926;
  • new spec 3/3 green (and 3/3 red on the unfixed component);
  • pre-push lefthook: desktop-test, desktop-check, desktop-tauri-checks, rust-tests, mobile-test all green.

…g keystrokes

The WhereToRunSection probe effect depended on the whole run draft, so
every keystroke in a provider config field re-fired the effect, re-probed
the provider binary, and — because each probe result is a fresh object —
kept re-probing in a loop for as long as the dialog sat on a provider.
Each resolution then reset providerConfig to schema defaults, erasing
whatever the user had typed. Fields without a schema default (the
Kubernetes 'Kubeconfig context') read as completely dead.

Fix:
- Probe once per provider selection, keyed on the provider's stable
  binary path — not the draft, not the provider object (a providers-query
  refresh must not reprobe an unchanged selection).
- Resolve with latest-state semantics via useEffectEvent + a new
  applyProbeResult helper that merges schema defaults BENEATH the current
  providerConfig, so a probe landing after the user typed can never
  clobber in-flight input.

Tests:
- unit: applyProbeResult merge semantics (defaults under typed values,
  user-cleared fields stay cleared, schema-less results).
- e2e (new where-to-run-config.spec.ts, red-first verified against the
  unfixed component): typing sticks + exactly one probe per selection,
  probe-gated form render with a slow probe, provider->local->provider
  reset. Mock bridge gains backendProviders / backendProviderProbeResult /
  backendProviderProbeDelayMs seams.

Reported by Tyler in buzz-remote-agents (channel 29414326, thread
db76677a): could not type into the Kubeconfig context field.

Co-authored-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
Signed-off-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
@tlongwell-block
tlongwell-block requested a review from a team as a code owner August 2, 2026 21:27
The comment claimed the delay lets a spec type into provider config
fields while the probe is in flight, but the form is probe-gated so
that path is unreachable through the UI (the new spec documents this).
Point the comment at what the seam actually enables — asserting the
pre-resolution gated state — and at the unit test that pins the
mid-flight merge instead.

Non-blocking review nit from the PR #4411 final review.

Co-authored-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
Signed-off-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
@Chessing234

Copy link
Copy Markdown
Contributor

the useEffectEvent + path-keyed probe fix reads right — depending on draft was a nasty eraser loop. glad this landed in the create-agent dialog.

@tlongwell-block
tlongwell-block merged commit 2c0ac24 into main Aug 3, 2026
46 of 48 checks passed
@tlongwell-block
tlongwell-block deleted the eva/where-to-run-probe-clobber branch August 3, 2026 11:36
tlongwell-block pushed a commit that referenced this pull request Aug 3, 2026
Pulls in main as a new commit on top per Tyler's instruction before the
flicker fix and splash animation work. No rebase, no force.

* origin/main:
  fix(desktop): stop the create-agent provider config probe from erasing keystrokes (#4411)
  fix(mobile): recover and pace live subscriptions (#3053)
  feat(acp): deliver system prompt via _meta.systemPrompt for claude-agent-acp (#4395)

Co-authored-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
Signed-off-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
justinharkelroad pushed a commit to justinharkelroad/buzz that referenced this pull request Aug 3, 2026
…g keystrokes (block#4411)

## What

Fixes the create-agent dialog's "Run on" provider config fields eating
keystrokes — reported by Tyler in buzz-remote-agents (channel
`29414326`, thread `db76677a`): the Kubernetes **Kubeconfig context**
field would not accept typing.

## Why it happened (the Typewriter Eraser, shipped in block#4289)

`WhereToRunSection`'s probe `useEffect` depended on the whole `draft`:

1. every keystroke changed the draft → effect re-fired → provider binary
re-probed;
2. each probe result is a fresh object written into the draft → the
effect re-triggered **itself**, respawning the provider binary in a loop
for as long as the dialog sat on a provider;
3. every probe resolution reset `providerConfig` to schema defaults —
erasing whatever was typed. A field with no schema default (`context`)
snapped back to empty, i.e. "won't let me type". Unrelated to how many
kubeconfig contexts you have.

## Fix

- **Probe once per provider selection**, keyed on the provider's stable
`binaryPath` — not the draft, not the provider object (a
`useBackendProvidersQuery` refresh must not reprobe an unchanged
selection).
- **Latest-state resolution** via `React.useEffectEvent` + a new pure
`applyProbeResult` helper: schema defaults merge **beneath** the current
`providerConfig`, so a probe landing after the user typed can never
clobber in-flight input (per Wren's pre-patch red-team: changing deps
alone leaves a stale closure).

Existing `cancelled` cleanup keeps provider-switch/unmount safe;
selection reset (`emptyWhereToRunDraft`) and the fail-closed probe-error
path are unchanged.

## Tests

- **Unit** (`whereToRunIntent.test.mjs`): `applyProbeResult` merge
semantics — defaults under typed values, user-cleared fields stay
cleared, schema-less results, unrelated fields preserved.
- **E2E** (new `where-to-run-config.spec.ts`, added to the smoke
project, **red-first verified**: all 3 fail against the unfixed
component):
- typing into a defaultless provider field sticks, and
`probe_backend_provider` fires exactly once per selection;
- the config form is gated on probe resolution (slow probe: no
half-rendered form, defaults prefill once);
  - provider → local → provider re-probes and resets cleanly.
- Mock bridge gains `backendProviders` / `backendProviderProbeResult` /
`backendProviderProbeDelayMs` seams (defaults preserve prior behavior).

## Verification at 8eb7680

- `pnpm check` + `tsc` clean, `pnpm test` 3926/3926;
- new spec 3/3 green (and 3/3 red on the unfixed component);
- pre-push lefthook: desktop-test, desktop-check, desktop-tauri-checks,
rust-tests, mobile-test all green.

---------

Signed-off-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
Co-authored-by: npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d <011987e296fd5006292d2f930b574be47c7801048d1983c46c425d3c95f0cffd@buzz.block.builderlab.xyz>
(cherry picked from commit 2c0ac24)
Signed-off-by: Justin <justin@triumphfw.com>
joahg added a commit to joahg/buzz-dev-mode that referenced this pull request Aug 3, 2026
…-style

* origin/main:
  Polish mobile composer and messaging UI (block#3918)
  ci(linux): enable mesh-llm feature in Linux release and canary builds (block#4524)
  fix(desktop): stop the create-agent provider config probe from erasing keystrokes (block#4411)
  fix(mobile): recover and pace live subscriptions (block#3053)
  feat(acp): deliver system prompt via _meta.systemPrompt for claude-agent-acp (block#4395)
  fix(security): bump nostr crates for RUSTSEC-2026-0225..0232 + default sprig image to published digest (block#4392)
  fix(desktop): back/forward via keyboard chords, mouse X1/X2 buttons, and swipe gestures (block#3778)
  feat(k8s): Kubernetes backend plugin + desktop deploy path (block#4289)
  fix(git): allow deleting the default branch (block#4297)
  feat(projects): add buzz projects CLI commands (NIP-MP kind:30621) (block#4020)
  docs: formal spec for remote agents and their management (block#3748)
  fix(nip-oa): accept raw Nostr tag form in parse_json_array (block#4203)
  perf(relay): serve relay-membership checks from the read replica (block#4124)
  chore(deps): bump nostr-relay-pool for RUSTSEC-2026-0224 (block#4139)
  docs(nostr): document #h requirement for live reaction subscriptions (block#3487)

Signed-off-by: Joah Gerstenberg <joah@squareup.com>
wpfleger96 pushed a commit that referenced this pull request Aug 3, 2026
…ed-unread

* origin/main: (44 commits)
  chore(release): release Buzz Desktop version 0.5.4 (#4562)
  test(mobile): assert follow boundary semantics (#4559)
  docs(release): align desktop handoff instructions (#3988)
  fix: report agent usage per provider round, not once per turn (#4545)
  fix(desktop): harden Windows installs against Defender block and orphaned Node (#4382)
  feat(desktop): improve channel template discovery (#4549)
  fix(desktop): save key backups to authorized path (#4022)
  Add channel activity hover menu (#3935)
  feat(desktop): show saved Run on settings when editing an agent (#4539)
  fix(desktop): disambiguate provider API key labels and annotate mint key (#4406)
  fix(desktop): make OpenAI key re-enterable after first save in card mint dialog (#4140)
  fix(config-bridge): add harness-definition env tier and fix equal-value model override (#3580)
  Polish mobile composer and messaging UI (#3918)
  ci(linux): enable mesh-llm feature in Linux release and canary builds (#4524)
  fix(desktop): stop the create-agent provider config probe from erasing keystrokes (#4411)
  fix(mobile): recover and pace live subscriptions (#3053)
  feat(acp): deliver system prompt via _meta.systemPrompt for claude-agent-acp (#4395)
  fix(security): bump nostr crates for RUSTSEC-2026-0225..0232 + default sprig image to published digest (#4392)
  fix(desktop): back/forward via keyboard chords, mouse X1/X2 buttons, and swipe gestures (#3778)
  feat(k8s): Kubernetes backend plugin + desktop deploy path (#4289)
  ...

Signed-off-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
wpfleger96 added a commit that referenced this pull request Aug 3, 2026
Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>

* origin/main: (40 commits)
  fix(mobile): recover stale relay sessions (#4372)
  chore(release): release Buzz Desktop version 0.5.4 (#4562)
  test(mobile): assert follow boundary semantics (#4559)
  docs(release): align desktop handoff instructions (#3988)
  fix: report agent usage per provider round, not once per turn (#4545)
  fix(desktop): harden Windows installs against Defender block and orphaned Node (#4382)
  feat(desktop): improve channel template discovery (#4549)
  fix(desktop): save key backups to authorized path (#4022)
  Add channel activity hover menu (#3935)
  feat(desktop): show saved Run on settings when editing an agent (#4539)
  fix(desktop): disambiguate provider API key labels and annotate mint key (#4406)
  fix(desktop): make OpenAI key re-enterable after first save in card mint dialog (#4140)
  fix(config-bridge): add harness-definition env tier and fix equal-value model override (#3580)
  Polish mobile composer and messaging UI (#3918)
  ci(linux): enable mesh-llm feature in Linux release and canary builds (#4524)
  fix(desktop): stop the create-agent provider config probe from erasing keystrokes (#4411)
  fix(mobile): recover and pace live subscriptions (#3053)
  feat(acp): deliver system prompt via _meta.systemPrompt for claude-agent-acp (#4395)
  fix(security): bump nostr crates for RUSTSEC-2026-0225..0232 + default sprig image to published digest (#4392)
  fix(desktop): back/forward via keyboard chords, mouse X1/X2 buttons, and swipe gestures (#3778)
  ...
wpfleger96 added a commit that referenced this pull request Aug 3, 2026
Syncs Cargo.lock and ci.yml updates from origin/main via the umbrella, which
resolves the RUSTSEC-2026-0225..0229 nostr advisory failures in the Security gate.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>

* commit 'ad9ae1dbb0c2d9b6839c1e18d6fd6a78238b61fb': (40 commits)
  fix(mobile): recover stale relay sessions (#4372)
  chore(release): release Buzz Desktop version 0.5.4 (#4562)
  test(mobile): assert follow boundary semantics (#4559)
  docs(release): align desktop handoff instructions (#3988)
  fix: report agent usage per provider round, not once per turn (#4545)
  fix(desktop): harden Windows installs against Defender block and orphaned Node (#4382)
  feat(desktop): improve channel template discovery (#4549)
  fix(desktop): save key backups to authorized path (#4022)
  Add channel activity hover menu (#3935)
  feat(desktop): show saved Run on settings when editing an agent (#4539)
  fix(desktop): disambiguate provider API key labels and annotate mint key (#4406)
  fix(desktop): make OpenAI key re-enterable after first save in card mint dialog (#4140)
  fix(config-bridge): add harness-definition env tier and fix equal-value model override (#3580)
  Polish mobile composer and messaging UI (#3918)
  ci(linux): enable mesh-llm feature in Linux release and canary builds (#4524)
  fix(desktop): stop the create-agent provider config probe from erasing keystrokes (#4411)
  fix(mobile): recover and pace live subscriptions (#3053)
  feat(acp): deliver system prompt via _meta.systemPrompt for claude-agent-acp (#4395)
  fix(security): bump nostr crates for RUSTSEC-2026-0225..0232 + default sprig image to published digest (#4392)
  fix(desktop): back/forward via keyboard chords, mouse X1/X2 buttons, and swipe gestures (#3778)
  ...
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