Skip to content

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

Commits on main

fix(mcp_setup): report a failed connect in band instead of as a false success\n\n`mcp_setup_install_and_connect` declared a required `status` discriminator\n(`connected` | `installed_disconnected`) and a conditional `error`, and emitted\nneither. It returned `{server_id, qualified_name, tools}`, so a caller branching\non the documented discriminator branched on `undefined` forever.\n\nThe issue diagnosed `installed_disconnected` as structurally unreachable because\na failed connect left the handler via `?`. That is not what happens. The\nregistry's own `setup_install_and_connect` already handles the partial success:\non a connect failure it logs the reason and returns\n`Ok(ConnectOutcome { server_id, tools: vec![] })`. The `?` fires only when the\n*install* fails.\n\nThe real defect was worse than reported. Because `ConnectOutcome` carries only\n`server_id` and `tools`, a failed connect was byte-identical to a server that\nconnected and advertises no tools — a legitimate state this handler deliberately\ntreats as connected. So a failed connect was reported as a **success**, and it\npublished `DomainEvent::McpServerConnected { tool_count: 0 }` to every\nsubscriber: a false claim that the server came up.\n\nCounting tools cannot separate the two. `ConnStatus` can — it carries the live\n`ServerStatus` plus `last_error` — so the handler now reads the connection state\nback and classifies from it:\n\n- `Connected` -> `status: "connected"`, `tools` present, no `error`, and the\n `McpServerConnected` event still fires (including for zero tools, since the\n verdict comes from `ServerStatus`, never the count).\n- anything else, or a status that cannot be read back -> `status:\n "installed_disconnected"` with `error`, `tools` omitted, and **no**\n `McpServerConnected` event. `server_id` is still returned: the install\n succeeded, and it is what a caller needs to retry or remove the server.\n\nThis is the decided direction on #6110 — the schema is right, the handler was\nwrong — and it makes the two adjacent steps of one flow consistent, since the\nsibling `mcp_setup_test_connection` already reports a failed dial in band.\n\n`qualified_name` was emitted but undeclared. Declared rather than removed: it is\nadditive, it makes the catalog truthful, and dropping a field the setup agent may\nalready read would trade one drift for another.\n\nClassification and payload assembly are split into two pure functions so both\narms are testable without a registry or a reachable MCP server — the same shape\nused for `split_manifest_trust` in #6093.\n\nCloses #6110\n
M3gA-Mind committed 2 months ago
1591a83
fix(tests): send the bearer the process validates, not each suite's own literal\n\n`core::auth::RPC_TOKEN` is a process-global `OnceLock` and `init_rpc_token`\nreturns early once it is set — deliberately, so a second call cannot 401 live\nclients. That early return is load-bearing and is not touched here.\n\nSince `tests/raw_coverage/` became one aggregated binary, only the first suite\nto reach `ensure_rpc_auth()` pins the bearer for the whole process. The other\nthree kept sending `Bearer <their own TEST_RPC_TOKEN>`, got 401, and tripped\ntheir own `assert_eq!(status, OK)`. Which suites lose depends on libtest\nscheduling.\n\nEach suite now asks `get_rpc_token()` what the process settled on. Each still\nseeds `CORE_TOKEN_ENV_VAR` with its own literal, so a suite that does win the\nrace is unaffected — it simply no longer assumes it won.\n\nThe guard is a source scan rather than a runtime assertion. A runtime assertion\npasses whenever its own file happens to win the race, so it could not fail\ndeterministically, and it could not see a new suite reintroducing the literal.\nIt asserts it read more than ten files, so an empty scan fails instead of\nsilently passing.\n\nAll four token-holding suites in one process:\n\n before: 63 passed; 12 failed (11 x 401, plus the new guard)\n after: 74 passed; 1 failed\n\nThe survivor is a different defect and is reported separately:\n`tools_channels_raw_coverage_e2e.rs:58` `#[path]`-includes\n`tools_approval_channels_raw_coverage_e2e.rs` while build.rs also globs it in,\nso that file is compiled twice into one binary and the copies race on process\nglobals — `left: 0, right: 1` on a subscriber count, not an HTTP status. The\ninclude is upstream (#4721) and this diff is auth-only; it fails identically\nwith these four files reverted.\n\nTest-only. No production code changes.\n\nCloses #6112\n\nClaude-Session: https://claude.ai/code/session_01Rx5Fzc5keoeUQB3MwMFqMM\n
M3gA-Mind committed 2 months ago
f5ec43d
fix(test-support): reject `..` lexically, and compile+run the gate in CI\n\n`resolve_workspace_relative`'s doc comment promises to "reject any relative\npath containing a `..` component", but the guard only ever held when the\ntraversal target happened to exist. `Path::join` does not normalise `..` and\n`Path::starts_with` compares whole components, so `<root>/../../x` really does\nstart with `<root>`; the prefix check contributed nothing on its own, and the\n`canonicalize()` that did the work fails on a missing path — at which point\n`unwrap_or_else` restored the un-normalised candidate and the comparison\npassed. `../../nonexistent` came back as the caller's own "No such file or\ndirectory" instead of a refusal.\n\nWalk the components before the join and reject `ParentDir` outright, plus\n`RootDir`/`Prefix` which `trim_start_matches('/')` does not remove on Windows.\n`CurDir` still passes. The canonicalize + `starts_with` pair stays underneath:\na lexical walk cannot see a symlink pointing out of the workspace, and there\nis a test for exactly that.\n\nNo `cargo check` could have caught this — the broken guard compiled fine — and\nnothing in CI ran the family, because `e2e-test-support` is in neither\n`[features] default` nor `product-features.txt`. CLAUDE.md already has a rule\nfor that position; this gate was never added to it. So the feature-gate-smoke\nlane now checks it, in a separate invocation from `tui` so one gate cannot\ncompile only because the other pulled a dependency in.\n\nThe new test lane immediately found a pre-existing failure,\n`test_support::rpc::wipe_memory_tree_...` ("driver 'tinymemory' does not serve\nMaintenance", from `memory-engine-seams` being absent here). It fails with and\nwithout this change. The filter is scoped to `test_support::introspect::` and\nthat gap is named at the call site rather than papered over by widening the\nfeature list, which would hide the class of gap the lane exists to expose.\n\nCloses #6085\nCloses #6086\n\nClaude-Session: https://claude.ai/code/session_01Rx5Fzc5keoeUQB3MwMFqMM\n
M3gA-Mind committed 2 months ago
2009df7
fix(inference): answer the #6120 review threads
M3gA-Mind committed 2 months ago
f0bdf24
fix(todos): approvalMode is a two-variant enum, not a free string\n\n`TaskApprovalMode` is `#[serde(rename_all = "snake_case")]` over exactly\n`Required` / `NotRequired`, so declaring `approvalMode` as\n`Option(String)` advertised every string as valid and a catalog-conforming\n`"sometimes"` came back `invalid params`. It is `Option<TaskApprovalMode>`\nupstream, so the `Option` wrapper is real here and `null` is genuinely\naccepted — unlike the `#[serde(default)]` group beside it.\n\nThe test could not have caught this, and that is the more useful half of\nthe finding. `todos_replace_accepts_a_card_built_only_from_its_declared_schema`\nbuilds its card *from* `/schema`, and building from a schema populates only\nwhat the schema requires — so an over-wide *optional* field was invisible to\nit by construction. It now, for each optional field backed by a closed enum,\nasserts the catalog declares `Option(Enum{..})` rather than a free string,\nthen submits one card per declared variant and requires each to be accepted.\n\nThe first assertion is what bites: with the declaration reverted to\n`optional_string` the test fails on the missing `Enum`, naming the declared\ntype (`{"Option":"String"}`), before any variant is submitted. The second\ncatches the other direction — a variant declared here that the wire type\ncannot parse.\n\nAlso documents the `order` ceiling. `TaskBoardCard::order` is a `u32` while\n`TypeSchema` has no narrower unsigned type and no bounds, so `U64` is the\nclosest available declaration and a value above `u32::MAX` passes schema\nvalidation and is then refused by the handler's deserialization. That\nimprecision is shared by every `TypeSchema::U64` declaration in the catalog,\nso it is stated in prose here and tracked for the core as issue #6137\nrather than patched into this one field.\n\nClaude-Session: https://claude.ai/code/session_01MPrQdTFHdXTvyZfhaJ1oAq\n
M3gA-Mind committed 2 months ago
1ffeaa1
fix(todos): defaulted card fields are not nullable, and pin that\n\nReview found a defect I introduced in the first commit, of exactly the class\nthis PR exists to remove.\n\n`TaskBoardCard`'s `plan`, `allowedTools`, `acceptanceCriteria` and `evidence`\nare `Vec<String>`; `order` is `u32`; `updatedAt` is `String`. None is an\n`Option`, so `#[serde(default)]` covers an **absent** key while an explicit\n`null` fails with `invalid type: null`. Declaring all six as `Option(...)`\nadvertised `null` as valid — a catalog describing a call the handler rejects,\nwhich is the whole defect #6087 is about, reintroduced one field-list over.\n\nAll six now carry their real type with `required: false`, through a\n`defaulted_field` helper whose doc comment records why so the next edit does\nnot undo it. The neighbouring `objective`, `assignedAgent`, `notes`, `blocker`\nand `sessionThreadId` genuinely are `Option<String>` upstream and keep\n`Option(String)`; `sourceMetadata` genuinely is `Option<Value>` and keeps\n`Option(Json)`. The distinction is the point.\n\nAlso tightens the generated-card test, per review:\n\n * the required set is asserted **exactly** (`id`, `status`, `title`) rather\n than by membership, so a fourth field wrongly marked required cannot be\n papered over by the builder loop;\n * every advertised `status` variant is submitted as its own card rather than\n only the first, so a misspelling in a later variant cannot hide behind\n `todo`.\n\n**One test here is a contract test, not a guard, and that distinction cost a\nrevert-check to establish.** `todos_replace_defaulted_card_fields_may_be_omitted_but_not_null`\ndocuments that an explicit null is refused — but it does *not* guard the\ndeclaration, because `core::all::check_type` short-circuits on `Value::Null`\nfor every declared type. Null therefore reaches the handler and is rejected by\nserde whichever way the schema is written. Predicted that before running it and\nconfirmed it: with the six fields re-wrapped in `Option`, that test still\npassed.\n\nSo the declaration got its own direct assertion, against the `/schema` output\nrather than a dispatch. Fault injected — re-wrapped `defaulted_field` in\n`Option`:\n\n `plan` is `#[serde(default)]` on a non-Option field upstream, so an\n explicit null fails to deserialize. Declaring it `Option(...)` advertises\n null as valid and puts the catalog back to describing a call the handler\n rejects. Declared ty was: {"Option":{"Array":"String"}}\n\nat `tests/raw_coverage/todos_lifecycle_e2e.rs:840`, with the null contract test\npassing alongside it — which is the evidence that the guard is the schema\nassertion, not the dispatch. Restored: 6 passed, 0 failed.\n
M3gA-Mind committed 2 months ago
d1e5c4b
fix(todos): declare the real card shape on todos_replace's schema\n\n`todos.replace` declared exactly one input — `cards: TypeSchema::Json`,\ncommented "Array of card objects (id may be empty — server generates)" —\nand named no field of a card anywhere in the controller catalog. A caller\nreading the schema could not construct a card that the handler accepts.\n\n`handle_replace` deserializes each entry into `TaskBoardCard`, whose `id`,\n`title` and `status` carry no `#[serde(default)]`, so all three keys are\nmandatory. Two things the old declaration got actively wrong:\n\n * "id may be empty" is true of the *string* and false of the *key* —\n omitting it fails with ``missing field `id` ``;\n * the text field is `title`, while the sibling `todos.add` / `todos.edit`\n inputs in the same namespace call the identical field `content`, so a\n caller reaching for the namespace's own vocabulary got\n ``missing field `title` ``.\n\nSchema-side only, as the issue's fix shape specifies. The wire is\nuntouched: renaming `TaskBoardCard::title` would cross the vendored\n`tinyagents-graph` boundary and break the frontend's `title` reader at\n`app/src/types/turnState.ts:26`. `todos_replace` has no frontend caller,\nso this is inert at runtime by construction.\n\nThe declaration now spells the mandatory trio plus all fourteen optional\nfields, using the **wire** names — `TaskBoardCard` is\n`#[serde(rename_all = "camelCase")]` and `TaskCardStatus` is\n`#[serde(rename_all = "snake_case")]`, so it reads `assignedAgent` and\n`in_progress`, not `assigned_agent` / `inProgress`.\n\nThe regression test constructs its card *from the declared schema* rather\nthan hard-coding one: it reads `/schema`, populates every field marked\nrequired, and takes `status` from the declared enum's own variant list. It\ntherefore cannot pass by accident — if the schema names a field the handler\nwill not deserialize, or offers a status variant `TaskCardStatus` cannot\nparse, the dispatch fails.\n\nFault injected to prove it bites: reverted `cards` to `TypeSchema::Json`.\nThe suite failed with\n\n `cards` must declare an array of objects with named fields; an opaque\n type cannot be built from. Got ty = "Json"\n\nat `tests/raw_coverage/todos_lifecycle_e2e.rs:768`. Restored, 5/5 green.\n\nThe neighbouring `todos_replace_rejects_the_card_shape_its_own_schema_implies`\nkeeps its three refusals — they are the handler's behaviour and are\nunchanged — but its doc comment is refreshed, since the catalog no longer\n"names no field of a card anywhere".\n\nCloses #6087\n
M3gA-Mind committed 2 months ago
887922c