Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

Commits on main

test(voice): cover testVoiceProvider directly to clear the diff-coverage gate\n\n`PR CI Gate` failed at 0% diff coverage. The cause was not a missing\nassertion but a missing *executor*: `VoicePanel.test.tsx` mocks the whole\n`voiceSettingsApi` module, so `testVoiceProvider`'s body — including the\nnew `api_key` handling — was never run by any test. diff-cover measured\nexactly two lines, both inside that function, both uncovered.\n\nAdded `app/src/services/api/__tests__/voiceSettingsApi.test.ts`, mocking\nonly `callCoreRpc` (the idiom `voiceInstallApi.test.ts` already uses), so\nthe function itself executes:\n\n* `api_key` is ABSENT, not present-and-empty, when no candidate is given —\n the core reads an empty candidate as "fall back to the stored\n credential", so sending one would silently change which key is tested.\n* a candidate key is sent trimmed.\n* a whitespace-only candidate is treated as no key.\n* the `[voice-factory]` log prefix is stripped from `detail`.\n\nAlso covered the modal's `catch` branch. Coverage showed lines 210-211\nunhit: every existing test resolves `{ ok: false }`, which is the verdict\npath, never the *thrown* path (transport dead, core down). Those are lines\nthis PR added, so they counted against the gate — and the branch had no\ntest regardless of the gate.\n\nVerification, all local through the fleet CI semaphore:\n\n* `vitest run voiceSettingsApi.test.ts VoicePanel.test.tsx` — 48 passed.\n* Coverage re-measured from `coverage/lcov.info`: the two previously\n missing lines in `voiceSettingsApi.ts` now show 4 hits each, and no line\n this PR changed in `VoicePanelKeyModal.tsx` is uncovered. The remaining\n unhit lines there (25-56, 146-147, 246) are pre-existing Piper\n install-status branches this PR does not touch.\n* Revert-proofs, each failing on its own assertion, then restored:\n - drop the `.trim()` on the payload → "sends the candidate key for a dry\n run, trimmed" fails at `:42`, diffing `" sk-candidate-key-123\n"`.\n - always send `api_key: apiKey ?? ''` → the two omission tests fail at\n `:25` and `:61`, and the trim test at `:42`; the log-prefix test stays\n green, which is correct — it does not test that behaviour.\n - neuter `stripLogPrefix` → only the prefix test fails, at `:73`.\n - genericise the catch detail to `'Test failed'` → the thrown-error test\n fails at `:878`.\n
M3gA-Mind committed 3 months ago
37be8e6
fix(theme): allow an empty colour map, and require string token values\n\nTwo review findings, both correct. The first reverses a decision I argued for\nin the original commit and got wrong.\n\n**Empty `{}` is now ACCEPTED (chatgpt-codex).** I had rejected it, reasoning\nthat a zero-token theme applies nothing and is therefore as broken as `null`.\nThat reasoning was wrong, and the counter-example is in this repo:\n`CLASSIC_LIGHT` and `CLASSIC_DARK` both carry `colors: {}` deliberately\n(`lib/theme/presets.ts:63-78`). They inherit the base stylesheet tokens and\ncarry their meaning in `isDark`, which `applyTheme` applies independently of any\ncolour (`providers/ThemeProvider.tsx:48-50`). And `exportJson` serialises the\neffective theme, so with Classic active the panel's own Export box emits\n`colors: {}` — which my check then refused on Import, breaking the panel's\nexport -> import round trip for the two most common themes, and refusing\nlegitimate font-, gradient- or backdrop-only themes with it.\n\nThe actual #5901 defect is unchanged and still fixed: `null` and arrays are\nmalformed and are rejected, because `typeof null === 'object'` and\n`typeof [] === 'object'` let both past the old check and `{ ...null }` yields\n`{}` silently.\n\n**Token values must now be strings (CodeRabbit).** The predicate claimed\n`Record<string, string>` while only checking the container, so\n`{"surface": 42}` was accepted and stored. `swatchChannels` falls back only on\nnull/undefined (`??`), so a non-string reaches `channelsToCss`, which calls\n`.trim()` on it and throws — crashing the panel on a theme already in the store.\n\nRenamed `hasColorTokens` -> `isValidColorMap`, since after the first change the\npredicate is about validity, not emptiness.\n\nVerified locally, all through the fleet CI semaphore:\n- `ThemeStudioPanel.test.tsx` 14/14 pass; `tsc --noEmit` exit 0, 0 errors.\n- Revert-proof, string values: replacing the value check with `return true`\n fails exactly the 4 non-string cases.\n- Revert-proof, container: dropping the null/array guard fails the array case.\n Null still rejects, but only incidentally — `Object.values(null)` throws into\n the outer catch. The explicit guard makes that rejection intentional rather\n than an exception caught by a broad handler, which is why it stays.\n\n## Related\nRefs #5901\n
M3gA-Mind committed 3 months ago
7973dac
fix(brain): null-check the error, and clear it on a superseded success\n\nThree review findings on #5942, all legitimate.\n\n`coderabbitai`: an empty error message defeats the truthiness test. `load()`\nstores `err.message`, so an Error carrying no message lands as `''`, which is\nfalsy — that failure then renders NEITHER alert and is silently swallowed. That\nis the exact defect this PR exists to remove, reached through a different door.\nBoth branches now test `error !== null`, the pre-existing destructive one\nincluded, since it had the same hole.\n\n`chatgpt-codex-connector`: two `load()` calls can overlap (the initial one and a\n`memory-tree-completed` event) and share `graph`/`error` with no request\ngeneration. If the newer FAILS and the older then SUCCEEDS, the success renders\na good graph while the newer error is still set, because errors were cleared\nonly when a load STARTS. Before this PR that leftover error was invisible; with\nthe warning it would be a false "your data is stale" on data that is not — a\nregression my own change would have introduced.\n\nTaken codex's second suggested option, "clear the corresponding error on an\naccepted success", rather than a full request-generation guard: it is one line,\nit removes the user-visible false alarm, and it needs no new state. The wider\nserialisation fix belongs in the PR that restructures `load()` — #5945 carries\nit there, where the same race also schedules a spurious retry.\n\n`tinysweeper`: the alert assertions after the failed refresh ran synchronously\nafter a `waitFor` that only waits for the mock to be CALLED, not for React to\ncommit the state its rejection sets. Moved inside `waitFor`.\n\nTwo regression tests added, and both are revert-proofed:\n - N4, success no longer clears a superseded error -> ONLY the overlapping-load\n test fails, and the failure prints the false warning element itself.\n - N5, truthiness restored in both branches -> ONLY the empty-message test\n fails.\nEvery test in the file now has a killing mutation (N1-N5); the earlier three are\nrecorded in the PR body. Sources restored, 5/5 green, typecheck clean.\n
M3gA-Mind committed 3 months ago
1ccef9f
fix(voice): address review — stale test result, key trim, dry-run contract\n\nThree review findings on the "Test Key" dry run, all verified locally.\n\n**Stale test result (Codex).** The API-key field is disabled only while\n*saving*, so it stays editable during a test. Test key A, edit to key B\nbefore the response lands, and A's verdict renders beside B — the same\n"the UI is telling you something untrue about this key" failure this PR\nexists to fix. Added a monotonic `testRequestIdRef`, bumped on every test\nstart and every `onChange`; a response whose id is stale is dropped, in\nthe `catch` as well as the `try`. Same guard `CustomRoutingDialog`\nalready uses, so the two dialogs now behave alike.\n\n`setIsTestingKey(false)` stays unconditional in `finally`: the Test\nbutton is disabled while `isTestingKey`, so only one test is ever in\nflight, and gating it would strand the button on "Testing…" when the\nuser edits mid-test.\n\n**Trim the candidate key (CodeRabbit).** The guard tested `apiKey.trim()`\nwhile the payload sent `apiKey`. Note the reviewer's stated rationale was\nwrong — the core already trims before use, so validation succeeded either\nway. The real defect is the inconsistency, which puts an untrimmed\ncredential on the wire for any future consumer that does not trim.\n\n**Reserved slugs broke the dry-run contract (CodeRabbit).** This PR\nrewrote the schema to promise "no inference call", then left reserved\nslugs falling through to `transcribe`/`synthesize`. A doc that lies is\nworse than the vaguer one it replaced, so this needed a structural guard,\nnot a caveat. Reserved slugs now return before either live branch.\n\nDeviating from the suggested fix: it returned `ok: false`. `ok` drives a\nred/green alert, and `cloud`/`openhuman`/`piper` are working providers\nthat simply have no user-held key — reporting a healthy managed provider\nas a failed check is the same misleading-status bug this PR fixes. Return\n`ok: true` with "No API key to validate". No existing caller changes\nbehaviour: the only `validate_only: true` caller is the modal, which\nsends only deepgram/elevenlabs/openai.\n\nVerification (local, through the fleet CI semaphore):\n\n* `cargo test -p openhuman --lib --features voice test_provider` — 9\n passed. `voice` is NOT in the contributor `default` set, so without\n `--features voice` this silently matches zero voice tests.\n* Revert-proof, Rust: restored the derived `Debug` on\n `VoiceTestProviderParams`. Exactly one test failed —\n `voice_test_provider_params_debug_redacts_the_candidate_key` — naming\n its own assertion at `schemas_tests.rs:518`, with the panic output\n showing `api_key: Some("sk-super-secret-value")`. Restored, 9 pass.\n* `vitest run VoicePanel.test.tsx` — 43 passed.\n* Revert-proof, frontend: removing the stale-response guard fails the new\n race test at `VoicePanel.test.tsx:891` on the stale-verdict assertion.\n Restored, 43 pass.\n* `pnpm typecheck` (`tsc --noEmit`) clean; rustfmt and prettier clean.\n\nNot covered by a test: the reserved-slug guard itself.\n`handle_voice_test_provider` calls `load_config_with_timeout()` and this\nmodule has no config-free unit-test seam — every existing test here is at\nthe schema/params layer. Verified by reading, not executed.\n
M3gA-Mind committed 3 months ago
8cf1220
test(chat): guard the capability-gated action bar in a browser (#5897)\n\nThree Playwright tests covering the fix in the previous commit. Local builds and\ntest runs were re-enabled for the fleet, so this is the coverage that PR body\ndeferred, and it is run and revert-proofed rather than reasoned about.\n\nThe guard has to live at the DOM. `auiThreadState.test.tsx` already asserts the\ncapability FLAG (`canEdit: false`) and passes — nobody ever asserted the\nrendered output, which is exactly how a dead button shipped with the gate\napparently in place.\n\n 1. no Edit button while the runtime cannot edit, and no edit composer either\n 2. the action bar still renders and Copy still works — the control, without\n which a regression that dropped the whole bar would satisfy test 1\n 3. no branch picker while the runtime cannot switch branches\n\nRevert-proofed by restoring the pre-fix unconditional renders and rebuilding:\n\n test 1 fails at chat-user-message-edit-affordance.spec.ts:120\n `.aui-user-action-edit` Expected 0, Received 1\n test 3 fails at :148\n `.aui-branch-picker-root` Expected 0, Received 1\n test 2 keeps passing, so the injected fault is correctly scoped\n\nThat run also settled something the fix commit could only argue from source:\nun-gated, `.aui-branch-picker-root` is present in the DOM with count 1.\n`hideWhenSingleBranch` hides it visually but does not remove it, so the branch\npicker was a real second dead control rather than a theoretical one.\n\nRun through the shared CI slot (3-concurrent cap): build, warm-up run, real run,\nrevert run, restore run. Ports 18404/17704/4404.\n
M3gA-Mind committed 3 months ago
034dc94
a14dd19
test(settings): render hop two instead of grepping for it\n\nComplements the source-level pin already on this branch rather than replacing\nit; both now run.\n\nThe existing hop-two check reads the route table and asserts it contains\n`ForwardSearch`. That was a reasonable call — an AppRoutes spec genuinely cannot\nrender hop two, because it mocks ./pages/Settings and settingsRouteElements\neagerly imports all 34 panels. But settingsRouteElements.test.tsx ALREADY renders\nthat table for real (it is how the retired screen-settings routes are covered),\nso the behaviour is reachable there for ~5s of runtime.\n\nAdds three cases in that file: the redirect lands on /connections, a query\nstring and fragment survive it, and nothing stray is invented when the link\ncarries neither.\n\nWhy both are worth keeping, measured rather than argued:\n\n - Wrapping the element in a fragment — <><ForwardSearch …/></> — is\n behaviour-preserving. The source assertion FAILS it\n ("expected '<Route path=\"integrations\" element={<>' to contain\n 'ForwardSearch'"); the rendered assertion correctly passes. So the source\n check is formatting-sensitive.\n - Reverting ForwardSearch -> Navigate is a real break. BOTH fail, the rendered\n one naming the defect directly:\n "expected '#/connections' to be '#/connections?tab=inbound#delivery-3'".\n\nRestored after each injection: 13 passed across both files, sources clean.\nAll runs through ~/tinyhuman/ci-slot.sh.\n
M3gA-Mind committed 3 months ago
314cb80
264cb45
fix(voice): make "Test Key" a real dry run instead of a save\n\nThe provider-enable modal's "Test Key" button called\n`handleEnableExternalProvider` before testing anything. That handler\npersists the key via `setVoiceProviderKey`, writes the provider into\nvoice settings via `saveVoiceSettings`, and clears `pendingKeySlug`\n(`VoicePanel.tsx:392-394`). Since the modal renders behind\n`{pendingKeySlug && ...}` (`VoicePanel.tsx:511`), clearing it unmounts\nthe modal — so the `setKeyTestResult` that followed landed on a dead\ncomponent.\n\nTwo user-visible consequences, both fixed here:\n\n 1. a key the user only wanted to CHECK was written to the keychain and\n activated before it was known to work;\n 2. the result alert was unreachable, so "Test Key" appeared to do\n nothing at all.\n\nThe reason the handler saved first was structural, not sloppiness: the\n`voice_test_provider` RPC had no way to receive a candidate key. It\nresolved the key from the keychain and the endpoint from an existing\n`config.voice_providers` entry, so a first-time key check was impossible\nwithout persisting first. Fixing only the frontend ordering would have\nproduced "no voice provider with slug 'elevenlabs'" every time.\n\nSo the dry run is made real end to end:\n\n* `voice_test_provider` gains an optional `api_key` — a candidate\n credential validated as-is and never stored. Omitting it keeps the old\n behaviour (use the stored credential), which is what the routing\n section's Test buttons want.\n* `validate_tts_provider_key` becomes `validate_provider_key` and\n resolves the endpoint from `builtin_voice_provider` when the slug is\n not yet in config, so a key can be checked before any entry exists.\n* `validate_only` is hoisted above the workload match. It was checked\n inside the "tts" arm alone, which made it a silent no-op for STT — and\n every provider the modal can reach maps to "stt" (`capability === 'tts'\n ? 'tts' : 'stt'`, and none of deepgram/elevenlabs/openai is tts-only).\n The modal's dry-run request was therefore always answered with a live\n transcription. Reserved slugs still fall through to the live test so\n the factory keeps reporting misconfiguration by name.\n* Deepgram authenticates with `Authorization: Token`, not `Bearer`\n (`factory/stt_providers.rs:237`). The shared validator only knew\n elevenlabs-vs-Bearer, so now that it covers STT slugs a valid Deepgram\n key would have read as invalid. Added the `Token` branch.\n* `VoiceTestProviderParams` gets a hand-written `Debug` that redacts\n `api_key`, so a future `{:?}` in a log line cannot leak the credential.\n (The RPC dispatch layer already redacts a param named `api_key`.)\n\nThe equivalent LLM path (`CustomRoutingDialog.handleTest`) was checked\nfor the same shape and is clean — it tests without enabling.\n\nVerification: read-only. The whole diff was verified by reading the\nsources named above; per the standing no-local-builds rule nothing here\nwas compiled or executed locally. `rustfmt --check` and `prettier\n--check` are clean on the touched files (formatters, not builds). The\nfour new Rust unit tests and three new vitest cases have NOT been run —\nGitHub Actions is the verification.\n\nCloses #5896\n
M3gA-Mind committed 3 months ago
c65c9db
fix(theme): reject an import whose colors are null, an array, or empty\n\n`"colors": null` passed validation and produced an activatable theme with zero\ncolour tokens.\n\nThe shape check was:\n\n if (!parsed || typeof parsed !== 'object' || typeof parsed.colors !== 'object')\n\nand `typeof null === 'object'`, so null slipped through. Execution reached\n`colors: { ...(parsed.colors) }`, and spreading null yields `{}` rather than\nthrowing — so the theme was written to the store and could be activated from\nthe gallery, applying nothing.\n\n`typeof [] === 'object'` too, so an array was the same hole by a second route.\nBoth are covered now.\n\n**Empty `{}` is refused as well, and that is a judgement call worth stating.**\nIts user-visible outcome is identical to null: `applyTheme` writes one CSS\ncustom property per token, and `withDerivedChrome` derives only FROM existing\ntokens (`lib/theme/chrome.ts:67-79`), so a zero-token theme applies nothing at\nall — a named entry in the gallery that silently does nothing when clicked.\nAccepting `{}` while rejecting `null` would fix the shape and leave the defect\nthat motivated the report.\n\nThe cost, stated plainly: a fonts-or-backdrop-only theme can no longer be\nimported without at least one colour. That was never really supported — `colors`\nhas always been a required field on this path — and it is the narrower trade\nagainst shipping a theme that does nothing. A single-token theme still imports,\nand there is a test pinning that so the guard cannot drift into over-rejecting.\n\nReplaces the inline `typeof` test with a `hasColorTokens` type predicate at\nmodule scope, so the intent reads at the call site and the narrowing is explicit.\n\nVerified by reading `ThemeStudioPanel.tsx:178-196`, `providers/ThemeProvider.tsx:38-60`\nand `lib/theme/chrome.ts:67-79`; NOT executed — a fleet-wide no-local-builds rule\nis in force, so CI is the check.\n\n## Related\nCloses #5901\n
M3gA-Mind committed 3 months ago
f0638a6
fix(settings): show the real error when a profile save/select/delete fails\n\nEvery failed agent-profile action rendered "[object Object]" instead of the\nbackend's reason, destroying the only diagnostic the user gets on the error\npath of three actions.\n\nCause: `dispatch(thunk).unwrap()` does not reject with an `Error`. For a\n`createAsyncThunk` that threw, Redux Toolkit rethrows its `SerializedError` —\na plain object `{ name, message, stack }` — and for one using\n`rejectWithValue`, the payload, often a bare string. So the guard\n\n err instanceof Error ? err.message : String(err)\n\ntook its `String(err)` branch on exactly the shape it was written to handle,\nand `String({ message: '…' })` is "[object Object]". The guard was defeated by\nthe one case it existed for.\n\nFixed the class, not the three lines. The repo had already solved this twice in\ndomain-specific form — `formatThreadCreateError` (store/threadSlice.ts:115) and\n`formatThreadLoadError` (features/conversations/Conversations.tsx:220), the\nfirst written for the same root cause in #5156. Rather than a fourth copy, this\nadds one general `errorMessage(error, fallback)` in `lib/errorMessage.ts` that\nduck-types `message` instead of testing the prototype, and routes all three\nprofile sites through it.\n\nThe two existing helpers are deliberately left alone: they carry domain\nfallbacks and, in the thread case, an empty-message rule that #5156 depends on.\nConverting them is a follow-up, not part of this fix.\n\nAlso flips the two tests that pinned this defect. Both carried a comment saying\nto invert them rather than delete them when the fix landed (#5886, now merged),\nso a regression re-surfaces in the same place. Added SerializedError-shaped\ncases alongside the `Error` ones, since that is the shape production actually\nproduces and the old tests only ever exercised `Error`.\n\nScope note: 164 files use the same ternary, but the defect only bites where the\nrejection is a non-Error object carrying `message` — the `.unwrap()` boundary.\nOnly the three sites named in the issue are on that boundary, so the diff stops\nthere rather than sweeping files where the guard is correct.\n\nVerified by reading `store/threadSlice.ts:107-127` (the same normalisation, and\nits #5156 rationale) and `lib/theme/chrome.ts` for the sibling call sites; NOT\nexecuted — a fleet-wide no-local-builds rule is in force, so CI is the check.\n\n## Related\nCloses #5900\n
M3gA-Mind committed 3 months ago
456731f
fix(app): disable Test connection for a custom embeddings endpoint, with a reason\n\nThe control was enabled and clickable for a custom provider and did nothing at\nall — no request, no result, no error (#5909):\n\n onClick={() => { if (!isCustom) onTest(); }}\n disabled={setupTesting || setupSaving || (!isCustom && !setupKey.trim())}\n\nThe disabled predicate short-circuits on `!isCustom`, so custom never reaches\nit; the handler then guards the same condition and returns.\n\nDisabled rather than implemented, deliberately. `setupTest` calls\n`openhuman.embeddings_test_connection` with only\n`{ provider, model, dimensions }` (EmbeddingsPanel.tsx:260-265) and the client\nsignature has no endpoint parameter (embeddingsApi.ts:110-114). The custom\nendpoint, model and dims the user typed are never sent, and the handler now\nlives in the vendored memory engine rather than this repo, so making the test\nwork means changing an RPC contract outside this change's scope. A fake success\nwould be worse than the dead button; an honest explanation is better than both.\n\nThe `title` uses `t(key, fallback)` — an existing pattern (ThemeStudioPanel.tsx:126)\n— so no new key has to be threaded through fifteen locale files for a string\nthat should disappear when the endpoint parameter is added.\n\nSave is untouched and still reachable for a custom endpoint: that path works,\nand the tooltip points at it.\n\nTests: the spec that PINNED the dead control is replaced rather than deleted —\nit now asserts the button is disabled, that the reason is on the element, and\nthat Save stays enabled so the fix cannot silently take the working path with it.\n\nVerified by reading EmbeddingsSetupModal.tsx:70-92, EmbeddingsPanel.tsx:250-276\nand embeddingsApi.ts:110-120. NOT EXECUTED — local test runs are forbidden by\nstanding rule; CI is the check.\n
M3gA-Mind committed 3 months ago
f973ab6
fix(sidebar): clamp the sidebar to half the window on a narrow viewport\n\nThe sidebar width was clamped against SIDEBAR_MIN_WIDTH (188) and\nSIDEBAR_MAX_WIDTH (420) and never against the window, so a narrow window left it\nowning most of the screen: 224px of a 414px viewport, 54%, with a hard 188px\nfloor below that. tauri.conf.json declares the main window `resizable: true`\nwith no `minWidth`, so that state is reachable by dragging.\n\nFixed with `max-w-[50vw]` on the sidebar column rather than a JS clamp, for a\nreason worth recording: the width arrives as an inline style, and `max-width`\nalways constrains `width`, so the browser applies this continuously with no\nlistener, no re-render and no extra state.\n\nA JS clamp would have needed BOTH halves — the arithmetic and something that\nre-renders on resize — because `clamp()` in RootShellLayout only runs at render\nand nothing in the shell listens for `resize`: no handler, no matchMedia, no\nuseMediaQuery anywhere in components/layout/shell or components/ui/Sidebar.tsx.\nThat is measured, not assumed: injecting a viewport clamp into `clamp()` during\nthe earlier investigation changed the rendered width not at all.\n\nInert on desktop by construction. 50vw exceeds SIDEBAR_MAX_WIDTH above an 840px\nwindow, so at the 1280x900 default the clamp can never bind and the stored width\ndecides exactly as before. The collapsed icon column is far below it.\n\nKnown wart, deliberately accepted: dragging past 50vw on a narrow window stores\na width larger than the one rendered, so widening the window later reveals the\nstored value. That preserves the user's preference rather than silently\nrewriting it, and clamping the stored value instead would need the resize\nlistener this change exists to avoid.\n\nTests: app-shell-responsive.spec.ts had a characterization test asserting the\nOPPOSITE — `width > 414 / 2` — written with a note that adding a viewport clamp\nshould be the thing that makes it fail. This is that flip, and it now asserts\nthe clamp holds. A second test asserts the clamp is inert at 1280px, so it\ncannot become a quieter second way to shrink the sidebar on a normal window.\n\nNOT EXECUTED. Local builds and test runs are prohibited in this phase, so this\nis reasoned from source: Sidebar.tsx:47-49 (constants), :232 (inline width),\nRootShellLayout.tsx:37-38 (clamp), tauri.conf.json (no minWidth). Prettier\nclean, tsc reports no errors in the touched files. CI is the check.\n\n## Related\n\nCloses #5907\n
M3gA-Mind committed 3 months ago
81f1755