Repository navigation
fix(cloud): refuse the silent dev-session to chat-stream downgrade (ROUTING_DRIFT, exit 3) - #105
Merged
Merged
Conversation
CloudBrain treats a 403/404 on POST /agent/dev/sessions as "legacy server" and reroutes the run onto the one-way /agent/chat/stream. That path runs its tools SERVER-side against the cloud vault, so a coding session asked to work in this checkout quietly became a chat about it: normal header, plausible model reply, exit 0, and no line anywhere saying the transport had changed. Reproduced live against api.aethersystems.net, where AETHER_AGENT_DEV_ENABLED is unset and every `aether agent` run degrades this way. - new host-side BrainEvent `routing_drift` (additive; never on the wire, so PROTOCOL_VERSION is unchanged) carrying status, the sanitized server detail, the consequence in plain words, and a remediation line - rendered as a literal ROUTING_DRIFT banner on both presentation paths (HostRenderer and the animated status renderer), emitted BEFORE any model output; --json carries it structurally as kind:"routing_drift" - runs that need local authority (`aether agent`, or an explicit --model) now FAIL CLOSED: no chat-stream request is issued and the process exits 3, a newly documented code in COMMANDS.md. Unpinned chat-shaped runs still degrade, but no longer silently. - --local (Ollama) and auth paths untouched Co-Authored-By: Claude Fable 5 <[email protected]>
The ROUTING_DRIFT banner already prints the remediation on a fatal drift, on both the plain and the animated presentation paths, so cmdCode's own copy was a second identical sentence in the canary transcript. Co-Authored-By: Claude Fable 5 <[email protected]>
AetherAI3
force-pushed
the
fix/cloud-brain-silent-degrade
branch
from
August 23, 2026 01:44
1e6c0f5 to
52c07f6
Compare
AetherAI3
added a commit
that referenced
this pull request
Aug 23, 2026
AetherAI3
added a commit
that referenced
this pull request
Aug 23, 2026
AetherAI3
added a commit
that referenced
this pull request
Aug 23, 2026
Regenerates the packet against a845479 (origin/main after #105): base SHA, evidence commit, tarball digest, packed entry count, the recorded release-candidate run, and the coverage breakdown. Two corrections rather than refreshes: - Section 5 no longer lists the full test suite as unproven. It was run at the evidence commit (1464 tests, 1460 pass, 0 fail, 4 skipped); what is genuinely unproven is the suite INSIDE the candidate run, which reports npm-test as not-run by design. - Two new unproven entries name the deployed API. The notes' Authentication claims are about a server this repository cannot test, and #105 exists precisely because `aether agent` does not work end to end against production today. Both are marked rather than implied.
AetherAI3
added a commit
that referenced
this pull request
Aug 23, 2026
…notes claim (#96) * release: cut v0.3.0, and make the package prove it contains what the notes claim On 2026-08-20 this repository described five different releases at once. package.json said 0.2.0. package-lock.json still said 0.1.0 — the #81 bump never touched it. RELEASE_NOTES.md's top entry described a 0.2.0 whose feature list was written at 477f0fc, before #72 added `aether skills`, `aether capabilities` and `aether support-bundle`. The npm registry served 0.1.0 and nothing else. And a packed aether-agents-0.2.0.tgz sat in the repo root from #83 until #90 deleted it, containing a build with no skills runtime in it at all. Nothing was lying on purpose. The four statements drifted apart because nothing compared them. 0.2.0 -> 0.3.0, not 0.2.1 ------------------------- #72 is a backwards-compatible feature addition — a skills runtime, three new CLI commands, six built-in skills shipped inside the package — that the v0.2.0 notes never mentioned. Semver makes that a minor bump. Reusing 0.2.0 was rejected on identity grounds. 0.2.0 already names a specific dated artifact: the August 19 notes entry, the README availability paragraph, install.sh's pin example, and that committed tarball. Publishing different contents under the same version would make two materially different artifacts answer to one name, which is the defect this release exists to close. 0.2.0 is retired unused; it will never be published. Reconciled ---------- - package.json, package-lock.json (both version fields) and src/version.ts all say 0.3.0. - RELEASE_NOTES.md leads with v0.3.0 covering 477f0fc..ed094dc: one feature, nine user-visible fixes, three test-only commits, one unwired module (#86 ship rail, which no command invokes), one docs commit. The v0.2.0 entry is marked superseded rather than rewritten — it is the record of what was written that day, not an install instruction. - README and the release log name 0.3.0, and both still say plainly that `npm i -g aether-agents` gives you 0.1.0, because it does. New gate: test/release_coherence.test.ts ---------------------------------------- Gate A asserts every place that names the release names the same one — including both package-lock version fields, which is the drift nothing was watching. Gate B is the load-bearing one: for every feature the release notes claim, the code behind it must be present in the file list `npm pack` would actually ship, and the command exposing it must be in the CLI registry. The source checkout's dist/ is NOT the package — the allowlist is dist/src plus four docs. Mutation-checked. Adding "!dist/src/commands/skills.js" to the files allowlist silently drops `aether skills` from the tarball: verify:production -> {"ok":true, ... "packedFiles":523} MISSED IT release_coherence -> FAIL: dist/src/commands/skills.js (agent skills runtime — `aether skills`) Restored: 7/7 pass, 524 packed files. New: npm run release:candidate ------------------------------ release.yml only runs after a founder has already tagged and published, so everything it checks is checked too late to change the decision. This runs the same sequence, in the same order, before the tag exists — against a detached git worktree of a specific commit, never the dirty checkout. A dirty tree is refused unless --allow-dirty, which marks the report commitBound:false rather than pretending. Every CLI proof runs the binary npm installed from the packed tarball into a clean prefix: --version, --help, `skills list`, `capabilities`, and the handoff demo (the demo harness is not shipped, so it is placed beside the installed package and resolves the CLI and its imports from the tarball's own dist/src). Skipped steps are recorded as "not-run" with a reason and can never read as a green tick — the full npm test suite is release.yml's gate and says so in the report. No string is handed to a shell: npm is reached through its own JS entrypoint under node, so every argument stays an argument. Also ---- - scripts/verify-production.ts exports createPackReport, so a gate reasoning about what a user receives asks npm instead of reading the build directory. - test/release_canaries.test.ts's coverage map said canaries 5 and 7 were unwritable. #86 and #87 wrote them two commits later; the excuse outlived the condition. The map is now enforced by a test that reads the delegated files. - docs/releases/OPERATOR-PACKET-v0.3.0.md: the founder-owned publish sequence, with what is proven and what is explicitly not. Gates at this commit: npm run typecheck exit 0 release + production test files 21 pass / 0 fail npm run verify:production --tag v0.3.0 ok Full npm test NOT run locally (a tool_executor test does not return on this Windows box); CI is the authority. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs(release): fill the operator packet with the commit-bound candidate evidence Run against a63e1c6 in a detached worktree: commitBound true, ok true, exit 0. Tarball aether-agents-0.3.0.tgz, 524 entries, 589,829 bytes packed / 2,435,029 unpacked, sha256 25f33524bd866275674eccbf8cfe5706f14e925cb0ba35861dc6bc21a9245a2d. The digest came out identical from an uncommitted tree and from the detached worktree, which is recorded as content stability across a docs-only commit and explicitly NOT as a cross-machine reproducibility claim. Also records the mutation check: dropping dist/src/commands/skills.js from the files allowlist leaves verify:production reporting ok:true at 523 files, and fails release_coherence by name. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * release: cover #98 in the notes, and make the coherence gate bidirectional The ground moved while PR #96 was open. #98 squash-merged to main, main became 426b124, and the v0.3.0 notes said nothing about it — which is this lane's own defect arriving from the direction the lane did not gate. WORK A: the notes now cover #98 ------------------------------- Its user-visible half is three fixes, and the first is the exact failure class this codebase forbids: - `aether doctor --live` never received --live. main.ts parses non-strictly, so a flag the command had not declared was captured globally and stripped from what the command was handed. --live ran the fast configured-only report and EXITED 0, presenting a live end-to-end verification that was never performed. Unknown rendered as verified. --deep, --dry-run, --no-ui and --only were lost the same way, and the whole --fix repair path was unreachable. - `aether doctor --fix --yes` answered "re-run with --yes" to someone who had just passed it, because the global --yes never arrived either. - Command lookup lowercased the token while dispatch was case-sensitive, so `aether Vault` fell past the typo guard into a chat turn and billed a paid model call. The seam itself is announced too: a command now carries its own help metadata, flag table and loader in one entry, flag collisions are load-time errors, and reachability is structural rather than a regex over main.ts's source. Range moves 477f0fc..ed094dc -> 477f0fc..426b124, 16 commits -> 17, across RELEASE_NOTES.md, docs/releases/2026-08-22.md and the operator packet. Fixed a miscount while re-deriving: the packet said "9 user-visible fixes" over a list of ten. WORK B: the gate now runs both directions ----------------------------------------- Gate B ran notes -> package: a claim with no code behind it fails. It could not see the inverse — a user-visible command that ships with NO claim anywhere — and the inverse is what actually keeps happening, once per lane that lands between the note being written and the tag being cut. Gate C: every non-hidden command in the CLI registry must be announced by some release note, or named in SHIPPED_WITHOUT_A_NOTE with a reason. An explicit list is fine; silence is not. It is enforced in both directions — a stale entry fails, and an entry that IS announced fails — so it cannot rot into a permanent bypass that quietly absorbs the next unannounced command. Every entry must also appear in the operator packet, because the founder cutting the tag is the person who needs to know what goes out unannounced. 15 commands are on it today; all predate the release log or were announced by capability in the June 2026 entry, and none is new in this release. Mutation-checked, per the controller's instruction. Added to the registry: { name: "teleport", args: "<dest>", summary: "beam the working tree somewhere", section: "System" } verify:production -> {"ok":true, ... "packedFiles":527} MISSED IT release_coherence -> FAIL: no user-visible command ships without either a release note or a named exemption + [ 'teleport — beam the working tree somewhere' ] - [] Registry restored byte-identical (md5 37b3f944…, `git status src/` empty), 10/10 pass. cli_registry.ts is read-only for this lane: it was mutated only in the working tree, never committed, and the restore is verified by digest. Also: Gate B now reads the registry by IMPORTING it instead of by regex over its source. #98 replaced "reachability asserted by a regex over main.ts" for exactly this reason, and it immediately split the commands across CLI_COMMANDS and DISPATCH_COMMANDS — a source regex keyed on one array would have silently stopped covering the other. doctor is in the second one. Gates at this commit: npm run typecheck exit 0 release_coherence 10 pass / 0 fail Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * docs(release): re-cut the candidate on the new base, and record the digest change The base moved to 426b124 (#98), so every number in the packet was taken against a tree that no longer exists. Re-run, commit-bound, at 22aa021: commitBound true, ok true, exit 0 aether-agents-0.3.0.tgz sha256 8c5c119d93cabf49af0c49c97addb055308d508af93f8675a26b6f5c8ecba307 527 entries, 597,400 packed / 2,459,474 unpacked The digest CHANGED from the a63e1c6 run (25f33524…, 524 entries), and the packet now says why that is the correct outcome rather than a discrepancy: #98 added dist/src/core/command_dispatch.* and rewrote main.js, so the packed content is genuinely different. A digest that had survived that change would have meant the pack was not reading the tree. Both mutation checks were re-measured against this base rather than carried forward: skills drop verify:production {"ok":true, ... "packedFiles":526} MISSED IT release_coherence FAIL: dist/src/commands/skills.js restored -> 527 files, 10/10 pass teleport verify:production {"ok":true, ... "packedFiles":527} MISSED IT release_coherence FAIL: 'teleport — beam the working tree somewhere' restored -> registry byte-identical, 10/10 pass I had initially edited the skills figure from 523 to 526 by inference. That is a number nobody measured, so it was re-run before being written down. Release-owned suite at this commit: 24 pass / 0 fail. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * release: regenerate the v0.3.0 truth against the merged main * release: cover #105 in the v0.3.0 notes * release: bind the v0.3.0 operator packet to the head that carries #105 Regenerates the packet against a845479 (origin/main after #105): base SHA, evidence commit, tarball digest, packed entry count, the recorded release-candidate run, and the coverage breakdown. Two corrections rather than refreshes: - Section 5 no longer lists the full test suite as unproven. It was run at the evidence commit (1464 tests, 1460 pass, 0 fail, 4 skipped); what is genuinely unproven is the suite INSIDE the candidate run, which reports npm-test as not-run by design. - Two new unproven entries name the deployed API. The notes' Authentication claims are about a server this repository cannot test, and #105 exists precisely because `aether agent` does not work end to end against production today. Both are marked rather than implied. * release: record the measured tarball size, not a rounded one The packed size in the packet header was written from npm's rounded "740.0 kB" notice rather than measured. The tarball is 739,977 bytes. A digest and a byte count that disagree are the same class of defect this packet exists to close. --------- Co-authored-by: DBarr3 <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.
The user problem
Against production (
api.aethersystems.net),aether agent --model kimi_k3 "<task>"was not a coding session at all.CloudBrainPOSTs/agent/dev/sessions, production answers403 {"detail":"agent dev sessions disabled"}(AETHER_AGENT_DEV_ENABLEDis unset), andisLegacyServer()(404 or 403) silently rerouted the run onto the one-way/agent/chat/stream— where tools run server-side against the cloud vault, not in the user's checkout.The run printed the normal
Aether AI · neo-liteheader, a model reply of "I can't execute this, I don't have shell access to the worktree", and exit 0. No line anywhere said the transport had changed. The user asked for a local-authority coding session and got a chat, with a success exit code.Real transcript, this branch, against production:
--json, same run:{"type":"routing_drift","kind":"routing_drift","requested":"dev_session","resolved":"refused","status":403,"reason":"agent dev sessions disabled","consequence":"tools run on the server, not in this checkout; no files here will change","remediation":"the server has agent dev sessions disabled; ask the operator to set AETHER_AGENT_DEV_ENABLED=1, or run `aether agent --local`","fatal":true} {"type":"done","ok":false,"result":"refused: …","remaining":0,"reason":"routing-drift"}No
/agent/chat/streamrequest is issued on that path — asserted against a fakeApiClientcall log, not against printed prose.Scope
src/core/brain_protocol.ts— new host-sideRoutingDriftFrame(type/kind"routing_drift",requested,resolved,status,reason,consequence,remediation,fatal), added to theBrainEventunion. It is never sent over the wire by any brain, so it is not part of the frozen decode surface andPROTOCOL_VERSIONis unchanged (additive, per docs/CONTRACTS.md's versioning rule). No existing event could carry the required--jsonshape.src/core/brain_cloud.ts— the 403/404 downgrade now emits the drift event before anything else (so it precedes any model output), with the server'sdetailrun through the repo's existingsanitizeServerText. NewCloudBrainOptions.requireLocalAuthority(default false, so library embedders andsmoke.tsare unchanged). Fail-closed whenrequireLocalAuthorityor an explicittask.model: the chat stream is never opened, and the run endsdone ok:false, reason:"routing-drift".src/ui/host_render.ts— render only.routingDriftLines()(exported, because the animated status renderer never routes throughHostRendererand both surfaces must say the same thing) plus arouting_driftcase. The literal tokenROUTING_DRIFTcarries the meaning; colour only decorates it, so a piped log / dumb terminal / screen reader gets the same words. Written to stderr, so piped stdout is as clean as before.--jsonreturns early as it already did, emitting the record above.src/commands/code.ts—aether agentconstructsCloudBrainwithrequireLocalAuthority: true; a fatal drift is captured on both presentation paths and returns the newEXIT_ROUTING_REFUSED = 3beforefinalVerify(otherwise the gate would run the project's tests and report on a tree no brain ever touched). No new flags; nothing added tocli_registry.COMMANDS.md— the exit-code table gains3.test/brain_cloud_drift.test.ts(12); one assertion updated intest/brain_cloud_dev.test.ts.One deliberate honesty deviation from the brief
The brief specified
resolved:"chat_stream"in the JSON record. On a fail-closed run the chat stream is never opened, so reporting"chat_stream"would be the same class of lie this event exists to stop.resolvedis typed"chat_stream" | "refused"and reports which actually happened; the degrade path (unpinned embedder runs) still reports"chat_stream", pinned by a test.Exit code choice
3. The existing documented table is0success /1runtime error /2usage error, and130/143are the signal conventions the UI already uses; nothing in the repo used3. A refusal is neither a crash nor a mistyped argument — a script that sees3knows nothing ran and that retrying without an operator change gives the same answer. Documented inCOMMANDS.md.Non-goals
--local(Ollama) behaviour: untouched.AETHER_AGENT_DEV_ENABLED=1) remains the real fix for production.aether "<prompt>"chat does not useCloudBrainat all, so it is unaffected. The unpinnedCloudBraindegrade path is kept for embedders and still works — it is simply no longer silent.Security assumptions
detailstring is server-controlled text that lands in a terminal and in a--jsonline. It goes through the repo's one canonicalsanitizeServerText(C0/C1 stripped, capped at 200) — a mutation dropping that is caught by a test carrying\x1b[31mand an OSC-52 payload.oneLine()collapses newlines/tabs in every rendered drift field, so a crafteddetailcannot forge a second frame line (e.g. a fake[ OKAY ]).Compatibility — stated plainly
This changes an exit code. Against a server with agent dev sessions disabled (i.e. production today),
aether agentused to exit 0 after a chat-shaped run; it now exits 3 and produces no model output. Anything scripted aroundaether agentsucceeding on such a server will start failing — which is the point: those runs were changing nothing on disk. The same applies to anyaether agent --model …invocation against an older server missing the route (404).Unchanged:
--local,aether chat/ bare-prompt chat, all dev-session-capable servers (a granted 200 emits no drift event at all — pinned by a test), and any embedder constructingCloudBraindirectly (the new option defaults off).Rollback
Revert the two commits on this branch (
3ef3c47,52c07f6). Nothing persists, no migration, no server change. A softer partial rollback is one line: drop{ requireLocalAuthority: true }at theCloudBrainconstruction insrc/commands/code.ts— the drift event and the ROUTING_DRIFT line stay, only the fail-closed exit goes away.Base / head
2769778af3b4f0dfa7d73c894cdb74cdabbe3cef(origin/main, after feat(sessions): project continuity and the session library (AA-CONT-04) #99 landed)52c07f699518efb2317a61988f93b4db1e9a7f5abffb40a733daf2e1688a05fae7981de68d9a93b2; rebased onto feat(sessions): project continuity and the session library (AA-CONT-04) #99 (one conflict, an import line insrc/commands/code.ts, resolved by keeping both imports)Files
Gates
npm ci— clean.npm run typecheck— clean.npm test— 1452 tests, 1448 pass, 0 fail, 4 skipped on the rebased head (+12 new; 1361/1357 before the rebase onto feat(sessions): project continuity and the session library (AA-CONT-04) #99).npm run smoke— 5 pass / 1 skip / 1 fail. The fail is the known env one (local turn: Ollama modelqwen2.5-coder:7bnot pulled);web_searchskips (no results).cloud turnpasses — the unpinned embedder degrade path still answers against production, which is the compatibility half of this change proving itself.ROUTING_DRIFTprinted, no chat request. Spends nothing (the 403 is free).Mutation evidence
Each mutation applied to
src/core/brain_cloud.ts, rebuilt, run, then restored viagit checkout --.legacyPump)requireLocalAuthorityrefusal, the explicit---modelrefusal, and thecmdCodeexit-3 testlegacyPumpinstead of beforesanitizeServerText(...)\x1b[31m+ OSC-52 sanitisation test andrefusalReasonAll 12 pass again after each restore; the full suite is green at head.
What is NOT tested
routingDriftLines()is shared and unit-tested, but no test drivesStatusRendererwith a drift event.403classification itself is unchanged and untested here: if the server ever returns 403 for a reason other than the feature flag (e.g. a per-account entitlement), the message names the flag and would be misleading. The status and the server's ownreasonare both surfaced so the user can tell.incomplete).Dependency
None. Rebased onto
mainat2769778(#99).Author model: claude-opus (requested gpt56_terra; reviewer requested opus5/gpt56_sol — the hosted fleet cannot execute local lanes while dev sessions are disabled, which is this very defect).
🤖 Generated with Claude Code