Repository navigation
Add the stdio MCP server (Briosa.Cli mcp) for SA 2026.1.0529.7 - #469
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds docs/operations/briosa-mcp.md, links it from the CLI page, and makes the two corrections slice A's final review asked for. Tool argument values now come from the SDK's parsed elements, which keep the request text as received, and the strict input rules are tested through briosa_query. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks
A known tool whose arguments object breaks its input schema now gets a tool result with isError true (usage_error, tool-arguments-invalid, and mcp.argument_error naming the schema's argument and the rule), as MCP 2025-11-25 asks for input validation errors, instead of JSON-RPC -32602. An unknown tool and a malformed tools/call envelope stay protocol errors. Such a call sends nothing and leaves the session unchanged. Only the first violation is reported, in a documented order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
davidalucas
added a commit
that referenced
this pull request
Nov 28, 2026
- FakeBriosaServer signalled MpCallReceived before it read the reply it would send, so a test that changed Reply when the call arrived could change the reply of the call already in flight. It now fixes the reply first. No test on main changes the reply after the arrival, and in both traced stalls of #467 the reply had already been produced, so this is not the cause of that hang. - SpillDirectoryTests.CreateJunction waited for `cmd /c mklink` with no bound and left both redirected streams unread. A child that did not exit, or filled a pipe, would have held the whole assembly. It now drains both streams, waits at most 30 seconds, and ends the child and fails the test with a message when it does not exit. Every local hang was named as the fault matrix, not a junction test. Refs #467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The single-submission guard granted a permit to every request the gRPC channel sent and kept it when the request ended without opening a stream: cancelled before its stream opened, cancelled between the grant and the send, or failed. A later request's resend could then use that permit, so two streams could carry one request. The handler now retires every unused permit when a request ends without a response. The class comment states the invariant: a permit belongs to one request and never outlives it. The CLI cannot reach the leak, because a CLI command ends after any failed RPC and owns its connection; the MCP session keeps its connection across tool calls and could. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- operation_id: its pattern, with ECMAScript semantics (a trailing newline does not match), and its 128-character length are checked before the session is touched, so an ID that cannot name an operation never attaches. - Integers are values, not spellings: 10, 10.0 and 1e1 are the same integer, 1.5 and 1e-1 are not; magnitudes far out of range are a range violation. - String lengths count Unicode code points, as JSON Schema does. - risk_flags: every element's type, then every element's name, then distinct items, so the rule reported does not depend on where in the list a problem is. McpSchemaConformanceTests derives its cases from the advertised input schemas, values of every JSON type and around every bound, and checks the validator against an independent evaluator of the keywords those schemas use. It kills the category-65 mutant and its siblings (attachment ID 17, query 201, operation ID 129, limit 26, range bounds). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… handshake From the review of 88b2b63: - A call that may have sent its MP request is never reported as unsent. The new attachment ID, the only fallible step that does not depend on the outcome, is prepared before anything is sent. The engine catches every failure after the hand-off to the transport and reports completion_evidence_unavailable (client-fault-after-send). The session's bookkeeping cannot replace an envelope the command returned; a failure there only makes an attached session invalid. A send signal tells the dispatcher's last-resort catch whether the request may have gone, and a result that cannot be built is a fixed-shape fallback that keeps request_sent. - The session commits to a connection, and takes the ID prepared for it, only when the server was verified in full (identity, target, compatibility, and listing) on a connection that is still open. A failed first attachment stays unattached; a failed reattachment stays invalid with the same ID, and the new connection is closed. - Once standard input ends or the process is told to stop, a write to standard output that has not finished one second later is abandoned, and so is every later one, so a host that stopped reading cannot keep the process alive. - The output guard passes a line only when it is one whole JSON-RPC 2.0 message: valid UTF-8, the members of a request, notification, result, or error and no others, no member twice. An error message that is not one of the server's fixed messages is replaced by a fixed text for its code and its data dropped, except the supported versions of -32022, so the SDK's -32601 no longer repeats the method name. - The incoming filter refuses an unreadable tools/call, a string that is not valid Unicode included, with -32602 instead of the SDK's -32603, and refuses requests other than initialize and ping before the handshake with -32600, except those with the 2026-07-28 per-request metadata. - Every wait the MCP tests added is bounded; the concurrency tests no longer swap replies or sleep. FakeBriosaServer.cs and SpillDirectoryTests.cs are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l effects
Maintainer decisions on the two held review items:
- With keep_result_local, a briosa_query result carries only reviewed
diagnostic codes, fixed text, and the CLI's own values. Every free-text
field that the server or SpatialAnalyzer supplied (the server's
identity claims, the operation's MP step, the text members of a policy
denial, a validation's field path, output rows' field names, and
server diagnostic codes that are not reviewed ones) goes into the
result file, which becomes {"result":...,"server_text":{...}}, and is
null, or server-diagnostic for a code, in both copies of the envelope.
A call that ends without a result file, or whose delivery fails, drops
the text with a fixed warning and never returns it. Without
keep_result_local nothing changes, and the CLI's envelope never
changes. Every withheld field is tested with a sentinel.
- readOnlyHint stays true on all five tools. The descriptions of
briosa_query and briosa_status state their one local effect, a private
result file kept until someone deletes it, and replacing the session's
connection on reattachment, and that SpatialAnalyzer and the Briosa
server are never changed.
The MCP guide documents both, and every change of the review round: the
cap's scope with the measured ratio, the fallback result, the argument
order, the full-verification attach rule, the fixed protocol error
messages, the handshake gate, the output guard, and output abandonment.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The engine's own catch and the dispatcher's last-resort catch produced the same outward result, so either could be removed without a test failing. The engine fault now also checks that the engine reported it, with the method and operation it knew, and a new fault point outside the session's guarded bookkeeping reaches the dispatcher, whose result must come from the send signal. Removing the engine's catch, the dispatcher's use of the signal, or the signal itself now each fails a test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
davidalucas
added a commit
that referenced
this pull request
Nov 28, 2026
…ake test-job hangs and load failures attributable (#470) * Make a hung test run fail with the test's name, in CI and in the CLI tests The 2026 test job on main ran for nine minutes with Briosa.Cli.Tests reporting nothing until the 15-minute job limit cancelled it, so the hung test was unknown. - ci.yml and release.yml: every dotnet test step now reports a test that runs for three minutes as hung (--blame-hang-timeout 3m) and ends its test host. The step fails well inside the job limit and the log names the test. In ci.yml the aborted assembly's sequence file is uploaded with the test results. No dump is taken (--blame-hang-dump-type none), and the upload excludes any *.dmp file in case one is ever written: a test host's memory is not shown to hold no secrets. Checked locally with VSTest 18.7.1: the project and solution form writes only the sequence file; the DLL form ignores "none" and writes a full dump, which is why the upload exclusion is there. - Briosa.Cli.Tests: CliRun bounds each CLI run at 60 seconds. The CLI sets no default deadline on an MP call, so a fake that never answered held the whole assembly forever; such a run now fails its test with a TimeoutException that says why. Checked with a fake that never answers: the run failed at 60.1 s and the server still stopped. The 15-minute job limit stays: the slowest green 2026 job today took 10:00, and a hang caught at three minutes ends the job by about 12.5 minutes. Refs #467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep two server test checks from failing when the test process is starved Two failures of the 2026 job came from the test process itself being starved for seconds on a loaded runner, not from what the tests check. - RequestValidationDetailGrpcTests (both targets) failed at Failures == 0: the provider's bounded log drain did not finish in its default 2 seconds. The test took 2.64 s against 0.30 s when it passed, so it waited out the whole bound. The drain runs on a thread-pool thread; with the pool saturated, a local experiment saw Dispose wait 8.1 s before the drain ran. The test now gives the drain the longest bound the option allows (10 s). A drain that still misses it is counted in Failures, so the test still fails on a dropped record, a failed sink, a value in any output, or a partial log. GeneratedClientPerformanceEvidenceTests had the same pattern and gets the same bound. - TypedFileUiAndControlOperationTests failed with "An existing connection was forcibly closed by the remote host" on its first call, after about 6 seconds, from its own loopback Kestrel host. Kestrel's default minimum request-body data rate (240 B/s after a 5-second grace) aborts the whole HTTP/2 connection when a request body arrives late, and the host's client runs in the same starved process. A request body sent 8 s late to a default host gave exactly that error chain after 6.1 s; one sent 3 s late succeeded. GrpcTestHost now has WithoutMinimumDataRates, applied to all seven in-process test hosts of Briosa.Server.Tests in both targets. Production hosting keeps Kestrel's defaults, and no call is retried. Refs #467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Grant each CLI response a stream window above the receive limit Product fault: a Briosa.Cli call could wait forever. The ASP.NET Core 10.0.15 runtime the server ships has an HTTP/2 defect (dotnet/aspnetcore#70124, fixed by dotnet/aspnetcore#70100, in no released runtime yet): when the tail of a response waits on the client's stream window and a window update races its final write, the next response on a reused stream of that connection is never sent. A call sends GetServerInfo, ListCapabilities with denied operations (about 190 KB, more than the 65,535-byte default window) and then the MP call on one connection, and an MP call has no default deadline. This is the Briosa.Cli.Tests hang of #467. The delivery fault matrix makes 664 such calls against the Kestrel fake. Locally it stalled 3 times in 97 runs of the assembly under load, each time in that test. A run with HTTP/2 tracing caught one: the fake received the MP call and completed it, the client sent all of it and waited, and no frame of the response arrived, while the listing before it had a stream window update in flight. The CLI now advertises an initial stream window of the 4 MiB receive limit plus 64 KiB, so no response it accepts ever waits on that window and the condition cannot arise. StreamWindowTests reads the window from the CLI's first SETTINGS frame. The operations guide says why. Refs #467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Fix two CLI test fixture races that a review of #469 found - FakeBriosaServer signalled MpCallReceived before it read the reply it would send, so a test that changed Reply when the call arrived could change the reply of the call already in flight. It now fixes the reply first. No test on main changes the reply after the arrival, and in both traced stalls of #467 the reply had already been produced, so this is not the cause of that hang. - SpillDirectoryTests.CreateJunction waited for `cmd /c mklink` with no bound and left both redirected streams unread. A child that did not exit, or filled a pipe, would have held the whole assembly. It now drains both streams, waits at most 30 seconds, and ends the child and fails the test with a message when it does not exit. Every local hang was named as the fault matrix, not a junction test. Refs #467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Cover every CI dotnet test with hang diagnostics and keep each run's sequence file Review of #470: three test invocations that CI reaches still ran without hang diagnostics, so a hang there would still run to the job limit unnamed. Both targets' Test-LocalSpatialAnalyzerHost.ps1 (before the solution tests), Test-RuntimePerformance.ps1 and Test-ObservabilityPerformance.ps1 now pass --blame-hang-timeout 3m and --blame-hang-dump-type none, and accept a results directory. Every dotnet test reached by ci.yml or release.yml is now covered: in ci.yml the source-host script, the solution tests, the Debug reflection and manual-startup tests and the two performance scripts; in release.yml the solution tests and the Debug tests. No other workflow and no other eng script runs dotnet test or VSTest. - ci.yml: each test invocation writes its own subdirectory of artifacts/test-results, and the upload moves after the last test step, so the Debug run's and the scripts' sequence files are kept too. - Verify-CiWorkflow.ps1 rejects a step of any workflow, or an eng script, that runs dotnet test without both settings. The new Test-CiWorkflowPolicyChecks.ps1, run in CI and required by the checker, proves the rejection on mutated copies. Against the previous head the checker names exactly the six scripts above. - The comments and eng/security-baseline.md describe the three minutes as VSTest's host inactivity timer: test starts and finishes reset it, and more than one test can be unfinished when it fires, so the names are candidates. The baseline also says what a sequence file holds. Every theory in both targets takes fixed test data, so display names carry no path, environment value, user or generated value. Refs #467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep a timed-out CLI test run and the junction helper from outliving their resources Review of #470: - CliRun: a run that missed its 60-second bound failed the test and disposed the run's output streams while the CLI kept going, so a late reply wrote to a disposed stream and a reserved --output file could outlive the test's directory. The CLI now sees the caller's token through a test-owned linked one. After a timeout that token is cancelled, the run gets 30 seconds to end, and the timeout is still the test's failure. The streams and the token source are disposed only when the run has ended, and its outcome is observed. Until a timeout nothing about the run changes. - CreateJunction: Process.Kill only starts the termination. After a timeout the helper now waits up to 10 seconds for the child to exit and for both pipe reads to end, and after a normal exit it observes both reads, within 10 seconds. Refs #467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Pin the shipped two-second log drain bound Review of #470: the privacy test now accepts a drain of up to 10 seconds and the blocked-sink test sets 50 ms, so nothing pinned the 2,000 ms default the server ships. ObservabilityTests (both targets) asserts it from the option's default, an empty configuration, the packaged appsettings.json, and a provider built from the defaults. Refs #467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Say which causes were reproduced locally and which are inferred for CI Review of #470: the shared test host's comment (both targets) and the stream window test's comment stated the hosted failures' causes as fact. The hosted runs recorded neither the body timing nor Kestrel's abort reason, and the CLI hang has no trace. They now say what the local experiments showed and that the hosted cause is inferred. The guide and BridgeContract now limit "never waits" to a unary response the CLI accepts, and say the MP call would wait until interrupted or the connection ends rather than forever. Refs #467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Describe the theory display-name review as a scan with flagged sources checked Refs #467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Check each dotnet test invocation on its own for hang diagnostics Re-check of #470: Verify-CiWorkflow.ps1 searched a whole workflow step or script for both settings, so a step whose run block held two dotnet test commands passed when only one of them carried the settings. The checker now splits a step's run value, with a literal block kept line by line and a folded block folded, and each eng script into dotnet test invocations: a command line, with backtick and backslash continuations joined, from "dotnet test" to the next unquoted ; && || or |, or a PowerShell argument array written as @("test", ...). Each invocation must carry both settings itself, and a finding names the invocation. A comment states what the check does not see: invocations built from variables or splatting elsewhere, settings appended to an array after it is written (reported as missing), other runners, and composite actions. The checker and its mutation test are skipped, since they hold "dotnet test" only as fixture text. Test-CiWorkflowPolicyChecks.ps1 adds rejections for two commands in one step with the settings on the first only, settings on another command in the same line, and a second argument array in a covered script. It also proves that a command continued over lines with its settings is accepted. Refs #467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Bound a timed-out CLI test run's cleanup with one deadline, and the junction waits Re-check of #470: - CliRun awaited the cancellation before it started its 30-second cleanup, so a cancellation callback blocked on a lock could hold the test until the outer hang detector. One deadline, started before the cancellation, now covers both the callbacks and the run's end, and both tasks are observed. The run starts on the thread pool, so the 60-second bound also covers synchronous work before the CLI's first await. A run that has not ended by the deadline, for example one stalled in a synchronous file flush, is reported as abandoned still running and possibly holding files it created, such as an --output or spill file; later timeouts in the assembly say how many such runs are still running. In process the run cannot be stopped; only a process boundary would guarantee it releases its files, and this harness does not build one. - CreateJunction now uses one 10-second deadline after it ends a child that did not exit, for the exit and both pipes, so it waits at most 40 seconds in all, and its failure says which of the two did not happen. Refs #467 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Maintainer decision: a call that was sent and then abandoned before its response was read to the end makes the session invalid, so that only the explicit reattachment (a new, verified connection) continues. The server's runtime can fail to answer the next call on a connection after an aborted response (dotnet/aspnetcore#70124). The connection decides it, so no call site can forget it. Every RPC on a BriosaConnection passes through an interceptor that, when the call fails, asks the submission guard whether the request's stream was opened and its response was not read to the end; the HTTP handler observes the end of each response, and records a request that failed after its stream opened; and an RST_STREAM frame the client writes marks the connection too. Only the MCP session reads the result, so the CLI is unchanged. The abandoned call's own outcome is reported as before; its result shows the session invalid with a fixed warning (session-invalidated) and a notice that names the reattachment. Later calls are refused with session-invalid, whose notice and guidance now say why. A first attachment whose server was verified before such a call is committed as invalid at once. A call cancelled while still queued sends nothing and leaves the session as it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings #470: the client stream window above the receive limit, bounded CLI test runs, and hang detection on every test invocation. The one conflict, the MP branch of FakeBriosaServer.HandleAsync, keeps main's order (the reply is fixed before the arrival is signalled) together with this branch's arrival semaphore and concurrency count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e limit Each path that abandons a request after it was sent now has a test that shows the call's own outcome, the session invalid afterwards, the next call refused with session-invalid and nothing sent, and a successful reattachment on a new connection: a host's cancellation of a query (on a first and on a later call), a response over the 4 MiB receive limit, a response that cannot be read, a stream the server resets, a discovery deadline, and a cancelled discovery call. A call cancelled while queued leaves the session attached. Unit tests cover the guard's three signals, the RST_STREAM frame among them. The fixed texts now speak of a request this call sent, so they read right for discovery tools too. The briosa_query description says that a call has no time limit and that cancelling a sent call leaves its outcome unknown and invalidates the session; briosa_status says when the session becomes invalid. The guide explains why, citing dotnet/aspnetcore#70124 as observed behaviour of the server's runtime, not a guarantee. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ies them Maintainer decision: with keep_result_local, a name is returned only when it resolves in that operation's own schema, from the CLI's compiled descriptors. - failure.request_validation.field_path, and a denial's request_option_field, stay when every dot-separated segment is, in order and exactly, a field of the operation's request message. - Output row names stay when they name a field of the result message, as the CLI already reads output rows. - A denial's caller_admission_profile and caller_denied_flag stay only when they equal what this call's restriction header sent; denied_flag when it is a fixed risk flag name; enum values always. - Everything else free-form stays withheld, and unreviewed codes still read server-diagnostic. Every text the server supplied, verified or not, is still written to the result file, so it stays complete. Tests cover a resolving name and ones that differ only by case, have an extra segment, or hold a character a field name cannot have, for each kind, and a result whose unverifiable output names reach only the file. This also corrects 66dbdd8's message, which said every withheld field had a sentinel: the caller profile and flag could not, because the CLI accepts a server denial only when they hold its own values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The interceptor's decision covers every failing call, so the HTTP handler's record of a request that failed after its stream opened, and its reading of a trailers-only response as complete, had no test of their own. Unit tests now check each layer directly: a failed request with and without an opened stream, a trailers-only response and a body read to the end (not abandoned), and a body left unread (abandoned). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The unit test for this check used an earlier request that had been read to its end, so it passed whether or not the guard compared request numbers. It now leaves the earlier request unread, so a call that fails before reaching the HTTP stack is shown not to be blamed for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ode gaps - A verified first attachment is never lost. Once a server was verified in full on the session's first connection, no later failure leaves the session unattached: an unusable connection, an abandoned request, a command that throws, or a fault in the session's own bookkeeping makes it invalid under the ID prepared for it. An attached session whose command throws becomes invalid too. Before, an abandoned MP call followed by a bookkeeping fault left the session unattached, and the next ordinary call attached again without a reattachment ID. - Before initialize, the handshake exception needs a per-request protocol version of 2026-07-28 or later. An older revision, null, or a value that is not a string is refused with -32600; the SDK served 2025-11-25 and null before. - With keep_result_local, the operation's grpc_service, rpc and fully_qualified_method stay only when they are exactly a compiled method's, on every path, refused calls included; transport.method only when it is a discovery method or a compiled one. A refused call with a case-changed RPC returned the server's spelling before. - The output guard rebuilds every error object from its checked parts: a fixed message stays only in an error with no member but code and message, each once, and data stays only for -32022, as its list of supported revisions when every entry is one this server supports. - An empty server diagnostic is recorded in the file and replaced in the envelope like any other unreviewed code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd guide - An abandoned discovery request no longer reports "Nothing was sent": its notice starts "No operation was submitted: the discovery request <GetServerInfo|ListCapabilities> was sent to the Briosa server and abandoned before its response was read in full." - The briosa_query description says that cancelling a call invalidates the session only before its response has been read in full, and, like the keep_result_local schema description, which server text returns: names verified against the operation's schema, caller values against what the session sent, and codes against the reviewed list. - The invalid_request notice and the describe description promise the first invalid field only when failure.request_validation is present. - The guide: the 4 MiB limit is the client's receive limit, not a server send limit; a successful call writes nothing to standard error, so a lost successful result shows only as the abandoned-output line; the order of the cancellation lines; the literal " escape; which members server_text records; the rebuilt error objects; the handshake exception; the never-lost first attachment; the package-root layout accepted in #445; and an unambiguous succeeded row (outcome known, do_not_retry false, calling again runs it again). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er fields - FakeReply.Stall (additive): a response that starts, sends its first bytes and then stalls. An MP response stalled after three bytes and then cancelled, and a listing stalled after three bytes until its 15-second deadline, each invalidate the session; the next call is refused with nothing sent, and the reattachment opens a new connection. - A read into an empty buffer is not the end of a response. - The output grace is pinned at one second, and an abandoned write is shown to end after its grace and not before. - The permit test asserts the intended exception, so a timeout or an assertion inside the scripted handler cannot pass as it. - A capability row's caller profile and flag reach the envelope without keep_result_local and are withheld with it, end to end; a wrong protocol_package is planted as a sentinel too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The session-returning fault point now sits inside the attached path's guard, so a command that throws after it returned exercises the branch that makes the session invalid, and the send-boundary test asserts it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks
The third review found texts that the evidence of their own call contradicted: a first attachment whose listing was sent and abandoned said nothing was sent, a validation notice named a field that keep_result_local had withheld, and standard error called a known success unrecorded after the session's bookkeeping failed. Notices are now chosen from what the connection recorded for the call, as evidence only: how many requests it wrote, and which failed call found it abandoned. "Nothing was sent" appears only when the call wrote no request; a call that wrote only its discovery requests says so; an abandoned discovery request is reported as sent and abandoned on every path, and "This session is now invalid" follows only when this call made it so. The invalid_request notice follows the returned field path (a name, empty, withheld, or no detail) and calls a rejected restriction header a defect in Briosa; with keep_result_local the guidance that names the field is replaced when the field path was withheld. The one fault reason is split into a command that failed inside Briosa and bookkeeping that failed after a command returned its result, each with its own standard error line, refusal notice and guidance. A first attachment committed as invalid reports only its reason, never "attached". The standard output abandonment line no longer says input ended when the process was told to stop. The status, query and describe descriptions state when the session becomes invalid, that the discovery requests have deadlines, and that the first invalid field is named only when the result returns it. No session transition, isError, do_not_retry, single-submission or withholding rule changes. McpNoticeTableTests lists every notice and standard error line with the evidence that selects it, a case that produces that evidence, and, for each factual clause, a neighbouring case where it would be false. McpThirdReviewTests covers the three findings and a clean disconnect after the first full response, asserting its reason. Refs #445 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every guide sentence about notices, standard error, cancellation, attachment and the handshake now matches the tested texts: what a notice says was sent and why, the invalid_request notice, the connection-replaced texts, the reasons an attachment becomes invalid (failures inside Briosa included) and that such an attachment never reports attached, cancellation of a discovery request before any server was verified, a reattachment whose connection is not usable, every standard error line, success writing no outcome line but possibly a session line, and which per-request versions get -32600 and which the SDK answers with -32022. Refs #445 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closed
4 tasks done
The connection counts a request when the guard lets its opening HEADERS frame through, before the write under it; the fourth review showed a write that failed before any byte went out, after which the notice said the discovery request "was sent". The count and the invalidation rule are unchanged; the texts that rest on them now say that Briosa began sending the request: - the abandoned-discovery notice, which adds that the request may or may not have reached the server; - the sentence that this call made the session invalid, the session-invalidated warning, the abandoned-request refusal, its guidance, and its standard error line; - the completion_evidence_unavailable notice, which keeps DO NOT RETRY and its outcome; - the briosa_status and briosa_query description sentences. The server_unreachable notice for a discovery request that failed without being abandoned now says it failed rather than that the server answered it, since it may never have had a stream of its own. "Only discovery requests were sent" stays: it is chosen only when no request was abandoned, so every request the call wrote was answered. The notice table gains the reviewer's case through the transport guard, with neighbours where nothing was written and where the request was answered, and the standard error table gains every usage line the parser can give for mcp (usage-missing-value, usage-duplicate-option, usage-unexpected-argument), checked against the parser's codes, with the exit code of each refused command line. No session transition, outcome, isError, do_not_retry, submission or withholding rule changes. Refs #445 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guide said a call that wrote only discovery requests gets the discovery-only notice, which a successful briosa_status, saying Succeeded., does not; it now names the three failure outcomes that use it. It also explains that a request counts from its opening frame, so a notice claims delivery only for an answered request, and words the abandoned-request texts, the cancellation bullet and the standard error list the same way. The retry introduction no longer says that a call that did run must not be repeated without checking first, which a plain success contradicts, and the standard error list names every command-line usage line with its exit code. Refs #445 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test asserts that the notice says Briosa began sending the listing; its name and the class comment still said the listing was sent. Refs #445 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
davidalucas
marked this pull request as ready for review
November 28, 2026 22:29
Contributor
Author
Read of the final diff (
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Slice B of four for #445 (Epic #440). It adds
Briosa.Cli.exe mcp: a local stdio Model Context Protocol server over the engine that slice A (#465) added, for SpatialAnalyzer2026.1.0529.7only. Desktop and IDE AI hosts can then inspect a live SpatialAnalyzer session through a local Briosa server, read-only and attach-only.Not in this slice: packaging, signing, license notices, CI workflow changes and conformance against the packaged ZIP (slice C); anything against a licensed SpatialAnalyzer (slice D); mutating execution, long-running handles and the replay interlock (#446); the 2024 target. The new dependency must not ship before slice C adds its reviewed license evidence.
The documentation is the new page
targets/2026.1.0529.7/docs/operations/briosa-mcp.md, linked frombriosa-cli.md. Everything below describes the behaviour at the head of this pull request; sections about earlier review rounds say what changed then, and are marked where a later round changed it again.What it adds
Briosa.Cli.exe mcp [--endpoint URL] [--max-inline-bytes N]. Standard output carries JSON-RPC only from the first byte; a command line it cannot use is reported on standard error only (exit 2, or 3 for a non-loopback endpoint), and stdout stays empty. It ends with exit 0 when stdin closes.Exactly five tools, all
readOnlyHint: true,destructiveHint: false,openWorldHint: false; the descriptions ofbriosa_queryandbriosa_statusstate their one local effect each:idempotentHintbriosa_statusstatusreattach_attachment_id(optional)briosa_list_categoriesops categoriesbriosa_search_operationsops searchops searchfilters;limitdefault 10, at most 25briosa_describe_operationops describeoperation_idbriosa_querycalloperation_id,request(object),keep_result_local(optional)Each tool calls the same engine function as the CLI command, so verification, strict input, the
briosa-caller-restriction: profile=read-only; deny=interactive_uiheader, the refusal for revisions 0 and 1 and the wrong target, single submission and outcome classification are the CLI's own code, not a copy.Results:
structuredContentis the CLI envelope withoutexit_code, plus one membermcp(tool,is_error,do_not_retry,notice,argument_error,session);contentis the fixed notice and the same JSON as text.Design choices
Annotations. None of the five changes SpatialAnalyzer, the job or the server, and each talks only to one loopback server, so all are read-only, not destructive and closed-world; the read-only hint describes the effect on SpatialAnalyzer. Two have one local effect, stated in their descriptions:
briosa_querycan write one new private result file, kept until someone deletes it (expiry is planned with #446), andbriosa_statuswithreattach_attachment_idcan replace the session's connection with a newly verified one. The spec definesidempotentHintas "no additional effect on its environment", so the four discovery tools are idempotent even though live state can change their answers;briosa_queryis not, because repeating it runs the MP again and can write another spill file.isError. Hosts and models retry tool calls that report errors, soisError: trueexactly when Briosa established that nothing ran (rejected_locally,usage_error,server_unreachable,server_incompatible,not_started,invalid_request,internal_error). Every outcome after which the operation may have run or did run isisError: false. For the six after which it may have run without a plain success,partial_success,outputs_incomplete,mp_failed,output_write_failed,started_outcome_unknownandcompletion_evidence_unavailable, the notice starts withDO NOT RETRY.andmcp.do_not_retryis true;succeededhasisError: false,do_not_retry: false, and no such sentence. Fortools/call, the protocol errors are only an unknown tool and a malformed envelope (no stringname,argumentsthat is not an object, or a string that is not valid Unicode): JSON-RPC-32602with fixed messages. No protocol error message ever repeats caller text: the output guard rebuilds every error object, and replaces any message that is not one of the server's own fixed messages, the SDK's included, by a fixed text for its code. Before the handshake, a request other thaninitializeandpingis refused with-32600when its per-request protocol version is missing,null, not a string, or one of the four revisions with a handshake;2026-07-28is served, and any other string (2026-07-27and2099-01-01included) the SDK itself answers with-32022before this server's checks run. Anything about the Briosa call is a tool result, including arguments that break the tool's input schema (see below) and arequestthat breaks the strict input rules.Arguments that break a tool's schema. As MCP 2025-11-25 asks for input validation errors (tools specification, "Error Handling"; changelog entry SEP-1303), a known tool whose
argumentsobject breaks its input schema gets a tool result withisError: true, so the host shows it to the model: outcomeusage_error(the MCP form of the CLI's usage error;invalid_requestwould claim the server validated the request),failure.diagnostic_codetool-arguments-invalid,execution.request_sent: falseforbriosa_query,mcp.do_not_retry: false, a fixed notice, andmcp.argument_errorwithargument(one of the schema's own argument names, or null) andrule(duplicate_argument,unknown_argument,required,type,enum,pattern,length,range,unique_items). It never repeats a value, and never an unknown argument's name. Only the first violation is reported, in this order: a repeated argument; an argument the schema does not define; a missing required argument, in schema order; then each argument present, in schema order, type first; then a string's length (in code points) and its enum or pattern, an integer's range (an integer is a value:10,10.0,1e1), and forrisk_flagsevery element's type, then every name, then distinct items. Such a call sends nothing and never reaches the session.Attachment. Lazy: nothing is sent until the first tool call, because hosts start MCP servers when they start, usually before the Briosa server runs. That call opens one connection. The session is attached only when the server was verified on it in full (identity, target, compatibility, and the capability listing) and the connection is still open. When no server was verified in full, the session stays
unattached, the connection is closed, and the next call tries again. Once one was, no later failure leaves the sessionunattached: if the connection then ends (also cleanly, after the last response was read in full), a request on it is abandoned, the command fails inside Briosa, or the session's bookkeeping fails, the first attachment is committed asinvalidunder the ID prepared for it, with that reason. After that the session uses its one connection and never opens another (the connection's existing connect-once guard), so a server that replaces the verified one on the same port receives nothing. An invalid session refuses every tool call withsession-invaliduntil an explicit reattachment.Keeping the one connection open. A throwaway experiment against Kestrel (keep-alive timeout set to 3 s) showed that an idle HTTP/2 connection is closed by the server (two TCP connections were needed after a 7 s pause) unless the client sends HTTP/2 PINGs (one connection). Kestrel's default keep-alive timeout is 130 s, so without PINGs every pause of a few minutes would invalidate the session. An attachment's connection therefore disables the client's idle timeout and sends a PING after 30 s without traffic, with a 20 s answer timeout. PINGs are not RPCs: no service, log or admission sees them. CLI commands keep the HTTP client's defaults, so CLI behaviour is unchanged.
Reattachment.
briosa_statuswithreattach_attachment_idset to the invalid attachment's ID (16 lowercase hex characters, random, shown inmcp.sessionand in the refusal's notice). An ordinary status read never reattaches, and requiring the ID means a model can only reattach by naming the attachment it was told is invalid, not by habit. A wrong ID or a reattach while attached or unattached is refused without sending anything. A reattachment verifies the new server in full before it replaces the old connection and takes the new ID (prepared before anything is sent); one that is not verified in full, or whose new connection is not usable afterwards, closes the new connection and keeps the session invalid with the same ID, and no ordinary call attaches in the meantime.Cancellation. A host's
notifications/cancelledstops waiting, as the CLI's firstCtrl+Cdoes, and as MCP asks no response is sent (the SDK suppresses it). A call still waiting its turn is dropped without anything sent, and the session is unchanged. A request that Briosa has begun sending, whose response has not been read in full, has its gRPC call cancelled and is never resent: for the MP request of abriosa_querythe outcome iscompletion_evidence_unavailable(client-cancelled), recorded on stderr; for a discovery request no operation was submitted. A cancellation that arrives after a response was read in full finds nothing to abandon: the call keeps that response's own outcome, which iscompletion_evidence_unavailablewhen the response carried no trustworthy completion evidence, and the session stays attached on the same connection (tested for a success). An abandoned request makes a session whose server was verified in fullinvaliduntil it is reattached; before that, a first attachment staysunattached. MP calls have no time limit; the discovery requests have 15-second deadlines. Letting a cancelled call finish and discarding the result would avoid the unknown outcome for a read but hold the session, and every call behind it, for as long as the read takes; every tool here only reads, so the unknown outcome cannot leave the job changed. Closing stdin cancels a call in flight the same way.Concurrency. The SDK runs tool calls concurrently; the session runs them one at a time, without promising which waiting call goes next. The single-submission guard counts streams per connection, so two requests in flight could let one request's resend use the other's permit; one at a time keeps each request to exactly one stream and keeps spill writes and session changes single-threaded. The server serializes MP work anyway.
Cap. 16 KiB of result JSON by default, a quarter of the CLI's 64 KiB, because many hosts pass both the structured and text copies to the model;
--max-inline-byteschanges it for the server (0 to 4 MiB), andkeep_result_localspills any one result. Larger results use the engine's existing delivery unchanged. The cap bounds the formatted result JSON only; the line that carries the tool result also holds the envelope, the notice and the text copy, which escapes the result again: a 15,583-byte result made a 38,188-byte line (about 2.45 times; measured by the first independent review at88b2b634), more for results heavy in escaped characters. Discovery sizes, measured by me ate4cba6d5over all 1,018 operations: describe 3.7 to 13.6 KB (median 5.4 KB); status 2.7 KB; categories 5.1 KB; a search page of 10 is 8 KB. A 50-row page with denied operations was 34 KB, so pages are capped at 25 (about 17 KB).Notices say only what the call's own evidence shows. Each notice is chosen from that call's outcome, from what the connection recorded for the call (how many requests it wrote, and which request, if any, was abandoned), from what its result returns, and from whether this call itself made the session invalid; never from the session's transition alone.
Nothing was sentappears only when the call wrote no request at all. Arejected_locally,server_unreachableorserver_incompatiblecall that wrote only discovery requests, each of them answered, saysNo operation was submitted, and only discovery requests were sent; a successful discovery tool, which also sends only those, saysSucceeded.A request counts from the moment its opening frame is let through to the transport, before its bytes are known to have gone out, so delivery is claimed only for a request that was answered: an abandoned request is reported as begun, and one that may or may not have reached the server, on every path. The full table, with a case for each text and a neighbouring case where each factual clause would be false, is under the third review.Untrusted content and egress. The instructions and every tool description say in fixed text that result content is data, not instructions, and that results leave the workstation with a cloud-hosted model. Notices, descriptions, instructions, error messages, stderr and file names never contain result, server or request text. The only variable parts of a notice are the session's own attachment ID, the name of a discovery RPC from the fixed pair
GetServerInfoandListCapabilities(taken from the client's own method name), and, for arguments that break a tool's schema, that schema's own argument names, choices and bounds. Withkeep_result_local, the result carries server or SpatialAnalyzer text only where the CLI can verify it against the operation's own schema or what the session sent.Standard output. Every outgoing line passes through a guard that writes only whole JSON-RPC 2.0 messages (valid UTF-8; request, notification, result or error members only, no member twice; every error object rebuilt from its checked parts) and drops (and reports on stderr) anything else, including part of a message that never finished. Once shutdown begins (input ends, the process is told to stop, or the server ends otherwise), a write the host has not finished reading one second later is abandoned.
Console.Outis redirected to nothing inmcpmode.Engine changes (CLI behaviour unchanged)
BriosaConnection: an options record (Command= today's settings;Attachment= PINGs and no idle close), aConnectionLostsignal from the connection stream,Unusable, andBeginCommand()to reset the receive-limit evidence between commands on a shared connection.BridgeEngine: an optional attachment connection; without one each command opens and closes its own, as before.BridgeEnvelope.Serialize, used byToUtf8and the MCP results.CommandParsergains themcpgrammar,CliHostanOpenStandardInputused only bymcp, and the usage text two lines (the pinned help count goes from 13 to 15).CliApplication.TryReadIntegerbecame internal. Comment-only:ResultDeliverynow says "before any result bytes are written".SubmissionHandlerretires unused permits;CallRequestgains aSendingsignal andKeepServerTextLocal(MCP only); the engine catches every failure after a send (MpOutcome.FaultAfterSend);BridgeEnvelopegains three unwritten flags;ServerTextwithholds server text;ResultDelivery.Delivertakes the withheld text;BridgeEnvironment.AfterSendis a test fault point.AbandonmentInterceptorobserves every RPC on a connection;SubmissionGuardandSubmissionHandlertrack whether each request's stream opened and its response was read to the end, and an RST_STREAM the client writes;BriosaConnection.CallAbandoned, part ofUnusable;ServerTextverifies names against the compiled request and result messages;EvidenceConsistencyexposes its output-name rule and restriction parsing.BriosaConnection.Verified;ServerTextalso verifies the operation's service, RPC and method andtransport.method, and records an empty code.SubmissionGuard.OpenedandAbandonedMethod, exposed asBriosaConnection.RequestsWrittenandAbandonedMethod; the interceptor names the failed call when the connection carries an abandoned request.MpOutcome.NamedFieldGuidancenames the existing guidance text, andServerText.Finishreplaces it withWithheldFieldGuidancewhenkeep_result_localwithheld the field path.The CLI never reads
Unusableor the new evidence, never sets the MCP-only options, and its envelopes and files are unchanged.Dependency
ModelContextProtocol.Core2.4.0 is added toDirectory.Packages.propsand the CLI project; the lock files are updated (offline restore from the local cache, emptyRestoreSources,NuGetAudit=false). With the CLI's framework reference toMicrosoft.AspNetCore.App, package pruning leaves two new packages in the shipped graph:ModelContextProtocol.Core2.4.0Apache-2.0modelcontextprotocol/csharp-sdkat4cbf42ef107763f0bc75c358af8cb2dfe47a769aMicrosoft.Extensions.AI.Abstractions10.11.0MITdotnet/extensionsat25f07afa51034e37b334210642d7dc5f191c142d(from the spike)Neither nupkg carries license or notice text; slice C adds the reviewed evidence (see the issue's spike comments). Shared files, measured at
bb80fa27(the same sizes as atadabd432;2acae253changes only a test name) with the package script's release properties (self-containedwin-x64publishes of the CLI and the server): the two share 335 files, all byte-identical by SHA-256. The CLI adds six files, 2,559,796 bytes:Briosa.Cli.exe(162,816),Briosa.Cli.dll(352,256),Briosa.Cli.deps.json(56,303),Briosa.Cli.runtimeconfig.json(525),ModelContextProtocol.Core.dll(1,308,672) andMicrosoft.Extensions.AI.Abstractions.dll(679,224). Only the DLL grows with the code: 2,549,556 bytes at8cf433d6(reproduced by the third review), 2,544,948 atb737405c(measured by the second review), and 2,492,224 ate4cba6d5. No package script or license evidence file changed.NuGet audit: it cannot be evaluated offline. The spike's audit against the advisory snapshot through 2026-11-27 reported no diagnostic for these exact versions; CI's audit on this pull request is the authority.
Tests
All portable, against the in-process fake server; no SpatialAnalyzer, license or real worker. The MCP server is driven through its stream transport over pipes, with hand-written JSON-RPC, and every line it writes is checked (UTF-8, no BOM, one JSON-RPC 2.0 object, a response has exactly one of
resultanderror). One test drives the builtBriosa.Cli.exeover real pipes.McpProtocolTests(initialize for five requested versions, ping, the five tools with schemas, annotations and description sentences pinned as literals, unknown tool, 7 malformedtools/callenvelopes, unreadable lines, the2026-07-28path, shutdown),McpStdioTests(the stdout guard, refused command lines, the cap option, the built executable),McpOutputGuardTests(32 malformed lines dropped, 8 passed byte for byte, 14 error messages rewritten).McpArgumentTests(62 schema violations, the reporting order, nothing sent or echoed, every session state unchanged) andMcpSchemaConformanceTests(2,394 cases from the advertised schemas against an independent evaluator).McpQueryOutcomeTests(the slice A matrix throughbriosa_query: envelope,isError, pinned notice, retry rule, MP request count, the restriction header once; strict input; spill, cap,keep_result_local, failed spill) andMcpDiscoveryAndContentTests(each discovery tool; hostile text only as JSON string values).McpSessionTests,McpAttachCommitTests,McpAbandonedCallTests(every abandonment path, stalled responses included),McpCancellationAndConcurrencyTests,McpSendBoundaryTests(faults after the send never reportrequest_sent: false; the fallback's shape; blocked stdout ends within the grace),SubmissionGuardTests.ServerTextTestsandMcpLocalServerTextTests(sentinels in every withheld field, both copies, with and withoutkeep_result_local).McpSecondReviewTests. Third review:McpThirdReviewTestsandMcpNoticeTableTests(below).Mutations. Every round's mutants were applied to the product, the tests that cover them run, and the file restored; the numbers are under how I verified it.
How I verified it
Everything ran locally with offline restore (an empty
RestoreSourcesfolder andNuGetAudit=false) and no SpatialAnalyzer, license or real worker; nothing was registered with any AI host. Heavy steps ran under the shared verification lock.At
2acae253(the fourth review's wording changes), under the lock: the full harness for the 2026 target passed every step: locked restore, the no-SpatialAnalyzer host check, Control Center smoke, interop inspector and artifacts,Verify-Protocolagainstorigin/main(d93c8945), the MP naming policy, the Release build with 0 warnings, CI-filtered tests (Protocol 56, Worker 415, LicensedProbes 445, Cli 3,260, Server 1,565), the debug reflection and manual-startup tests, the Windows package, protocol and conformance package scripts and the client scenarios, every root check, and both performance steps.Test-CrossTargetPropagation(the same single advisory finding),Test-CrossTargetProtocol,Verify-CiWorkflow.ps1andTest-CiWorkflowPolicyChecks.ps1passed. Every MCP, submission-guard and server-text test passed (2,899). The source diff sinceadabd432changes only string literals and comments. The unfiltered run was last made at8cf433d6; the publish comparison above is atbb80fa27.At
adabd432(the third review's changes): the same harness (Cli 3,252), cross-target checks and CI workflow policy scripts, all passed, and the mutations below.Mutations for the third review. 29 mutants, each applied, its tests run, and the file restored: all 29 killed. They take away each piece of evidence (the requests a call wrote, a call's own count on an attached connection, the abandoned method and when it is named, the attach path's evidence); each choice the notice makes from it (the discovery-only texts, the unreachable, connection-replaced, cancellation, refusal and incompatible variants, the abandoned-discovery notice on a path that does not invalidate); each validation variant and the withheld-field guidance; each fault reason with its line, notice and guidance; the
attachedline for an attachment committed as invalid; the internal-error text; the stdout line; the three description sentences; and the clean-loss mutant that survived the second review.Earlier rounds, each under the lock, every step passed:
e4cba6d5(slice B): the full harness for both targets, the shared-file comparison, and 33 mutants, all killed.d45685b2(merge ofmain): the unfiltered 2026 run with a hang detector, and the root and cross-target checks.88b2b634(schema-invalid arguments as tool results): the full 2026 harness, the unfiltered run, the cross-target checks, and 9 mutants, all killed.196304a8(review round 3): the full 2026 harness, the unfiltered run, the cross-target checks, and 60 mutants, all killed.b737405c(round 2, after merging Keep a CLI call from waiting forever on a lost HTTP/2 response, and make test-job hangs and load failures attributable #470): the full 2026 harness, the unfiltered run, the cross-target checks, both CI workflow policy scripts, and 24 mutants, all killed.8cf433d6(second review): the full 2026 harness (Cli 3,134), the unfiltered run (56 / 415 / 445 / 3,134 / 1,572), the cross-target checks, both CI workflow policy scripts, the publish comparison, and 21 mutants: 19 killed, and two reported then as surviving. The third review showed that the first of them, a first attachment whose clean connection loss is not committed, is not equivalent (the reason changes from the connection ending to a fault) and that the fake can produce it; this round kills it. The second, dropping the revision-shape check of the handshake exception, stays equivalent under the pinned SDK 2.4.0, which refuses every string it does not know with-32022before any filter runs.Expected cross-target finding:
./eng/Test-CrossTargetPropagation.ps1 -BaseRef origin/mainreports one advisory one-sided change,Directory.Packages.props(2026 only, because the 2024 target has no CLI).CI note: at
8cf433d6the non-required retained-client job for the 2024 target's .NET client 0.5.0 timed out in itslarge-resultscenario, and its gate failed with it; the same job passed atb737405c, and nothing it builds changed in between (tracked in #450).Review
Four independent review passes (GPT 6.2 Astra), each finding reproduced before anything changed:
88b2b634b737405cinitialize, unverified method names underkeep_result_local, unchecked error members in the output guard, an empty diagnostic, the abandoned-discovery notice, guide and description facts, three surviving mutants, stalled-response tests8cf433d6adabd432The fourth pass's changes are in
36aa5357(texts and tests),bb80fa27(guide) and2acae253(one test name that still said "sent"); no logic that decides anything changed. On 2026-11-28 the maintainer decided to merge after them without a fifth pass.Changed texts in the fourth review, old → new:
… the discovery request <rpc> was sent to the Briosa server and abandoned before its response was read in full.→No operation was submitted: Briosa began sending the discovery request <rpc>, which may or may not have reached the Briosa server, and abandoned it before a complete response was read.This session is now invalid: a request this call sent was abandoned before its response was read in full, …→… a request this call began sending was abandoned before a complete response was read, …… a request on its verified connection was abandoned after it was sent, before its response was read in full, …→… a request that Briosa began sending on its verified connection was abandoned before a complete response was read, …completion_evidence_unavailable:DO NOT RETRY. The request was sent, and no trustworthy evidence …→DO NOT RETRY. Briosa began sending the request, and no trustworthy evidence …(the outcome anddo_not_retry: trueare unchanged).server_unreachablefor a discovery request that was not abandoned:… the Briosa server answered the discovery request <rpc> with a failure; …→… the discovery request <rpc> failed; …session-invalidated:A request this call sent was abandoned before its response was read in full, …→A request this call began sending was abandoned before a complete response was read, …… was abandoned after it was sent, before its response was read in full: it was cancelled, timed out, or its response could not be read.→A request that Briosa began sending on this session's verified connection was abandoned before a complete response was read: it was cancelled, it timed out, or what came back could not be read.session invalid: a call was abandoned after it was sent→session invalid: a request was abandoned after Briosa began sending itbriosa_statusdescription:… when a call on it is abandoned after it was sent, …→… when a request on it is abandoned after Briosa began sending it, …briosa_querydescription:once sent, it waits …,after the MP request was sent, before its response has been read in full, andany request that is sent and then abandoned before its response has been read in full→once Briosa begins sending it, the call waits …,after Briosa began sending the MP request, before a complete response has been read, andany request that Briosa begins sending and then abandons before a complete response has been read.usage_error (usage-missing-value),usage_error (usage-duplicate-option)andusage_error (usage-unexpected-argument)added; the code already wrote them.Left as they are, for the maintainer's eye: the CLI's own
completion-evidence-unavailablewarning,The request was sent, and no trustworthy evidence of how it ended came back. The operation may have run., which the MCP result carries inwarnings, has the same imprecision; it is slice A's text, and changing it would change the CLI's envelope.No operation was submitted, and only discovery requests were sentstays, because it is chosen only when no request was abandoned, so every request the call wrote was answered.Third independent review (Astra, of
8cf433d6)It found the second round's items 1 to 5 resolved, the publish numbers reproduced and the
succeededrow right, and asked that no notice, stderr line, guide or description sentence state something the evidence of that call contradicts. Each finding was reproduced first: the 34 new and changed cases that compile against the code at8cf433d6(the table needs the new evidence) were run there, and 22 failed; all pass now. No safety logic changed: no session transition,isError,do_not_retry, single-submission or withholding rule.8cf433d6Nothing was sent: the Briosa server could not be reachedAnAbandonedFirstListingSaysItWasBegunAndLeavesTheSessionUnattached(the 15-second deadline,keep_result_local); table rows for a first attachment, a reattachment and an attached sessionfield_path: nulland the old sentencefield_path: a name, empty, withheld, or no detail; a rejected restriction header is called a defect in Briosa. The envelope guidance that names the field is replaced, underkeep_result_local, when the field path was withheldAValidationNoticeNamesTheFieldOnlyWhenTheResultReturnsIt(8 cases),ARejectedRestrictionHeaderIsCalledADefectInBriosasucceeded, thensession invalid: the outcome of a call could not be recordedFault, served both a command that threw and bookkeeping that failed after a returned resulta call failed inside Briosa;the session could not be updated after a call returned its result). A first attachment committed as invalid writes only its reason, neverattached. The guide says a success writes no outcome line, and that session lines such asattachedcan appearASessionFaultAfterAKnownOutcomeSaysWhatFailed(4 cases),ACommandThatFailsInsideBriosaIsReportedAsSuchexecution.dispositionandtransport.status; the notice variables (the discovery RPC); the escape example; history now marked as suchMcpNoticeTableTests: the table below, with a case for each text and the clause pairsMcpNoticeTableTests: 43 notice rows and 16 standard error rows, each checked against its case; 33 notice clause pairs and 9 standard error pairs (44, 19, 36 and 9 after the fourth review)Nothing was sentafter the discovery requests (local refusals, incompatible servers, the connection-replaced path, internal errors); "a call has no time limit" although the discovery requests have deadlines; the describe sentence about the first invalid field; the status sentence on when the session becomes invalid (failures inside Briosa); the stdout line, which said "after input ended" also when the process was told to stop;attachedwritten for a first attachment committed as invalid; "sends nothing to any server" on the connection-replaced path; the handshake summary; "a reattachment replaces the connection" (it can); "never connects anything" in the status descriptionMcpProtocolTestsAConnectionThatEndsCleanlyAfterTheFirstFullResponseIsReportedAsEnded, the table'sinvalid-endedandrefused-session-endedrowsThe notice table
Every notice before the data statement that ends it;
<id>is the attachment ID. Case says how its test produces the evidence: end to end (MCP server and fake Briosa server), through the session (only a cancellation produces it, and a host's cancellation suppresses the response on the wire), through the transport guard (a write that fails under a counted frame), or constructed (a race, or a state the engine never reaches).Nothing was sent: the arguments do not fit the input schema of <tool>. <rule's fixed detail> Correct the arguments and call the tool again.Completed: the operation returned MP code 2, and every output was retrieved.succeeded,briosa_querySucceeded.succeeded, a discovery toolDO NOT RETRY. The operation completed with MP code 4 (partial success) …partial_successDO NOT RETRY. The operation completed, but at least one output, or its whole result, was not delivered …outputs_incompleteDO NOT RETRY. The operation ran in SpatialAnalyzer and did not succeed (a completed MP failure) …mp_failedDO NOT RETRY. The operation completed, but its result could not be delivered …output_write_failedDO NOT RETRY. The server reports that the operation may have started and that its outcome is unknown …started_outcome_unknownDO NOT RETRY. Briosa began sending the request, and no trustworthy evidence of how it ended came back: the operation may have run …completion_evidence_unavailable: the MP request was handed to the transport (read in full without trustworthy evidence, orclient-fault-after-send)This session is now invalid: a request this call began sending was abandoned before a complete response was read, … reattach_attachment_id "<id>" before the next call.Nothing ran: the server did not start the operation …not_startedNothing ran: the server rejected the request before running it. failure.request_validation names the first invalid field the server found and the constraint it broke; …invalid_request; the returnedfield_pathholds a name… failure.request_validation gives the constraint the request broke, but the server named no field; …field_pathis empty… gives the constraint the request broke; the field path the server gave could not be verified against the operation's schema, so it was withheld. …keep_result_localwithheldfield_pathNothing ran: the server rejected the request before running it, without naming a field; see failure.diagnostic_code, …Nothing ran: the server rejected the restriction header that Briosa sent, which is a defect in Briosa, not in the request; do not call it again unchanged.caller-restriction-invalidNothing was sent: this session is invalid because its verified connection to the Briosa server ended. Briosa sends nothing more until you reattach: call briosa_status with reattach_attachment_id "<id>".… because a request that Briosa began sending on its verified connection was abandoned before a complete response was read, …… because an earlier call on it failed inside Briosa.… because Briosa could not update it after an earlier call returned its result.Nothing was sent: reattach_attachment_id is accepted only while the session is invalid.Nothing was sent: reattach_attachment_id does not name this session's invalid attachment, which is "<id>".Nothing was sent: the call was cancelled before Briosa sent it.No operation was submitted, and only discovery requests were sent: the call was cancelled before it finished.Nothing was sent: Briosa refused the call before sending it; see failure.diagnostic_code and failure.input.rejected_locally; no request written (the request is too large)No operation was submitted, and only discovery requests were sent: Briosa refused the call; see failure.diagnostic_code and failure.input.rejected_locallyafter the discovery requests (a tiercalldoes not serve, strict input)Nothing was sent: the Briosa server could not be reached. Briosa never starts a server; …server_unreachable; no request writtenNo operation was submitted, and only discovery requests were sent: the discovery request <rpc> failed; see failure.diagnostic_code.server_unreachable; the failing discovery request was not abandoned (answered in full, or without a stream of its own)Nothing was sent: this session's verified connection to the Briosa server had ended, and Briosa does not open another.server-connection-replaced; no request writtenNo operation was submitted, and only discovery requests were sent: the connection to the Briosa server ended during the call, and Briosa does not open another.server-connection-replacedafter a discovery request was answeredNo operation was submitted: Briosa began sending the discovery request <rpc>, which may or may not have reached the Briosa server, and abandoned it before a complete response was read.unattached(cancelled, and its 15-second deadline); a reattachment, which staysinvalidwith the same ID; a listing over the client's receive limit (server_incompatible); and the fourth review's case, a write that failed before any byte of the counted request went outThis session is now invalid: …No operation was submitted, and only discovery requests were sent: the Briosa server is not one this tool can use; see failure.diagnostic_code and server.verification_problems.server_incompatibleafter an answerNothing was sent: the Briosa server is not one this tool can use; …server_incompatiblewith no request writtenNo operation was submitted: the Briosa MCP server failed unexpectedly; see failure.diagnostic_code.internal_error: the MP request was not handed over, and what else was written is not knownNothing was sent: the arguments do not fit the input schema of <tool>.usage_errorwithout an argument violationusage_errorcomes only with oneDO NOT RETRY. Briosa could not report this call's result in full. If the call sent an operation, it may have run; …output_write_failed)Nothing ran, but Briosa could not report this call's result in full; see outcome and failure.diagnostic_code.Clauses and their neighbours. For each factual clause, a case where it holds and a neighbouring case where it would be false and a different text is chosen:
Nothing was sentholds for a refusal before any request (a request too large, an invalid session, either reattachment refusal, arguments that break the schema,usage_error), a call cancelled before anything was written, an unreachable server, and the connection-replaced and incompatible texts with nothing written; it is not chosen for a refusal or cancellation after the discovery requests, an abandoned discovery request (first attachment and reattachment), a server that answered with a failure, the connection ending after a written request, an incompatible server that answered, a success, a call that abandoned its MP request, or an internal error.only discovery requests were sentholds after them and not before any request.could not be reachedholds with nothing written, and not for a server that answered with a failure, a listing that timed out, or the connection-replaced path.Briosa began sending the discovery requestholds for an abandoned listing (stalled, or over the receive limit) and for the failed write, and not for a discovery request that failed without being abandoned, an incompatible server that answered, or a call that wrote nothing;may or may not have reached the Briosa serverholds for the failed write and not for an answered request; andonly discovery requests were sentis not chosen for the failed write.This session is now invalidholds when this call made the session invalid, and not for evidence unavailable without an abandoned request, a reattachment's abandoned listing, or a first attachment's.names the first invalid fieldholds with a returned name, and not when the path is withheld, empty, or there is no detail;withheldthe other way round;a defect in Briosafor the restriction header and not without detail.Nothing ranholds fornot_started,invalid_requestand the nothing-ran fallback, and not formp_failed, evidence unavailable or the do-not-retry fallback.every output was retrieved: success, notoutputs_incomplete.Briosa began sending the request: evidence unavailable, not an internal error. Each of the three refusal reasons is not chosen for another reason.The standard error table
Every line after
briosa-cli mcp:.attachedreattachedsession invalid: the verified connection endedsession invalid: a request was abandoned after Briosa began sending itattachedsession invalid: a call failed inside Briosaattached)session invalid: the session could not be updated after a call returned its resultattached<tool>: <outcome>, with(<code>)when printable<tool>: result-report-faileddropped an incomplete outgoing messagedropped an outgoing message that was not well-formed JSON-RPCabandoned writing to standard output: a write was not finished within one second after the server began to shut downusage_error (usage-unknown-option),usage_error (usage-missing-value),usage_error (usage-duplicate-option),usage_error (usage-unexpected-argument),usage_error (usage-invalid-value)(exit 2),rejected_locally (endpoint-not-loopback)(exit 3)mcp, checked against itinternal_error (mcp-server-failed)Neighbours:
attachedis not written when a first attachment is committed as invalid (bookkeeping, a failed command or an abandoned request); eachsession invalid:reason is not written for the other reasons; a successful call writes no outcome line.New or changed public names and texts in the third review
The notices in the table above, as they stood at
adabd432(the fourth review changed the abandoned-request andcompletion_evidence_unavailablewording, see review); the two guidances and two standard error lines for a failure inside Briosa and a failed bookkeeping, replacing the single fault text; the withheld-field guidance underkeep_result_local; the stdout abandonment line;attachedno longer written for an attachment committed as invalid; thebriosa_status,briosa_queryandbriosa_describe_operationdescription sentences on invalidation, deadlines and the first invalid field; and, all internal,InvalidReason.CommandFailedandBookkeepingFailed(replacingFault),SessionOutcome.RequestsWrittenandAbandonedRequest,SubmissionGuard.Opened,AbandonedMethodandNameAbandoned,BriosaConnection.RequestsWrittenandAbandonedMethod,MpOutcome.NamedFieldGuidance,ServerText.WithheldFieldGuidance,AttachmentSession.Line, andMcpResults.Notice(McpTool, SessionOutcome, ArgumentViolation?).Still open: the handshake's revision-shape mutant stays equivalent under the pinned SDK. Five table rows use constructed evidence because no test can make it happen on demand (two races of the connection-replaced path, a cancellation between the listing and the MP request, and two states the engine never reaches), as the table says. The stall tests show the client's side only. Left alone as slice A's CLI texts:
briosa-cli.mdsays arejected_locallycall sent nothing, althoughcallrefuses some only after its discovery requests, and the CLI's validation guidance points at the named field also when the server sent an empty path; the MCP notice for that case is exact.Second independent review (Astra, of
b737405c)Its ten findings are summarized under review; each was reproduced first (33 failing cases at
b737405c).Every string member of a
briosa_queryenvelope withkeep_result_local, on every path, refusals included (corrected in the third review:execution.dispositionandtransport.statusare not plain server values):command,outcome,failure.source,execution.disposition_source,execution.completion_evidence,data.result_delivery,data.result_file.reason,.verification,data.result_delivery_error,server.verification_problems[],warnings[],guidance[],mcp.tool,mcp.session.state,mcp.argument_error.ruleexecution.dispositionEXECUTION_DISPOSITION_NOT_STARTED, sourcecli) and for a gRPC OK with a consistent result (EXECUTION_DISPOSITION_COMPLETED, sourcegrpc_ok); the server's typed error otherwise (sourceoperation_error)transport.statusUNKNOWNfailure.kind,failure.policy_denial.rule,failure.request_validation.constraint,execution.recovery_guidance,replay_guidance,replay_safety,mp_execution.state,output_retrievals[].state,data.operation.effect,execution_scope,replay_safety,duration_class,validation_status,admission,risk_flags[]endpoint,mcp.session.endpoint--endpointmcp.session.attachment_id,reattached_frommcp.notice,mcp.argument_error.argumentexecution.caller_restriction,server.expected_spatial_analyzer_targetfailure.diagnostic_code(sourcecliortransport)failure.diagnostic_code(sourceserver),output_retrievals[].diagnostic_codeserver-diagnosticfailure.input.field_path,suggested_field_nameserver.briosa_version,source_revision,protocol_package,spatial_analyzer_target,interop_fingerprint,data.operation.mp_step,policy_denial.admission_profilefailure.request_validation.field_path,policy_denial.request_option_fieldoutput_retrievals[].field_namepolicy_denial.caller_admission_profile,caller_denied_flagpolicy_denial.denied_flagdata.operation.grpc_service,rpc,fully_qualified_methodtransport.methoddata.operation.operation_id,categorydata.operation.tier,data.result_message,data.result_summary.fields[].name,.typedata.result_file.path,other_files[].path,sha256data.resultMaintainer decisions, round 2
invalid; only the explicit reattachment continues. It is decided on the connection: every RPC passes throughAbandonmentInterceptor, which asks the submission guard whether that request's stream was opened and its response not read to the end; an RST_STREAM the client writes marks the connection too. Conservative by design: a response that arrived in full but failed to deserialize counts as abandoned, and so does a stream the server reset. Tested for a host's cancellation of a sent query, a response over the 4 MiB receive limit, an unreadable response, a server reset, a discovery deadline and a cancelled discovery call; since the second review also for responses that start and then stall.keep_result_local, names are returned only when the schema verifies them (field paths and denial option fields that resolve in the request message, output row names in the result message, caller values equal to what this call sent, fixed risk flag names, enum values); everything free-form is withheld and written to the result file underserver_text. Correction of66dbdd89: in an MP call's denial trailer the caller fields cannot carry a sentinel, because the CLI accepts such a denial only with its own values; a capability row's denial is not checked that way, andACapabilityRowsCallerFieldsAreReturnedOnlyWhenTheyAreWhatTheSessionSentplants both there end to end.The texts round 2 introduced (the
session-invalidatedwarning and notice ending, the abandoned-request refusal and guidance,server-text-kept-localandserver-text-withheld) are unchanged. Three were replaced later: the fault refusal, guidance and stderr line (split into two reasons in the third review), thebriosa_statussentence on when the session becomes invalid, and thebriosa_querysentence on time limits (both corrected in the third review).Held items, now decided
Read-only hints (review item 7). Kept
readOnlyHint: trueon all five. The descriptions ofbriosa_queryandbriosa_statusstate their one local effect plainly and that SpatialAnalyzer and the Briosa server are never changed. The guide says the hint describes the effect on SpatialAnalyzer, and that result files accumulate, with expiry planned with #446.Server free text with
keep_result_local(6b). Every free-text field the server or SpatialAnalyzer supplied goes into the result file, which becomes{"result":…,"server_text":{…}}keyed by envelope path; a call that ends without a result file drops it with the fixed warningserver-text-withheld, and never falls back to returning it. Withoutkeep_result_localnothing changes, and the CLI's envelope never changes.The HTTP/2 abort path from #470 (decided in round 2)
The upstream defect's second trigger is the client aborting a stream while Kestrel is writing that stream's response, after which the server can leave the next response on that connection unsent. On an attached session that path is reachable, by my reading, through a host's cancellation, the client's 4 MiB receive limit, a discovery deadline and an unreadable response; round 2's rule covers each at the submission guard, and #470's larger stream window closes the window path. Waits without a bound on an attached session: the MP call itself (by decision; PINGs detect a dead connection, not a lost response), a call waiting its turn behind it (cancellable), a stdout write nobody reads while input is open, and local file I/O. Bounded: discovery RPCs (15 s each), connecting (5 s), shutdown (one second after it begins).
Maintainer decisions
Decisions 1 to 5, 7 and 8 proposed in the first version of this description were accepted as recommended:
isErroronly when nothing ran; reattachment by attachment ID; cancellation cancels the gRPC call; the 16 KiB per-server cap with search pages of 10 and at most 25; the envelope plusmcp; PINGs at 30 s with a 20 s timeout; and the CLI's own envelope texts. Decision 6 was changed: arguments that break a tool's schema are tool results. After review round 3, the two held items were decided as described above. In round 2 the maintainer decided that an abandoned call invalidates the session, thatkeep_result_localreturns names only when the schema verifies them, and that MP calls get no default time limit. After the second review, the approved mapping forsucceededstands:isError: false,do_not_retry: false.Checked as asked: no envelope text returned through MCP tells the reader to run a command-line action. The only
--outputtexts are given only when--outputis used, which MCP never does; "Do not run the call again" is a prohibition; "use the Control Center" is an operator action.Noticed, left alone
loggingcapability; this server sends nothing through it.-32601with a message that repeats the unknown method name, and some unreadabletools/callshapes with-32603; both are handled (review round 3).initialize, which the incoming filter refuses; the SDK has no option for that.2026-07-28per-request metadata, the SDK requires it on every later request of that process.u, and0022), so the text copy of a result is about half again as large on the wire as the structured copy (the model sees the decoded text).Correct the field named in failure.request_validation …, is also given when the server sends an empty field path. That is CLI behaviour from slice A, unchanged here; the MCP notice says that the server named no field.Refs #445
🤖 Generated with Claude Code