KeepErrors only matched tool results starting with "error:" or "blocked:",
the shape the host formats for an execution failure. A tool that ran fine
but reported a failure — a go test FAIL, a compiler error, any non-zero
exit — never matched, so its evidence folded into the digest and the
specific assertion was gone. Measured against a full-history control on
benchmarks/compaction, evidence buried mid-result survived 0 of 6 runs
while the control kept it every time.
provider.Message.ToolExecution already carries State/ExitCode/Verification
and is already stripped before provider requests, so isErrorMessage reads
it instead of guessing. Because the failure then stays identifiable without
its text prefix, a protected failure can also be shortened: snipFailureResult
keeps the failure-carrying lines with two lines of context and drops the
passing noise, holding the projection cost to +3.5% rather than the +100%
that keeping the whole result costs. A text-only failure has no such anchor
and is still carried whole.
The rewrite happens on three paths — the planning pass, the re-write that
follows archiving, and the fold's kept partition — now unified through
maintenanceReplacement/keptForProjection so one cannot silently overwrite
another.
benchmarks/compaction gains the probe that measures this, a -snip arm,
cross-generation planting for revisions that land across a fold, and
alignment with boot's default KeepPolicy. Buried evidence now survives
18 of 18 runs.
Problem: the root-fix draft depended on an unreleased Bubble Tea API and a temporary personal fork, so it could not safely merge or ship.
Root cause: fully removing the application-level workaround on Warp requires a renderer capability that Bubble Tea does not yet expose in a stable release.
Fix: merge the latest main-v2 hotfix, restore official Bubble Tea v2.0.8, retain session-switch suppression, and enable the legacy per-offset ClearScreen only when TERM_PROGRAM identifies Warp on non-Windows platforms.
Verification: focused scroll policy tests, go test ./..., go vet ./..., make lint, and Windows amd64 CLI test cross-compile.
Reasonix isolates a child's session but not its conclusions. The context
capsule records, field by field, what a child inherited from its parent
and every field is false — yet the one channel that actually carries
information, the parent's free-text prompt, is not modelled at all. Two
host-recorded instruments close that gap.
Evidence origin splits what a delegation's own text pointed at into
directory scope, which is the unavoidable cost of handing work off, and
named files, which say where the answer is. The child is credited only
for paths no named file already covered, so a scope hint never erases
its work. The two are counted apart because one number reports the cheap
act as the expensive one — the combined form read 0-3% independence
where the split reads 94-100%.
The -anchor arm hands the agent a hypothesis before it has read
anything: the task's real cause, a plausible wrong one, or none. Tasks
without an authored seed are skipped rather than run as the control, so
a seeded denominator never absorbs a control run.
Measured over 210 runs across two corpora (deepseek-flash, 5 reps each),
anchor resistance is 1.00 on both — including one whose answers no
command can check — while a wrong hypothesis costs ~2x wall and ~1.35x
tokens to unwind. Children discovered 94-100% of their own evidence:
this parent hands scope, not answers.
Also guards two failures found while running it: the bench read metrics
tags the agent had stopped emitting, and a failed grader's output never
reached the record that had to explain the failure.
Problem: application-level ClearScreen after every viewport offset change produces a second full redraw on Windows and visible transcript flicker.
Root cause: terminal compatibility policy lived in chatTUI.Update because Bubble Tea did not expose its scroll optimization switch.
Fix: disable renderer scroll optimization for Windows and Warp, remove the per-scroll ClearScreen and session-switch suppression state, and retain semantic clears for /clear and wide input.
Verification: go test ./..., go vet ./..., make lint, Windows amd64 CLI test cross-compile, and Bubble Tea VT output tests.
Problem: Windows CI expected idle Ctrl-C state changes to return a command, but the Windows scroll-flicker fix correctly removes the unrelated ClearScreen command that had satisfied those assertions.
Root cause: the tests conflated Bubble Tea model rendering with command execution; changed model state is rendered even when Update returns no command.
Fix: assert the armed Ctrl-C state directly and keep the real quit/copy command checks unchanged.
Verification: focused Ctrl-C and scroll tests; go test ./internal/cli/...; go vet ./...; make lint; Windows amd64 internal/cli test cross-compile.
Problem: desktop CI exceeded the compressed bundle budget after the context composition panel was removed.
Root cause: UI-only localization entries for the removed panel remained in all three locale bundles.
Fix: remove the unused English, Simplified Chinese, and Traditional Chinese entries while preserving maintenance notice strings still used at runtime.
Verification: pnpm exec tsx src/__tests__/context-maintenance-notice.test.ts; pnpm build.
Problem:
The context panel exposed internal maintenance thresholds and projection details that added noise to the primary usage view.
Root cause:
PR #8109 rendered maintenance telemetry directly between the context-window gauge and session metrics.
Fix:
Remove the context composition section and its presentation-only derived state while preserving backend maintenance telemetry and localized notices. Add a source contract that prevents the internal block from returning.
Verification:
- pnpm exec tsx src/__tests__/context-maintenance-notice.test.ts
- pnpm exec eslint src/components/ContextPanel.tsx src/__tests__/context-maintenance-notice.test.ts
- pnpm typecheck
- pnpm check:css
- Browser DOM: composition absent; context window, session metrics, and usage analysis present
Problem: merging the latest main-v2 provider bridge additions pushed the desktop initial raw bundle above its enforced 2200 KiB budget.\n\nRoot cause: the workspace focus and visibility reconciliation lifecycle was statically bundled even though the workspace refresh store was already loaded on demand.\n\nFix: move the lifecycle coordinator into the lazy workspace store, retain stale-load and cleanup fencing in App, and keep the project-tree subscription in the same refresh lifecycle.\n\nVerification: pnpm test:all, pnpm build, targeted Go race tests, repolint, and git diff --check.
* feat(provider): add OpenCode Go DeepSeek protocol presets
Problem:
OpenCode Go exposed DeepSeek Flash through Chat Completions, but Reasonix had no dedicated Anthropic Messages or Responses presets with verified server-side web search support.
Root cause:
The curated catalog mixed unrelated Anthropic models, and Responses web-search replay was restricted to the official DeepSeek hostname instead of the enabled wire capability.
Fix:
Add model-scoped Anthropic and stateless Responses presets for DeepSeek Flash, enable verified web search, preserve completed Responses search calls for replay, and update Desktop capability rendering, localization, docs, mocks, and live tests.
Verification:
- go test ./...
- focused Desktop provider preset tests
- frontend typechecks and startup settings contract
- cache impact and cache guard scripts
- authenticated OpenCode Go Anthropic and Responses web-search live tests
* fix(provider): close OpenCode Go review gaps
Problem:
Repository lint rejected the protocol preset additions because they grew several baselined owner and test files. The live probes also stopped after the first web-search turn, leaving Responses replay and Anthropic tool-result compatibility unproven.
Root cause:
OpenCode Go preset data and focused assertions were added inline to already-ratcheted files, while the credential-gated tests did not exercise the provider-issued continuation payloads.
Fix:
Extract the OpenCode Go preset and localized description data into focused files without changing wire-visible configuration. Add a real Responses stateless follow-up and an Anthropic function tool/result round trip that preserves returned reasoning signatures.
Verification:
- go test ./... && go vet ./...
- go test -race ./internal/config ./internal/provider/responses ./internal/provider/anthropic
- go test -tags=live for both OpenCode Go protocol paths
- desktop go test ./... && go vet ./...
- frontend typecheck, settings contract, build, and bundle budgets
- go run ./tools/repolint
- ./scripts/cache-guard.sh
Problem:
The Linux lint job rejected the workspace mutation command scanner under the Go 1.26 modernize rules.
Root cause:
The scanner ranged over an allocated strings.Fields slice even though the current toolchain provides the equivalent FieldsSeq iterator.
Fix:
Use strings.FieldsSeq so command classification preserves token semantics without the intermediate slice allocation.
Verification:
- go test ./internal/agent
- go vet ./internal/agent
- go test -race ./internal/agent
- golangci-lint run --timeout=5m
- go run ./tools/repolint
Problem:
The review fixes left refresh coordination and mutation tests embedded in already oversized owner files, and one source-contract test assumed the fallback lived directly in App.tsx.
Root cause:
Fast-path mutation delivery and focus reconciliation were added at their call sites before the final repository-size audit, coupling the behavior to presentation files and historical test layout.
Fix:
Extract host mutation contracts, mutation finalization, focus reconciliation, and focused tests into dedicated modules. Keep resource flags on the host-only signal, preserve provider wire omission, and teach the source contract about the extracted hook without expanding any lint baseline.
Verification:
- go test ./... and go vet ./...
- desktop go test ./... and go vet ./...
- focused Go race suites for agent, event, eventwire, boot, and desktop workspace hub
- pnpm test:workspace, pnpm test:all, and pnpm build
- repolint, release workflow contracts, formatting, bundle budgets, and diff checks
Resolve the desktop frontend CI conflict by retaining workspace, motion, and transcript suites. Also keep the WebView2 smoke global declaration visible to the test TypeScript dependency graph.
Verification:
- go test ./...
- go test -race ./internal/event ./internal/agent ./internal/eventwire ./internal/evidence ./internal/boot
- go test -race . -run 'TestWorkspaceChangeHub|TestTabEventSink' -count=1 (desktop)
- go test ./... (desktop, isolated rerun)
- pnpm test:all
- pnpm build
Problem:
Workspace previews and change resources could stay stale after focus reconciliation, hook-replaced writers, Git metadata-only commands, or a writer completing ahead of another tool in the same batch.
Root cause:
Reconciliation ignored equal revisions, mutation attribution used the provider-visible call and the delivery classifier, and host invalidation was coupled to batch-ordered ToolResult emission.
Fix:
Add an independent host-only workspace mutation capability, classify the final executed target, publish each writer immediately, advance resource-specific revisions, and force visible resource reloads for focus/degraded fallback without accepting stale scope responses.
Verification:
- go test ./...
- go test ./... (desktop module)
- go vet ./... (root and desktop modules)
- go test -race ./internal/event ./internal/agent ./internal/boot
- go test -race . -run 'TestWorkspaceChangeHub|TestTabEventSink' -count=1 (desktop)
- pnpm test:all
- pnpm build
Co-authored-by: SivanCola <[email protected]>
Problem: scrolling the alt-screen transcript on Windows triggered an asynchronous full-screen clear for every viewport offset change, producing a visible second frame in ConPTY terminals.
Root cause: the Warp stale-row workaround was applied on every operating system even though Bubble Tea already disables scroll optimization on Windows.
Fix: retain the legacy clear workaround on non-Windows terminals only and cover the platform policy plus force-bottom behavior with focused tests.
Verification: go test ./... -count=1; go vet ./...; make lint; Windows amd64 internal/cli test cross-compile.
* test(desktop): enforce native motion release gates
Problem:
Native motion regressions could pass aggregate CI even when Element.animate was never exercised, and Windows release builds were signed without a real approval interaction in WebView2.
Root cause:
The focused motion suites were not part of a required check, legacy GSAP easing tokens had no source-level contract guard, and the release workflow never launched the built Wails executable.
Fix:
Add WAAPI contract scanning, required motion CI, a real Wails/WebView2 approval smoke before signing, protected release verification, and an independent review check for large or cross-boundary pull requests.
Verification:
- pnpm test:motion
- pnpm typecheck
- pnpm build
- go test ./... (desktop)
- bash scripts/release-workflows.test.sh
- actionlint for changed workflows
- go run ./tools/repolint
* fix(ci): close native motion release gate gaps
Problem:
- Windows rejected the shared WAAPI easing constants and the required lint job failed ShellCheck.
- Large-PR approval could be stale or evaluated from candidate-controlled workflow code.
- Pull requests did not exercise the real Wails approval flow in WebView2.
Root cause:
- The WAAPI contract matched only POSIX paths, the cross-platform lint loop split an unquoted value, and the review policy was bound to pull_request events without checking review.commit_id.
- The WebView2 smoke existed only in the release workflow.
Fix:
- Normalize contract paths and add a Windows regression fixture.
- Quote the lint target parsing, move review decisions into a protected control plane with current-head status publication, and add policy tests.
- Build and smoke-test the Windows Wails executable in PR CI.
Verification:
- pnpm --dir desktop/frontend test:motion
- pnpm --dir desktop/frontend build
- node --test .github/scripts/cross-boundary-review.test.cjs
- bash scripts/release-workflows.test.sh
- actionlint for all changed workflows
- cd desktop && go test ./...
- go run ./tools/repolint
Co-authored-by: Ray-lyy <[email protected]>
* fix(ci): isolate transcript virtualization from motion gate
Problem:
The native motion gate ran the transcript virtualization suite in three jobs. Its prepend assertion could execute before the virtualizer remounted the anchor, producing a false Windows failure and skipping the real WebView2 smoke.
Root cause:
The suite was grouped by historical proximity rather than ownership, and the assertion waited for one fixed render flush instead of the DOM condition it required.
Fix:
Give transcript virtualization its own test command, run it once in the Linux desktop job, and make the motion contract reject future coupling. Wait for the anchor to remount before asserting, and cover the transcript entrance reset-key contract directly.
Verification:
- pnpm --dir desktop/frontend test:motion
- pnpm --dir desktop/frontend test:transcript (6 consecutive passes)
- pnpm --dir desktop/frontend typecheck
- pnpm --dir desktop/frontend build
- go run ./tools/repolint
- actionlint for changed workflows
- bash scripts/release-workflows.test.sh
* fix(ci): defer WebView2 smoke instrumentation
Problem:
The latest-base Linux Desktop build exceeded the 2,200 KiB raw startup budget by about 0.1 KiB.
Root cause:
The Windows-only approval smoke instrumentation was statically linked into every normal desktop startup while the latest base had little budget headroom.
Fix:
Lazy-load the smoke component only when the native harness injects its flag, and make the motion contract reject a future static App import.
Verification:
- pnpm --dir desktop/frontend test:motion
- pnpm --dir desktop/frontend test:transcript
- pnpm --dir desktop/frontend typecheck
- pnpm --dir desktop/frontend build
- go run ./tools/repolint
- git diff --check
---------
Co-authored-by: Ray-lyy <[email protected]>
Problem:
Non-interactive Wails builds could abort while pnpm asked to recreate node_modules, and local, CI, release, and documentation toolchain versions could drift.
Root cause:
The Wails frontend install hook kept pnpm purge confirmation enabled, release jobs still used Node 22, and the repository had no cross-file guard for the Node and pnpm contract.
Fix:
Make the pnpm purge path non-interactive, align Desktop builds on Node 24 and pnpm 10, reuse the shared .wails-version installer from #8069, separate CLI and Desktop build instructions, and enforce the contract in the release workflow test lane.
Verification:
- node scripts/check-desktop-build-contract.mjs
- bash scripts/check-wails-pin.sh
- bash scripts/check-wails-pin.test.sh
- bash scripts/release-workflows.test.sh
- actionlint .github/workflows/release-desktop.yml
- Node 24 engine-strict frozen install and frontend production build
- make lint
- go vet ./...
- go test ./internal/tool/builtin/ ./internal/boot/
- make wails-install and a full Wails macOS build
Co-authored-by: SivanCola <[email protected]>
* fix(desktop): open folders in Explorer via explore verb, not open (#7851)
ShellExecute's "open" verb resolves folders through the shell namespace,
where a sibling "<folder>.lnk" with the same base name wins and launches
the shortcut's target instead of Explorer. The "explore" verb opens a
folder in Explorer directly and never consults .lnk files; files keep
"open".
* fix(desktop): open folders with explore verb plus trailing separator
Ablation on a real Windows host showed the first attempt was ineffective:
with a sibling "<folder>.lnk" present, ShellExecute's "explore" verb alone
returns E_FAIL (hinst 5) and opens nothing. Both "open" and "explore"
succeed once the folder path carries a trailing separator, which forces the
shell to treat the target as a directory and never consult the .lnk. Use
explore + trailing separator for folders; files keep "open" unchanged.
* fix(desktop): reuse validated path metadata for shell opens
Problem:
The Windows Explorer ambiguity fix classified every target with a synchronous os.Stat. Newer local-path and external-opener callers had already performed that lookup, while an unknown path silently fell back to the unsafe open verb and directory roots gained a duplicate separator.
Root cause:
Path classification and ShellExecute planning were coupled inside openWorkspacePath, so validated callers could not pass their existing directory metadata.
Fix:
Add a platform helper that accepts the validated directory flag, reuse it at existing stat call sites, fail closed when standalone classification fails, and append a folder separator only when absent. Extend Windows regression coverage for missing paths and pre-terminated directory targets.
Verification:
- go test ./... (desktop)
- go test -race . -run focused desktop opener tests
- go vet ./... (desktop)
- go run ./tools/repolint
- Windows/amd64 cross-compiled tests on Win11
- Full Wails Windows build opened the exact folder in Explorer without launching the real same-named shortcut
Co-authored-by: SivanCola <[email protected]>
* docs(desktop): clarify local opener safety boundary
Problem: The local opener comment said openWorkspacePath stayed untouched and named RevealWorkspacePathForTab, which no longer matched the implementation.
Root cause: Windows directory classification evolved while the old security-boundary explanation remained unchanged.
Fix: Describe the actual invariant: openWorkspacePath stays outside the executable-target guard because callers provide workspace-authorized paths.
Verification: focused desktop local-path tests, go vet ./..., repolint, and git diff --check.
Co-authored-by: SivanCola <[email protected]>
---------
Co-authored-by: SivanCola <[email protected]>
Integrate the sub-agent specification and event sink forwarding refactor at 28ad01d5. Regenerate the repolint baseline from the combined tree; workspace refresh and audit event contracts remain intact.
Problem:
Workspace revisions could cross scope boundaries, refresh bursts could overlap or hammer Git, and the Desktop watcher could suppress real external saves or retain roots after a workspace switch.
Root cause:
The frontend kept a tab-global monotonic baseline and used direct refresh effects, while the hub used time-based agent/filesystem deduplication, incomplete Git metadata watches, and delayed watcher cleanup.
Fix:
Scope refresh snapshots by tab and workspace, add bounded trailing schedulers, extract resource invalidation, release stale roots, validate mutation paths, recursively watch selected Git metadata, and preserve every authoritative filesystem observation. Add deterministic frontend, watcher, race, and CI coverage, plus lazy reconciliation to preserve bundle budgets.
Verification:
go test ./...
go test -race . -run TestWorkspaceChangeHub -count=1
pnpm test
pnpm build
go vet ./...
./scripts/cache-guard.sh
./scripts/check-wails-pin.sh
go run ./tools/repolint
Every compaction decision divides by the context window, so a window that
is too small is indistinguishable from a context that is genuinely full:
both just compact. Nothing exposed the number, and nothing exposed why a
maintenance pass did or did not run.
/context reports the window and its usable ceiling, the latest prompt (the
last request's shape, never the billable retry aggregate), canonical vs
model-visible size, the snip/fold/force thresholds as absolute tokens, the
last pass's mode and what it reclaimed, and the blocked reason when one is
recorded. The one-line summary names what happens next rather than only
how full the context is.
Thresholds come from compactThresholds and forceCompactThreshold, the same
helpers the decision uses, so the report cannot drift from the behavior.
Adding a command to two files already at their size budget would have
widened the baseline, so the routing pays for itself: /new and /clear were
two copies of the same goroutine-and-report block and now share
runSessionVerb, and /remember moves out of the switch alongside the new
/context handler. Notice texts are unchanged.
Resolve concurrent event contract additions by retaining both context maintenance and workspace refresh events. Keep the latest main-v2 desktop, runtime, documentation, and CI changes as the integration base for the workspace refresh fixes.
The custom-provider wizard wrote ContextWindow: 128000 unconditionally,
on all four paths (OpenAI and Anthropic compatible, single model and
model list). A relay serving a 1M-window model was therefore recorded as
128K, and compaction fired at 80% of the wrong number: roughly a tenth
of the model's real capacity, which reads to the user as "Reasonix
compacts far too early".
An OpenAI-compatible endpoint does not report its context window, and
guessing from the model name is unreliable for a relay, so the wizard now
asks. The default stays 128000 for the case where the user does not know
either, but it is a visible answer rather than a silent assumption.
The prompt says what a wrong value costs, since that is the part no one
could previously see.
I wrote that one child run "costs 100k-220k tokens before it produces
anything", and used it as a threshold to compare a branch's size against. Both
halves were wrong enough to mislead.
The figure is cumulative prompt tokens across the child's own model calls, so
the same context is counted once per call: 27 measured children averaged 134k
tokens over 9.3 calls, which is the same ~14k context re-sent, not 134k tokens
of new material. At the ~90% cache hit these runs saw, the real price of a
child averaged ¥0.017.
The 2-4x delegation cost is unaffected, because both arms are counted the same
way. What is removed is the invented threshold: comparing a branch's size in
tokens against a child's cumulative re-sent context is not a like-for-like
comparison and should never have been stated as one.
The benchmark line is relabelled to say what it measures. For scale, what this
branch itself adds to a child — complete_subtask's schema, its description and
the closing contract — is about 654 tokens of that per-call context, roughly
4.5% of it.
Summary:
Generate a bilingual, product-focused draft from merged pull request metadata. Reuse the selected release-bound PR when one is available.
Verification:
Validate the catalog, citations, bilingual fields, and rendered GitHub release notes before committing.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
main-v2 had moved 84 commits ahead. Everything auto-merged except
tools/repolint/baseline.json, which is generated: resolved by taking upstream's
and regenerating, rather than hand-merging JSON.
Regenerating surfaced one real violation instead of a carry-forward:
internal/event/event.go had grown past its budget, so the delegation audit sink
and its dispatcher move into audit_forwarder.go where the rest of that concern
already lives. The only baseline entry above upstream is plugin_entry.go's
essay, which is the field comments carried through the earlier extraction.
The delegation boundary rule went into REASONIX.md while the spec member was
still called ContextCapsule. Renaming it to ContextRequest, so the manifest
could take that name, left the standing instruction pointing at a type nobody
can find — and REASONIX.md is loaded into the system prompt, so the stale name
is in the prefix rather than only in a doc.
Also worth recording against the question this came from: does merging make the
agent delegate less? Measured rather than argued. The same five neutral tasks,
same fixtures, only the binary swapped: main-v2 delegated zero times and this
branch delegated zero times, both 4/4 passing. The 15% delegation rate observed
throughout was already the main-v2 rate.
Nothing here adds a brake. The admission gate runs in applyBatchGuards, after
the calls have executed, and only emits an audit — there is no path by which a
verdict denies a call. The ablation change is inert unless --ablate subagent is
passed. What the branch adds to a delegated run is complete_subtask in writer
child registries and a closing contract in the child prompt, which is a cost
paid by a child that already ran, not a deterrent to starting one.
The question was why the model keeps sidestepping situations built to need
delegation. The recorded reasoning answers it: it does not weigh delegation and
decline, it never reaches the question. On a task built for `explore` it
deliberates over how to read efficiently — "that's 25 files... read them in
parallel batches... I can read multiple files at once" — and delegation does not
enter the decision.
Three causes, one of them a defect. The base system prompt never mentions
delegation; every mention is in the skills index and every one is a brake, sat
next to an accelerator for inline skills. The task tool description says what
the tool does and never when to reach for it. And the model already has cheaper
parallelism in several tool calls per round trip, with no context duplicated,
which is the thing it actually reasons about.
Given the measured 2.4-4.5x cost, the brake is the right default and is not the
defect. The gap is that nothing recognises the rare case where delegation would
pay, and forcing it does not close that gap: in the forced fleet run the parent
derived all three fixes in its own reasoning before dispatching, so the children
re-read the code to apply edits it had already worked out. Delegation moved the
typing, not the thinking.
Numbers behind it: 33 runs with delegation available, 15% delegated, bash
outnumbering every delegation-class call 10 to 1.
Nine optional capabilities, repeated at every wrapper in the chain, silently
lost three audits in this branch alone: control's goal-usage tee, the stats
recorder, and the nesting sink fleet items run under. Each time the data simply
stopped, each time with the tests green, and each time the fix was to write the
same method one more place.
event.AuditForwarder holds the nine forwards once. A pure forwarder embeds it
and is complete by construction, so the next capability added there reaches
every embedder without editing them. goalUsageTee, notify.Sink, telemetry's
sink and the nesting sink now embed it, deleting roughly a hundred lines of
identical methods; the tee had been forwarding eight of nine, and the nesting
sink three of nine, before this.
Wrappers that do real work per channel — the coalescer flushes first, stats and
trajectory record, run metrics consumes — keep their own methods. Embedding is
for the ones that only pass things through.
The guard now asserts the forwarder itself covers every capability, which is
the property that makes the wrapper-level guard mostly redundant rather than
load-bearing. Verified end to end against the provider: a delegated run still
reports its child.
The last hypothesis worth testing was that delegation's isolation pays when the
parent is genuinely hurt by what it read. Isolating that mechanism needs the
parent under context pressure, so these two variants pin a workspace
compact_ratio of 0.5% over the same three-package migration.
It did not work. Zero compactions in both arms, at 0.5% of a 1M window, because
the agent keeps its session small by writing a script rather than reading — the
same behaviour that has won it every comparison so far. The arms still came out
4.5x tokens and 5.6x wall for the forced one, but that number is not evidence
about context pressure, because the pressure never arrived.
Kept as an honest record of the attempt rather than deleted, and because they
exercise the project reasonix.toml merge path (verified: the run reports
compact_ratio = 3% (project: reasonix.toml), so the config is read; the session
simply never reaches the threshold).
SPEC 3.17 states this as untested rather than disproved. Provoking it needs a
task that cannot be scripted away, which this corpus does not contain.
Problem:
Context maintenance still had divergent strict-role and manual compression paths. Manual folds could archive before a durable commit, Anthropic native editing had no session-stable rejection fallback, and desktop maintenance receipts could surface stale or untranslated state.
Fix:
- converge strict-role pressure handling and explicit range compression on the projection CAS transaction
- persist generation, hashes, receipts, archives, and native/local context-editing lineage
- allow one pre-success Anthropic native rejection fallback, then lock the session request shape
- avoid duplicate Guardian maintenance epochs and fence stale desktop metadata/balance reads
- localize context-maintenance notices and expose projected/canonical maintenance state
Verification:
go test ./... -count=1
go test -race ./internal/agent ./internal/guardian ./internal/provider/anthropic ./internal/control -count=1
go test ./internal/agent -run TestIssue7935Maintains206ToolResultsOnceAndOnlyProcessesNewTail -count=10
cd desktop && go test ./... -count=1
cd desktop/frontend && pnpm test && pnpm build && pnpm test:typecheck
./scripts/cache-guard.sh
go vet ./...
golangci-lint run ./...
go run ./tools/repolint
Three branches needing three different kinds of work — a logic fix, a half-up
rounding fix, and a manifest regenerated by reading both packages. No bulk
transformation solves them, which is the one shape where delegation has a
theoretical case, and the reason the earlier migration lost so badly.
The first repetition read 1.42x, the closest delegation has come. Two more
repetitions put it at 3.73x and 2.43x, mean 2.41x tokens and 3.65x wall over
identical work with a 100% success rate in both arms. The neutral arm's own
spread across those three runs was 8-37%, so the first reading was a favourable
draw rather than a narrowing — which is exactly what the recorded noise floor
predicted and why it is worth having.
The forced arm's spread was roughly twice the neutral arm's, so delegation buys
variance as well as cost.
SPEC 3.17 now records the four measured task shapes, since a result this
consistent is more useful to the next reader than the counters alone.
Fixture note: the reference fix for the rounding branch was wrong on the first
attempt because Python's round() is banker's rounding, so 1250 stayed 1.2k. The
task keeps that trap deliberately — the docstring says half up — but it is a
reminder that a fixture is only verified when both directions are run.
Three packages, 36 files, 2736 lines, one signature change touching 108 call
sites, non-overlapping write paths. This is the branch size the earlier
measurement said delegation would need, since one child run costs six figures of
tokens before it produces anything.
It still loses, and for a more interesting reason than overhead. Neutral prompt:
28s, 12 tool calls, one file read — the agent wrote a script and applied the
change in bulk. Forced fleet: 116s, 87 tool calls, 78 of them in three children
editing their twelve files each. 2.6x tokens, 3.4x cost, 4.1x wall clock, same
result.
Delegation did not merely add overhead here; it prevented the better algorithm.
The task looks parallel-shaped, so splitting it by package hides the fact that
one bulk transformation solves all three at once. No branch can see a global
optimisation that spans the branches.
Both seeds were checked to fail unfixed and pass fixed before use. The first
checker was wrong in a way worth recording: it called every callable in each
module, including the fmt_amount imported into the namespace, so every arm would
have failed and produced confident garbage. Verifying the fixture in both
directions is what caught it.
The measurement gave the existing shadow admission gate something to act on.
It already gated `research` on local-fix turns, from a finding that one call
cost 65% of the worst task's wall clock. The same shape now covers task, fleet
and explore, because forcing delegation on identical work cost 2-4x the tokens
and wall clock with no change in outcome.
It stays shadow-only. Two tasks are enough to gate a tool for observation, not
enough to block a call a user asked for, and the existing design already says
observe first.
The benchmark now also prints what one child run costs before it has produced
anything — 103k tokens on a real run. That is the number a delegation decision
actually turns on: work whose branch is smaller than that cannot pay for the
agent doing it, whatever the orchestration around it looks like.
The existing admission test pinned "research only" and used `task` as its
negative case. It now asserts both are audited while keeping what it was really
protecting: a non-delegation tool is never audited.
Four tasks: two whose structure rewards delegation with a neutral prompt, and
two forced twins that differ only in telling the agent to delegate. Same
workdir, same checks, so the pair prices delegation on identical work instead of
comparing different work. Both seeds were confirmed to fail unfixed and pass
fixed before either was used.
The existing subagent-delegation task mandates delegation in its prompt, which
tests the plumbing rather than the value: a single-agent arm cannot comply, so
it loses by the rules rather than on the merits. The neutral tasks exist so an
arm that declines to delegate is only penalised by the clock.
Running them found the instrument under-counting. A fleet item runs under a
sink built by subSinkFor, which was a bare event.FuncSink; optional sink
capabilities are forwarded by method, so every delegation audit a fleet or
parallel_tasks child produced was swallowed at the nesting boundary. The forced
fleet task burned 3.8x the tokens of the neutral one and still reported zero
child runs. subSinkFor now returns a type that forwards the audits, and the
same task reports 3 child runs doing 71% of the tool calls.
This is the third instance of one contract implemented at many wrappers and
missed at one. The guard added earlier covers the session chain but not this
nesting sink, which is a fair argument that the pattern wants a shared embedded
forwarder rather than more guards.
Running the fixed control produced a clean negative result worth writing down
so the next person does not read a single run as evidence.
Same arm, same six tasks, twice: per-task token use moved by a median of 19%
and as much as 54%. The whole between-arm difference in the same experiment was
2.5%, and five of the six tasks saw no delegation in either arm, so what the
comparison mostly measured was run-to-run variance.
SPEC 3.17 now states that alongside the counters, together with the two ways to
get a real answer: enough repetitions to clear the variance, or restricting the
comparison to tasks where subagent_runs shows delegation actually happened.
Measuring the arm showed it was not one: a `no-subagent` run still spent a
child run on `explore`, because the ablation removed task, read_only_task,
fleet and parallel_tasks while leaving runAs=subagent profile skills — reached
through run_skill or the dedicated explore/research/review wrappers — running.
Every comparison against that arm was therefore delegated-versus-delegated.
Delegation is delegation whichever tool reaches it, so the arm now gates the
skill runners as well and stops registering the wrapper tools, which also keeps
their schemas out of the control run's prefix. Inline playbooks are untouched:
they never spawn a child, and ablating "subagent" should not disable a
checklist.
Verified against the provider: the same task that previously reported one child
run under the arm now reports subagent_runs=0 and "solved by a single agent".
This changes what the no-subagent arm means, so figures from it are not
comparable with baselines recorded before this commit. That is the point — the
older ones were measuring something else.
The gate lives in its own file rather than inline, because the guard would
otherwise have been duplicated across the two runners. Note for the next reader:
that file cannot be named *_arm.go — Go reads the suffix as GOARCH and silently
drops the file from the build.
Problem:
The PR adds durable context-maintenance semantics and an advanced native Anthropic opt-in that were not covered by the embedded guides.
Fix:
Document projection-based maintenance, durable blocked fingerprints, canonical transcript preservation, and the official-Anthropic-only context_editing setting in English and Chinese.
Verification:
- go test ./docs
- go run ./tools/repolint
- git diff --check
Problem:
Long sessions could repeatedly snip the same canonical tool results, retry failed summaries, and report misleading context state.
Root cause:
Preflight and post-turn compaction evolved separate views, while pruning rebuilt from canonical history instead of the installed projection. Failed view fingerprints and maintenance outcomes were not durable.
Fix:
Make ContextManager the single request-time owner, evolve projection-only views with CAS and v3 receipts, persist blocked fingerprints, add Anthropic native tool clearing capability gates, and expose current context composition separately from summary-call cost.
Verification:
- go test ./...
- go test -race ./internal/agent ./internal/provider/anthropic ./internal/control
- go vet ./...
- ./scripts/cache-guard.sh
- cd desktop/frontend && pnpm typecheck
- focused Desktop and frontend context contract tests
- go run ./tools/repolint