@staix/agent-hub 0.35.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/README.md +25 -4
- package/THIRD_PARTY_NOTICES.md +0 -18
- package/docs/agent-notes/README.md +71 -1
- package/docs/agent-notes/adapters.md +5 -2
- package/docs/agent-notes/bus.md +1 -0
- package/docs/agent-notes/daemon.md +7 -6
- package/docs/agent-notes/local-worker.md +1 -0
- package/docs/agent-notes/models.md +5 -3
- package/docs/agent-notes/tasks.md +9 -2
- package/docs/agent-notes/tests.md +1 -1
- package/docs/contracts/companion-cli-v1.json +70 -0
- package/docs/design/adapters.md +115 -2
- package/docs/design/agent-hub-architecture.md +10 -2
- package/docs/design/bus.md +8 -0
- package/docs/design/execution-reference.md +171 -11
- package/docs/design/guidance-experiments.md +438 -0
- package/docs/design/guidance-probes.md +802 -0
- package/docs/design/model-routes.md +1053 -0
- package/docs/design/supervision.md +121 -0
- package/docs/design/task-board.md +111 -0
- package/docs/dogfood.md +24 -15
- package/docs/events.md +20 -1
- package/docs/memory.md +3 -3
- package/docs/operations.md +366 -133
- package/docs/profiles.md +2 -2
- package/docs/quickstart.md +114 -3
- package/docs/research.md +5 -3
- package/docs/sdlc.md +113 -7
- package/docs/security.md +88 -6
- package/docs/specs/2026-09-19-agent-hub-design.md +14 -11
- package/docs/specs/2026-10-04-switchyard-source-port-design.md +3 -1
- package/docs/verification/2026-10-25-qwen-dual-output-t0.md +22 -0
- package/docs/verification/2026-11-08-qwen-0269-model-setter-1317.md +25 -11
- package/docs/verification/2026-11-09-qwen-0270-acp.md +181 -0
- package/docs/verification/2026-11-09-qwen-0270-model-setter-1317.md +61 -0
- package/docs/verification/2026-11-10-0.36.0.md +59 -0
- package/docs/verification/2026-11-10-claude-implementer-2.1.322.md +59 -0
- package/docs/verification/2026-11-10-qwen-0270-dual-output.md +367 -0
- package/docs/verification/2026-11-10-qwen-0271-dual-output.md +101 -0
- package/docs/verification/2026-11-11-0.37.0.md +40 -0
- package/docs/verification/2026-11-11-guidance-probe-t2-1226.md +153 -0
- package/docs/verification/2026-11-11-qwen-setter-suggestions-off.md +167 -0
- package/docs/verification/claude-shell-wrapper-native.py +1 -1
- package/docs/verified.json +27 -27
- package/package.json +3 -4
- package/plugins/agent-hub/.claude-plugin/plugin.json +1 -1
- package/plugins/agent-hub/kimi-hook.js +3570 -1800
- package/plugins/agent-hub/server.js +4112 -1913
- package/src/adapters/channel-peer.ts +7 -1
- package/src/adapters/claude-channel.ts +7 -4
- package/src/adapters/compat.ts +10 -10
- package/src/adapters/local-probe.ts +174 -0
- package/src/adapters/local-worker.ts +233 -22
- package/src/adapters/qwen-dual.ts +324 -44
- package/src/cli/console-state.ts +25 -6
- package/src/cli/console-versions.ts +99 -0
- package/src/cli/console.ts +13 -1
- package/src/cli/guidance.ts +67 -0
- package/src/cli/help.ts +12 -4
- package/src/cli/identity.ts +10 -3
- package/src/cli/init-prompt.ts +15 -2
- package/src/cli/init-required-checks.ts +122 -0
- package/src/cli/init-settings.ts +10 -4
- package/src/cli/init.ts +39 -3
- package/src/cli/install-paths.ts +7 -2
- package/src/cli/lineage.ts +78 -0
- package/src/cli/main.ts +171 -14
- package/src/cli/runtime-version-warning.ts +2 -2
- package/src/cli/sdlc-output.ts +9 -5
- package/src/cli/setup-research.ts +10 -0
- package/src/hub/autonomy-defaults.ts +20 -9
- package/src/hub/board.ts +346 -4
- package/src/hub/build-entry.ts +11 -0
- package/src/hub/bus.ts +12 -0
- package/src/hub/ci-watch.ts +4 -4
- package/src/hub/config-apply.ts +6 -3
- package/src/hub/config-trust.ts +7 -1
- package/src/hub/control-client.ts +5 -2
- package/src/hub/daemon.ts +508 -26
- package/src/hub/delivery-hints.ts +4 -2
- package/src/hub/delivery-journal.ts +50 -2
- package/src/hub/delivery-public.ts +51 -0
- package/src/hub/dogfood-profile.ts +8 -4
- package/src/hub/events.ts +3 -2
- package/src/hub/execution-lineage-owner.ts +272 -0
- package/src/hub/execution-lineage.ts +52 -8
- package/src/hub/execution-links.ts +85 -0
- package/src/hub/guidance-probe-store.ts +713 -0
- package/src/hub/guidance-probes.ts +358 -0
- package/src/hub/guidance-variants.ts +398 -0
- package/src/hub/handoff.ts +1 -0
- package/src/hub/hub-tools.ts +43 -2
- package/src/hub/inference.ts +18 -5
- package/src/hub/manager.ts +44 -2
- package/src/hub/memory-policy.ts +2 -2
- package/src/hub/operational-authority.ts +13 -1
- package/src/hub/peers.ts +6 -1
- package/src/hub/planning.ts +1 -1
- package/src/hub/ports.ts +1 -1
- package/src/hub/progress.ts +47 -23
- package/src/hub/report.ts +2 -0
- package/src/hub/research.ts +1 -0
- package/src/hub/restart.ts +20 -0
- package/src/hub/roles.ts +26 -0
- package/src/hub/routing.ts +4 -1
- package/src/hub/sdlc-merge.ts +39 -1
- package/src/hub/sdlc-release-authorization.ts +139 -17
- package/src/hub/sdlc-release-policy.ts +100 -0
- package/src/hub/sdlc-release.ts +60 -8
- package/src/hub/sdlc.ts +62 -11
- package/src/hub/settings.ts +2 -0
- package/src/hub/supervision-proposals.ts +405 -0
- package/src/hub/supervision-rules.ts +388 -0
- package/src/hub/supervision.ts +2 -0
- package/src/hub/task-approval.ts +2 -2
- package/src/hub/task-repository.ts +5 -0
- package/src/hub/tasks.ts +917 -53
- package/src/local/probe-errors.ts +28 -0
- package/src/local/probe-sandbox.ts +224 -0
- package/src/local/probe-types.ts +108 -0
- package/src/local/probe-workspace.ts +237 -0
- package/src/local/sandbox.ts +71 -2
- package/src/local/tools.ts +135 -9
- package/src/memory/capture.ts +2 -2
- package/src/models/relay.ts +9 -2
- package/src/models/route/advisor-trigger.ts +88 -0
- package/src/models/route/config.ts +39 -8
- package/src/models/route/conversation-view.ts +179 -0
- package/src/models/route/decision-evidence.ts +1 -1
- package/src/models/route/decision.ts +193 -26
- package/src/models/route/escalation-control.ts +30 -0
- package/src/models/route/hub-prompts.ts +97 -0
- package/src/models/route/judge-choice.ts +155 -0
- package/src/models/route/judge-replies.ts +102 -0
- package/src/models/route/labels.ts +14 -70
- package/src/models/route/observation-signals.ts +250 -0
- package/src/models/route/plan-execute-choice.ts +27 -0
- package/src/models/route/relay-selector.ts +10 -9
- package/src/models/route/runtime.ts +129 -60
- package/src/models/route/stage-diagnostics.ts +22 -0
- package/src/models/route/stage-evidence.ts +55 -0
- package/src/models/route/stage-fallback.ts +58 -0
- package/src/models/route/stage-input.ts +155 -0
- package/src/models/route/stage.ts +5 -147
- package/src/models/route/turn-state.ts +77 -0
- package/src/omniroute/client.ts +3 -0
- package/src/ui/guidance-panel.ts +156 -0
- package/src/ui/guidance-view.ts +43 -0
- package/src/ui/lineage-view.ts +34 -0
- package/src/ui/plugin.ts +141 -27
- package/src/version.ts +4 -0
- package/templates/adec/README.md +32 -0
- package/templates/adec/ahub.plan-execute.json +23 -0
- package/templates/adec/ahub.stage.json +23 -0
- package/LICENSES/Apache-2.0.txt +0 -204
- package/src/models/route/advisor.ts +0 -102
- package/src/models/route/escalation.ts +0 -82
- package/src/models/route/judge.ts +0 -23
- package/src/models/route/normalize.ts +0 -103
- package/src/models/route/plan-execute.ts +0 -52
- package/src/models/route/prompts.ts +0 -8
- package/src/models/route/signals.ts +0 -247
- package/src/models/route/state.ts +0 -54
- package/src/models/route/text.ts +0 -61
|
@@ -0,0 +1,1053 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: model-routes
|
|
3
|
+
type: module
|
|
4
|
+
title: Hub Model Routes
|
|
5
|
+
status: draft
|
|
6
|
+
parent: agent-hub-architecture
|
|
7
|
+
paths:
|
|
8
|
+
- src/models/route/**
|
|
9
|
+
- src/models/relay.ts
|
|
10
|
+
- src/hub/progress.ts
|
|
11
|
+
- test/model-stage-input.test.ts
|
|
12
|
+
- test/model-stage-diagnostics.test.ts
|
|
13
|
+
- test/model-stage-evidence.test.ts
|
|
14
|
+
- test/model-stage-fallback.test.ts
|
|
15
|
+
- test/fixtures/model-stage-sizing-v1.json
|
|
16
|
+
- test/progress.test.ts
|
|
17
|
+
- src/hub/inference.ts
|
|
18
|
+
- templates/adec/**
|
|
19
|
+
- test/model-advisor-trigger.test.ts
|
|
20
|
+
- test/model-conversation-view.test.ts
|
|
21
|
+
- test/model-escalation-control.test.ts
|
|
22
|
+
- test/model-hub-prompts.test.ts
|
|
23
|
+
- test/model-judge-replies.test.ts
|
|
24
|
+
- test/model-plan-execute-choice.test.ts
|
|
25
|
+
- test/model-turn-state.test.ts
|
|
26
|
+
- test/model-observation-signals.test.ts
|
|
27
|
+
- test/model-judge-choice.test.ts
|
|
28
|
+
- test/model-route-event-parity.test.ts
|
|
29
|
+
- test/benchmarks/model-routing-gate.test.ts
|
|
30
|
+
- test/model-route-scope-lifetime.test.ts
|
|
31
|
+
- test/model-route-public-api-scalars.test.ts
|
|
32
|
+
- test/fixtures/model-route-public-api-scalars-v1.json
|
|
33
|
+
- test/route-stage-classifier.test.ts
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
# Hub Model Routes
|
|
37
|
+
|
|
38
|
+
This document defines agent-hub's replacement route design for issue #1352. Its
|
|
39
|
+
inputs are the project's configuration, operational contracts and nonported
|
|
40
|
+
consumers. It is a newly authored rewrite. R1 covers
|
|
41
|
+
stage evidence and deterministic fallback; R2 owns the remaining route decisions
|
|
42
|
+
and judge/prompt replacement; R3 retires the derived modules, their upstream
|
|
43
|
+
checker and the corresponding Apache license/notice. The unrelated Tabler Icons
|
|
44
|
+
notice remains in the package.
|
|
45
|
+
|
|
46
|
+
**Review basis:** the recorded R1 contract review for issue #1352 accepted the
|
|
47
|
+
ownership split, packet bounds and numerical contract. The sizing
|
|
48
|
+
characterization and conservative arithmetic were approved, and the task path
|
|
49
|
+
plan was expanded before new unit/consumer/test edits. Source, test and spec
|
|
50
|
+
review preceded commits and remote checks. The four fresh units and approved
|
|
51
|
+
consumer wiring implement this contract; validation conclusions remain bound
|
|
52
|
+
to their exact-head receipts. Accepted design choices are not measurements of
|
|
53
|
+
implementation equivalence or runtime behavior.
|
|
54
|
+
|
|
55
|
+
## R3 retirement
|
|
56
|
+
|
|
57
|
+
The active route implementation uses the owned `stage-*`, `turn-state`,
|
|
58
|
+
`conversation-view`, `observation-signals`, `escalation-control`,
|
|
59
|
+
`advisor-trigger`, `plan-execute-choice`, `judge-choice`, `judge-replies` and
|
|
60
|
+
`hub-prompts` modules. R3 removes the replaced source-port modules and their
|
|
61
|
+
ported vector suites, the upstream checker, and the corresponding Apache
|
|
62
|
+
license/notice. The owned `stage.ts` compatibility re-export remains.
|
|
63
|
+
`RESERVED_SIDECAR = 3` keeps the unused port offset stable; no listener is added.
|
|
64
|
+
The Tabler Icons notice remains packaged. This retirement changes no routing
|
|
65
|
+
behavior, configuration grammar or generic decision-evidence v1 payload.
|
|
66
|
+
|
|
67
|
+
## Decision ownership
|
|
68
|
+
|
|
69
|
+
| Question | Owner | R1 status |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| Which eligible model and reasoning effort should serve a stage or plan/execute request? | adec's configured policy, candidate constraints, pins and decider | Existing optional consumer for `decision`; S2 asks the stage question only inside the ambiguity band (below); plan/execute choice stays future |
|
|
72
|
+
| Which model/effort should serve an optional judge choice? | adec where separately configured, with an in-house fallback | R2 question design and wiring; no R1 judge request |
|
|
73
|
+
| Whether to escalate, request an advisor review, or issue redo feedback | Hub route policy | Preserve the caller boundary; implementation replacement belongs to R2 |
|
|
74
|
+
| Whether a task is PII and which peer receives it | PII screen and pure `assign()` | Outside model-choice routing; no adec delegation |
|
|
75
|
+
| Which deterministic tier remains when no applicable service choice is applied? | Hub fallback | R1 pure, model-free implementation |
|
|
76
|
+
| Whether a turn may execute, use a tool, cross a privacy boundary or spend budget | Current host admission | A route score or service proposal grants no authority |
|
|
77
|
+
|
|
78
|
+
The active `decision` configuration supports `decision_backend = "adec"` and
|
|
79
|
+
`decision_mode = "off" | "shadow"`, default off. `enforce` remains a load-time
|
|
80
|
+
refusal naming the #554 follow-up. Shadow preserves the exact fallback model,
|
|
81
|
+
effort and forwarded conversation. This is separate from `stay_switch`, whose
|
|
82
|
+
existing off/shadow/enforce behavior remains supported. R1 adds no service-call
|
|
83
|
+
path, classifier option, gateway effort application, service launch or credential
|
|
84
|
+
reader. #554 S2 adds the opt-in stage classifier option and its ambiguity band
|
|
85
|
+
below; judge/plan-execute choice questions require later reviewed wiring (R2).
|
|
86
|
+
|
|
87
|
+
## Route contracts and compatibility
|
|
88
|
+
|
|
89
|
+
The slice references below record the R1/R2 ownership split. R2 now supplies
|
|
90
|
+
the owned host decision and judge implementations; R3 removes their replaced
|
|
91
|
+
source-port counterparts.
|
|
92
|
+
|
|
93
|
+
- `stage` produces stage evidence, a deterministic efficient/capable fallback and
|
|
94
|
+
the existing session-aware switch plan. With `classifier = "decision"` it may
|
|
95
|
+
also ask adec, and only when its own score sits in the ambiguity band; the
|
|
96
|
+
answer is recorded and never replaces the fallback tier.
|
|
97
|
+
- `decision` currently uses the same fallback while optionally recording an adec
|
|
98
|
+
proposal through the existing #813 consumer. A failed request, abstention,
|
|
99
|
+
`no_candidate`, invalid pair or unavailable service leaves that fallback.
|
|
100
|
+
- `plan_execute` retains its documented capable planning and efficient execution
|
|
101
|
+
boundary after the first mutation. Its replacement and optional adec question
|
|
102
|
+
belong to R2.
|
|
103
|
+
- `advisor` retains bounded APPROVE/REDO review of eligible no-tool answers;
|
|
104
|
+
`escalation` retains efficient start and same-category confirmation before a
|
|
105
|
+
capable latch. Their triggers, parsing, prompts and judge backoff belong to R2.
|
|
106
|
+
- Explicit model overrides and class fixed-model selections bypass routes as
|
|
107
|
+
before. A missing/retired route keeps the configured fixed-model fallback and
|
|
108
|
+
existing diagnostics. Loading configuration never rewrites operator files.
|
|
109
|
+
|
|
110
|
+
Keep the current configuration keys: route `type`, `efficient`, `capable`,
|
|
111
|
+
`judge`, `confidence_threshold`, `hold_turns`, advisor/escalation settings, the
|
|
112
|
+
existing adec endpoint/policy/candidate/timeout keys and the S2 stage
|
|
113
|
+
`classifier` / `ambiguous_band`. Default stage configuration
|
|
114
|
+
remains efficient `fast`, capable `coding`, confidence threshold 0.5 and hold 2.
|
|
115
|
+
Candidate aliases/efforts remain constrained by the existing route parser and
|
|
116
|
+
response allowlist; R1 does not create a new policy alias. Doctor and
|
|
117
|
+
`ahub route explain` keep their existing fields and pure peer-assignment meaning.
|
|
118
|
+
|
|
119
|
+
Existing owned relay, local-worker, decision-route and doctor integration
|
|
120
|
+
expectations remain acceptance evidence. A discovered observable difference is
|
|
121
|
+
reported for an explicit spec/CHANGELOG decision before implementation proceeds;
|
|
122
|
+
a new scoring formula alone is not proof of compatible tier decisions. Old
|
|
123
|
+
source-port vectors are not an implementation or test oracle for this rewrite.
|
|
124
|
+
|
|
125
|
+
## Two separate evidence payloads
|
|
126
|
+
|
|
127
|
+
### Generic decision evidence, unchanged
|
|
128
|
+
|
|
129
|
+
The existing `buildDecisionEvidence(messages, dimensions, publicText)` function
|
|
130
|
+
and its #813 tests remain unchanged. Its version-1 `routing-decision-evidence`
|
|
131
|
+
JSON retains four finite dimensions, bounded screened public user/assistant/tool
|
|
132
|
+
fragments and screened tool identifiers. Its 8 KiB total cap, whole-source
|
|
133
|
+
screen-before-cut rule, 64 KiB source ceiling, per-fragment caps and recent-tool
|
|
134
|
+
limits remain its own contract. It never includes full history, system/developer
|
|
135
|
+
instructions or tool arguments. R1 does not silently replace this payload or add
|
|
136
|
+
new stage fields to it.
|
|
137
|
+
|
|
138
|
+
### Stage evidence, newly authored
|
|
139
|
+
|
|
140
|
+
A separate pure builder produces `StageEvidence` for deterministic fallback and
|
|
141
|
+
future stage-specific adec questions. This packet contains only closed numeric,
|
|
142
|
+
boolean and categorical data. It contains no source fragments, transcript,
|
|
143
|
+
command, tool argument, path, tool name, diagnostic text or service error prose.
|
|
144
|
+
It is not sent through the generic decision route by this delivery.
|
|
145
|
+
|
|
146
|
+
Closed schema:
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
type StageTier = "efficient" | "capable";
|
|
150
|
+
type StageTurn = "user" | "tool_result" | "compaction" | "other";
|
|
151
|
+
type FaultClass = "none" | "reported" | "exception" | "critical";
|
|
152
|
+
interface StageEvidence {
|
|
153
|
+
schemaVersion: 1;
|
|
154
|
+
kind: "stage-route-evidence";
|
|
155
|
+
turn: StageTurn;
|
|
156
|
+
incomplete: boolean;
|
|
157
|
+
signals: {
|
|
158
|
+
results: number;
|
|
159
|
+
failures: number;
|
|
160
|
+
repeatedFailures: number;
|
|
161
|
+
reads: number;
|
|
162
|
+
mutations: number;
|
|
163
|
+
assistantTurns: number;
|
|
164
|
+
tests: "none" | "pass" | "fail" | "unknown";
|
|
165
|
+
fault: FaultClass;
|
|
166
|
+
};
|
|
167
|
+
dimensions: {
|
|
168
|
+
severity: number;
|
|
169
|
+
spinning: number;
|
|
170
|
+
exploring: number;
|
|
171
|
+
productionIntensity: number;
|
|
172
|
+
};
|
|
173
|
+
scores: { efficient: number; capable: number };
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
All dimensions/scores are finite numbers in [0, 1]. Counts describe only inspected
|
|
178
|
+
input, are nonnegative integers, and never imply a complete-history count.
|
|
179
|
+
The following inspection limits are accepted contract choices from review, not
|
|
180
|
+
implementation measurements or permission for an undocumented behavior change:
|
|
181
|
+
|
|
182
|
+
- Inspect the latest 64 messages and at most 16 completed tool results.
|
|
183
|
+
- Inspect at most 32 tool-call entries in total across that window, by bounded
|
|
184
|
+
array positions. A large `tool_calls` array does not permit a full traversal,
|
|
185
|
+
copy, reverse or sort before the cap is applied.
|
|
186
|
+
- Call/result identifiers are at most 128 UTF-8 bytes and tool-family names at
|
|
187
|
+
most 64 bytes. Match using a table of at most those 32 inspected calls and 16
|
|
188
|
+
results. Missing, duplicate, oversized or unrecognized associations remain
|
|
189
|
+
unassociated; no repeated search through older calls fills the gap.
|
|
190
|
+
- Text inspection has a 64 KiB aggregate UTF-8 budget across the capture and at
|
|
191
|
+
most 32 inspected text-part entries. Oversized/over-budget sources are omitted
|
|
192
|
+
before classification and mark the input incomplete. Neither nested content
|
|
193
|
+
arrays nor tool-call arrays can turn an output cap into unbounded inspection.
|
|
194
|
+
- A stage packet has at most 1024 serialized UTF-8 bytes. Counts reflect inspected
|
|
195
|
+
observations only. Malformed/over-cap input is incomplete or unavailable;
|
|
196
|
+
neither a source fragment nor an arbitrary property enters the packet.
|
|
197
|
+
Before service HTTP, measure the serialized non-generic numeric packet with
|
|
198
|
+
`Buffer.byteLength`; overflow is unavailable and sends no request. This is a
|
|
199
|
+
whole-packet refusal, not truncation, and does not change generic decision
|
|
200
|
+
evidence v1 or its separate 8 KiB contract.
|
|
201
|
+
|
|
202
|
+
The local input view is separate from provider transport. It captures supported
|
|
203
|
+
roles, call/result association, explicit outcome flags and bounded local text for
|
|
204
|
+
classification; it never mutates, trims, summarizes or replaces the forwarded
|
|
205
|
+
conversation. Tool arguments are opaque to the stage packet. Local-only
|
|
206
|
+
compatibility data needed by remaining R2 consumers is not part of this schema.
|
|
207
|
+
Local-only families include recognized reads, mutations, executions and unknown
|
|
208
|
+
actions. Execution recognizes only bounded names `bash` and `exec_command`; it
|
|
209
|
+
never inspects arguments. An associated result may carry its local assistant
|
|
210
|
+
frame index to count distinct assistant turns. Neither that index nor the
|
|
211
|
+
execution family adds a serialized StageEvidence field. The latest non-instruction
|
|
212
|
+
message fixes the current boundary: an assistant-only or invalid tail is `other`,
|
|
213
|
+
not an earlier tool result or user compaction. An invalid tail also marks input
|
|
214
|
+
incomplete; system/developer entries retain their instruction-skip semantics.
|
|
215
|
+
A diagnostic fingerprint may be used transiently to detect repetition; neither
|
|
216
|
+
its source text nor an unbounded fingerprint list is emitted. A later public
|
|
217
|
+
projection uses the closed packet above. A sensitive projection contains only
|
|
218
|
+
`schemaVersion`, `kind` and the four dimensions, with no turn category, counts,
|
|
219
|
+
scores or incomplete-history information; R1 creates no transport for either.
|
|
220
|
+
|
|
221
|
+
Reviewed classification contract:
|
|
222
|
+
|
|
223
|
+
- Count observations within the fixed recent-result window. Unknown tool
|
|
224
|
+
families remain unknown; source words are evidence, not authority.
|
|
225
|
+
- Explicit error outcomes and recognizable diagnostics determine a closed fault
|
|
226
|
+
class. Successful inspection output quoting an error does not by itself become
|
|
227
|
+
a critical failure. Execution results containing `segmentation fault` or
|
|
228
|
+
`out of memory` are critical even when the wire omits `is_error`. These phrases
|
|
229
|
+
do not turn an unflagged successful read into a failure; an explicitly flagged
|
|
230
|
+
read error remains a failure. Passing tests clear the corresponding current test-failure
|
|
231
|
+
evidence, while an unrelated failure is not erased. `signals.tests` is the test
|
|
232
|
+
outcome of the latest inspected completed result; a later ordinary read is
|
|
233
|
+
`none`. Chronological pass processing still clears retained test-category
|
|
234
|
+
failures at that position. A historical pass cannot reset a later compaction
|
|
235
|
+
hold.
|
|
236
|
+
- A repeated failure means at least two matching failed results in separate
|
|
237
|
+
observations. `repeatedFailures` is the largest matching group among retained
|
|
238
|
+
failures, including both observations, not every line of one diagnostic as a new
|
|
239
|
+
attempt. An unrelated success or a different failure does not erase that group;
|
|
240
|
+
a passing test clears only retained test-category failures. Retained groups
|
|
241
|
+
and `signals.fault` describe the inspected window, not a new failure on every
|
|
242
|
+
assessment. Failure-group spinning divides that largest group by the retained
|
|
243
|
+
failure count only while a failure is current at a tool-result boundary. A zero-failure pass summary stays successful unless an
|
|
244
|
+
explicit error outcome or a separate diagnostic establishes failure. Counted
|
|
245
|
+
zero-failure forms such as `0 tests failed` are excluded before fault detection.
|
|
246
|
+
An explicitly empty run (`0 passed, 0 failed`) is unknown test evidence, never
|
|
247
|
+
a passing recovery that clears retained failures. Recovery requires a positive
|
|
248
|
+
pass count, or an entire affirmative line matching `tests passed`,
|
|
249
|
+
`all tests pass` or `all tests passed` (singular `test` is also accepted), with only
|
|
250
|
+
surrounding horizontal whitespace and an optional final `.` or `!`. Substring
|
|
251
|
+
matches, negated statements and additional prose do not establish an
|
|
252
|
+
unqualified pass. This is a closed lexical grammar, not a language inference.
|
|
253
|
+
- Active severity maps the latest completed diagnostic to `0/0.3/0.7/1` at a
|
|
254
|
+
current tool-result boundary; user, compaction and other boundaries have no
|
|
255
|
+
newly completed failure. `signals.fault` remains the retained-window maximum.
|
|
256
|
+
Exploring and production intensity remain inspected read/mutation proportions;
|
|
257
|
+
empty denominators yield zero, not NaN.
|
|
258
|
+
- A consecutive streak of eight successful executions across at least eight
|
|
259
|
+
distinct associated assistant turns, without a read or mutation, contributes
|
|
260
|
+
ambiguous spinning 0.46 at a tool-result boundary. A genuine pass, failure,
|
|
261
|
+
read, mutation or unknown family breaks the streak. The local assistant-frame
|
|
262
|
+
count prevents one batched call from manufacturing eight turns. The calibration
|
|
263
|
+
values 0.46 and eight come from the owned benchmark note and corpus, not the
|
|
264
|
+
former implementation: owned #637 corpus rule
|
|
265
|
+
`stage-spinning-below-threshold-stays-efficient` and the
|
|
266
|
+
[model-routing promotion note](../agent-notes/benchmarks.md#model-routing-promotion-rule-637-part-2).
|
|
267
|
+
- The fallback risk score is `max(severity, spinning)`; capable score is
|
|
268
|
+
that value and efficient score is its complement. Read/mutation dimensions are
|
|
269
|
+
retained as evidence for future adec questions, not a second hidden tier picker.
|
|
270
|
+
|
|
271
|
+
Review accepted the bound and score contract above. If retaining an owned
|
|
272
|
+
integration expectation requires a different rule, the contract records that
|
|
273
|
+
choice before code/tests are authored; no undocumented recalibration is accepted
|
|
274
|
+
as an implementation detail.
|
|
275
|
+
|
|
276
|
+
## Deterministic fallback and session switching
|
|
277
|
+
|
|
278
|
+
Pure API, with state explicit and no I/O:
|
|
279
|
+
|
|
280
|
+
```ts
|
|
281
|
+
interface FallbackStagePolicy {
|
|
282
|
+
confidenceThreshold?: number;
|
|
283
|
+
holdTurns?: number;
|
|
284
|
+
ambiguousBand?: number;
|
|
285
|
+
}
|
|
286
|
+
interface FallbackStageState { recoveryHoldRemaining: number }
|
|
287
|
+
interface FallbackStageResult {
|
|
288
|
+
tier: StageTier;
|
|
289
|
+
source: "default" | "dimensions" | "override" | "hold";
|
|
290
|
+
score: number;
|
|
291
|
+
state: FallbackStageState;
|
|
292
|
+
}
|
|
293
|
+
captureStageInput(source: unknown): StageInput | undefined;
|
|
294
|
+
buildStageEvidence(input: StageInput): StageEvidence;
|
|
295
|
+
selectFallbackStage(
|
|
296
|
+
evidence: StageEvidence,
|
|
297
|
+
policy?: FallbackStagePolicy,
|
|
298
|
+
state?: FallbackStageState,
|
|
299
|
+
): FallbackStageResult;
|
|
300
|
+
ambiguousStage(
|
|
301
|
+
result: FallbackStageResult,
|
|
302
|
+
policy?: FallbackStagePolicy,
|
|
303
|
+
): boolean;
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Omitted fallback policy fields use the existing confidence 0.5 and hold 2
|
|
307
|
+
defaults; an omitted policy is the same convenience. This changes no serialized
|
|
308
|
+
evidence field or configuration grammar. `ambiguousBand` belongs to the
|
|
309
|
+
question trigger below, not to the tier picker.
|
|
310
|
+
|
|
311
|
+
`StageInput` is a local-only bounded view, not a service DTO. Capture accepts the
|
|
312
|
+
existing message-array and relay-body-with-messages forms; unsupported source
|
|
313
|
+
shapes return unavailable without mutating them. The `confidence_threshold` and
|
|
314
|
+
`hold_turns` configuration keys map to the new policy names. An omitted state
|
|
315
|
+
starts with zero residual recovery hold. The source category is translated only to the
|
|
316
|
+
existing route-event categories above. Secondary exports for token estimation
|
|
317
|
+
and stay/switch planning retain the argument/return boundary exercised by their
|
|
318
|
+
nonported consumers, with newly authored internals; their compatibility
|
|
319
|
+
facade and wiring were pinned in the plan after contract review.
|
|
320
|
+
|
|
321
|
+
The result carries the tier, finite scalar score, a closed reason/source and a new
|
|
322
|
+
state. The builder/selector call no model, service, clock, process, file or global
|
|
323
|
+
session store. A caller retains state per route/session/configuration; another
|
|
324
|
+
session cannot inherit a hold, and a configuration change resets that state.
|
|
325
|
+
|
|
326
|
+
Fallback priority is explicit compaction, a current critical failure or an
|
|
327
|
+
active retained repeated-failure group, then residual configured recovery hold,
|
|
328
|
+
then a score above `confidence_threshold`, then an efficient default. A clean
|
|
329
|
+
step consumes residual hold rather than rearming an old group. Only a genuine
|
|
330
|
+
pass at the current tool-result boundary releases residual hold; retained
|
|
331
|
+
unrelated diagnostics remain, and a historical pass on a user, compaction or
|
|
332
|
+
other boundary never releases it. Equality/insufficient evidence uses the
|
|
333
|
+
declared default; no classifier runs inside the selector. Invalid input cannot
|
|
334
|
+
invent an alias or defeat the host's ordinary fixed fallback.
|
|
335
|
+
|
|
336
|
+
The effective enforced hold has a user-turn boundary floor: recovery remains
|
|
337
|
+
pinned through the tool loop until the next user boundary, and `hold_turns` can
|
|
338
|
+
extend it past that boundary. It is not a promise of exactly two following model
|
|
339
|
+
calls. The fallback's residual hold and the switch planner's session pin remain
|
|
340
|
+
separate; off/shadow preserve the owned recorded fallback decisions even when
|
|
341
|
+
the shadow plan would stay. Passing-test recovery and session isolation keep
|
|
342
|
+
their owned consumer expectations. This preserves the distinction between a
|
|
343
|
+
fallback proposal and the effective enforced backend.
|
|
344
|
+
|
|
345
|
+
Keep the existing switch contract: off and shadow do not change the fallback
|
|
346
|
+
choice; shadow adds only a proposed trace. Enforced stay/switch permits recovery
|
|
347
|
+
at once, holds a tool-result loop on its pinned tier, and considers other tier
|
|
348
|
+
changes at a user/compaction boundary. A downgrade over the configured prefill
|
|
349
|
+
bound stays pinned. A tier whose backend cannot fit the whole conversation is
|
|
350
|
+
not selected. The existing default prefill limit remains 32000. Sensitive turns
|
|
351
|
+
have no text-size-based switch bound and omit `prefillTokens` from events.
|
|
352
|
+
|
|
353
|
+
The input-token estimate remains an estimate used by existing context admission,
|
|
354
|
+
not a tokenizer claim. It covers the whole forwarded conversation and tool
|
|
355
|
+
schemas; the bounded recent stage view is never substituted as a full-context
|
|
356
|
+
size. An incomplete inspection cannot masquerade as a smaller complete input.
|
|
357
|
+
Its compatibility behavior and supported message/tool shapes must be pinned from
|
|
358
|
+
owned caller expectations before replacement; no route gains permission to trim
|
|
359
|
+
input or silently reduce output headroom.
|
|
360
|
+
|
|
361
|
+
### Ambiguity band, the question trigger (S2)
|
|
362
|
+
|
|
363
|
+
`ambiguousStage` answers one question: may this stage route ask the service at
|
|
364
|
+
all? It is `abs(score - confidenceThreshold) <= band`, with
|
|
365
|
+
`confidenceThreshold` defaulting to 0.5 and `AMBIGUOUS_BAND_DEFAULT` 0.05
|
|
366
|
+
(`AMBIGUOUS_BAND_MAX` 0.5 for the `ambiguous_band` key). At the default
|
|
367
|
+
threshold the owned repeated-execution reading 0.46 lies four hundredths inside
|
|
368
|
+
the band, while a reported failure 0.3 and an exception or critical failure 0.7
|
|
369
|
+
and 1 lie two tenths or more outside, so the default asks only for the
|
|
370
|
+
indecisive middle. A band outside `[0, 0.5]` and a non-finite threshold or band
|
|
371
|
+
are never ambiguous: an invalid value can only reduce asking, never invent one.
|
|
372
|
+
`ambiguous_band = 0` asks nothing, and `0.5` covers the whole score range at the
|
|
373
|
+
default threshold.
|
|
374
|
+
|
|
375
|
+
Membership is the whole of the band's effect. It never changes the fallback
|
|
376
|
+
tier, the fallback state or the source category, and the answer is recorded as
|
|
377
|
+
the route event's decision fields while the heuristic's model, effort and
|
|
378
|
+
forwarded conversation stand. The key is accepted only with
|
|
379
|
+
`classifier = "decision"`, whose one value is `"decision"`; a `stage` route
|
|
380
|
+
without it has no classifier and builds no service payload. The question offers
|
|
381
|
+
exactly the route's two tiers, since a tier carries no effort: `efficient` and
|
|
382
|
+
`capable` with effort `none`, the heuristic's own tier sent as `current`. One
|
|
383
|
+
question is asked per user turn, reused through the tool loop and dropped at the
|
|
384
|
+
turn's end.
|
|
385
|
+
|
|
386
|
+
The question carries R1's own closed `stage-route-evidence` packet
|
|
387
|
+
(`schemaVersion`, `kind`, `turn`, `incomplete`, `signals`, `dimensions`,
|
|
388
|
+
`scores`), never the generic `routing-decision-evidence` v1 projection, whose
|
|
389
|
+
quoted conversation fragments that contract does not allow; a PII or private
|
|
390
|
+
turn carries the `sensitiveStageEvidence` view of `schemaVersion`, `kind` and
|
|
391
|
+
`dimensions` only. The per-turn reuse keeps the privacy and observer facts an
|
|
392
|
+
answer was computed under: a later call republishes the held answer only while
|
|
393
|
+
those facts still hold, drops it when they change, and lets an unreadable
|
|
394
|
+
authority read propagate as `DecisionPolicyChangedError`.
|
|
395
|
+
|
|
396
|
+
### Secondary API pins
|
|
397
|
+
|
|
398
|
+
The new units define the public compatibility types/functions; `stage.ts` becomes
|
|
399
|
+
a freshly authored re-export facade, containing no former implementation body.
|
|
400
|
+
In particular `CodingAgentDimensions` is defined in `stage-evidence.ts` with the
|
|
401
|
+
four existing numeric fields, and `estimateInputTokens` is an export of the new
|
|
402
|
+
input-sizing unit. The generic v1 builder/test imports keep their existing path
|
|
403
|
+
and behavior; the freshly authored facade remains an owned compatibility API.
|
|
404
|
+
R3 removes derived implementations and migrates remaining type-only consumers
|
|
405
|
+
to owned types without changing generic v1 evidence bytes.
|
|
406
|
+
|
|
407
|
+
```ts
|
|
408
|
+
type StaySwitchMode = "off" | "shadow" | "enforce";
|
|
409
|
+
interface StaySwitchPolicy {
|
|
410
|
+
stay_switch: StaySwitchMode;
|
|
411
|
+
max_switch_prefill_tokens: number;
|
|
412
|
+
}
|
|
413
|
+
type StageSwitchReason = "new_pin" | "compaction" | "context_fit" |
|
|
414
|
+
"same_tier" | "override" | "tool_loop" | "prefill_bound" | "user_turn";
|
|
415
|
+
interface StageSwitchTrace {
|
|
416
|
+
turnType?: Exclude<StageTurn, "other">;
|
|
417
|
+
prefillTokens?: number;
|
|
418
|
+
staySwitch?: "shadow" | "enforce";
|
|
419
|
+
plan?: "stay" | "switch";
|
|
420
|
+
reason?: StageSwitchReason;
|
|
421
|
+
}
|
|
422
|
+
interface StageSwitchResult {
|
|
423
|
+
tier: StageTier;
|
|
424
|
+
pin: StageTier | undefined;
|
|
425
|
+
trace: StageSwitchTrace;
|
|
426
|
+
}
|
|
427
|
+
estimateStageInputTokens(
|
|
428
|
+
messages: readonly unknown[], tools?: readonly unknown[],
|
|
429
|
+
): number | undefined;
|
|
430
|
+
planStageSwitch(
|
|
431
|
+
policy: StaySwitchPolicy | undefined,
|
|
432
|
+
pin: StageTier | undefined,
|
|
433
|
+
fallback: FallbackStageResult,
|
|
434
|
+
turn: StageTurn,
|
|
435
|
+
admission: { inputTokens?: number; fits(tier: StageTier): boolean },
|
|
436
|
+
): StageSwitchResult;
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
`DEFAULT_STAY_SWITCH` remains shadow with a 32000 prefill bound. Configuration
|
|
440
|
+
continues to reject unknown modes, nonpositive bounds and misplaced nested
|
|
441
|
+
keys. The eight reasons and five trace keys above are enumerated by
|
|
442
|
+
`docs/events.md`; no additional public reason is invented. Off emits turn type
|
|
443
|
+
and applicable public prefill only, omitting staySwitch/plan/reason. Shadow emits
|
|
444
|
+
the proposed trace without applying its tier. Enforce applies the existing
|
|
445
|
+
recovery/tool-loop/user-boundary rules. Fit remains the host's predicate; a fit
|
|
446
|
+
constraint can prevent an otherwise proposed tier. Unknown input does not gain a
|
|
447
|
+
new legacy trace turn category merely because the stage packet permits `other`.
|
|
448
|
+
|
|
449
|
+
The initial `new_pin` establishes the current tier and records `plan: "stay"`,
|
|
450
|
+
including sensitive routes; it is not a switch from an earlier tier.
|
|
451
|
+
The owned relay/runtime assertions pin initial `new_pin`, recovery `override`,
|
|
452
|
+
compaction, tool-loop stay, prefill-bound stay and user-turn switch. The event
|
|
453
|
+
contract additionally retains `same_tier` and `context_fit`; this audit does not
|
|
454
|
+
claim a new runtime observation of those branches. Relay/local traces share the
|
|
455
|
+
same estimator and planner. Sensitive planning omits input size and the prefill policy bound; local
|
|
456
|
+
capacity admission remains independent. Neither helper selects an alias, moves a
|
|
457
|
+
backend for load, applies effort or changes permission authority.
|
|
458
|
+
|
|
459
|
+
The sizing alias must use exactly the same computation for the supported owned
|
|
460
|
+
relay/context/decision shapes. Supported inputs include complete ChatMessage
|
|
461
|
+
arrays (string/null content and function-call/result metadata) and the published
|
|
462
|
+
JSON tool schemas. It returns a finite nonnegative integer for an available
|
|
463
|
+
estimate, covers the whole input, and never reports a partial recent-window
|
|
464
|
+
count. Unpinned shapes round up or conservatively overestimate. Overflow or an
|
|
465
|
+
unrepresentable input is explicitly unavailable, not zero, NaN or another small
|
|
466
|
+
count; a numeric compatibility call reports a closed sizing-unavailable failure
|
|
467
|
+
so the host can refuse capacity admission without disclosing source text.
|
|
468
|
+
|
|
469
|
+
The read-only helper audit found no independent nonported input-token forecast
|
|
470
|
+
in the examined OmniRoute client/usage, relay/MLX/Ollama, local and hub context/
|
|
471
|
+
usage helpers. `normalizeUsage` is post-request accounting and `contextHeadroom`
|
|
472
|
+
uses native occupancy; neither replaces an input forecast. Reuse the existing
|
|
473
|
+
`AutoRouteSelector` fit predicate, relay input-plus-requested-output admission
|
|
474
|
+
and `validateOllamaOptions` limits instead of duplicating their headroom policy.
|
|
475
|
+
|
|
476
|
+
### Whole-wire sizing arithmetic
|
|
477
|
+
|
|
478
|
+
Root accepted the single public-API observation and this newly authored,
|
|
479
|
+
conservative sizing rule under `41435398`:
|
|
480
|
+
|
|
481
|
+
- Form a local description containing the complete messages argument and, only
|
|
482
|
+
when provided, the complete tools argument. An undefined tools argument has no
|
|
483
|
+
tools field; an empty list remains present.
|
|
484
|
+
- Use ordinary compact JSON escaping for that description and count the UTF-8
|
|
485
|
+
bytes of the whole representation. Count all message/call/result and schema
|
|
486
|
+
data needed by that representation, not the bounded recent StageInput view.
|
|
487
|
+
- One forecast unit covers four encoded bytes; any remainder rounds upward.
|
|
488
|
+
This is a conservative input estimate, not provider tokenization or billable
|
|
489
|
+
usage. The same function supplies relay, context and decision callers.
|
|
490
|
+
- Supported inputs are plain JSON-compatible message/tool data. Cycles,
|
|
491
|
+
executable accessors/custom serialization, unsupported values, unsafe counts
|
|
492
|
+
or resource/serialization overflow are unavailable. Never return a small
|
|
493
|
+
partial count. The physical sizer uses the existing relay's 2,000,000-byte wire
|
|
494
|
+
ceiling as an overflow bound, independently of the 64 KiB stage-feature cap.
|
|
495
|
+
- `estimateStageInputTokens` returns a finite nonnegative integer or unavailable;
|
|
496
|
+
its numeric `estimateInputTokens` compatibility export reports a closed
|
|
497
|
+
sizing-unavailable failure instead of passing a fabricated number into an
|
|
498
|
+
unchanged consumer. Existing host fit/output-headroom guards stay authoritative.
|
|
499
|
+
|
|
500
|
+
On the 24 newly authored fixtures, this rule equals 23 observed scalars and gives
|
|
501
|
+
39 for the Unicode fixture whose former public API returned 27. Every result is
|
|
502
|
+
at least the observed value. This Unicode conservatism is intentional: capacity
|
|
503
|
+
fallback/refusal or a prefill-bound stay may happen earlier than with the former
|
|
504
|
+
approximation, without dropping or modifying input. Record that difference in
|
|
505
|
+
CHANGELOG. No unique absolute-count pin was found in the inspected owned caller
|
|
506
|
+
assertions; their fit outcomes and relay/local equality still remain authority.
|
|
507
|
+
A later discovered owned absolute pin must be preserved explicitly.
|
|
508
|
+
|
|
509
|
+
## Host route policies and model-choice observation (R2)
|
|
510
|
+
|
|
511
|
+
This section defines the R2 integration contract for review before shared wiring.
|
|
512
|
+
The self-contained helpers and focused receipts are separate from acceptance of
|
|
513
|
+
that integration. It adds no permission to consult the protected route bodies,
|
|
514
|
+
source-port vectors or `src/hub/ports.ts`. R1's four stage units are owned inputs;
|
|
515
|
+
R3 retires the derived implementations, provenance checker and corresponding
|
|
516
|
+
license/notice, and preserves reserved port offset 3 under a neutral name.
|
|
517
|
+
|
|
518
|
+
### Configuration and service ownership
|
|
519
|
+
|
|
520
|
+
Use the existing top-level `decision_backend`, `decision_mode`, `policy_id`,
|
|
521
|
+
`adec_endpoint`, `candidates` and `decision_timeout_ms` keys. A `plan_execute`
|
|
522
|
+
route with a valid optional service binding asks the phase-model question; an
|
|
523
|
+
`advisor` or `escalation` route with a valid binding asks the judge-model question.
|
|
524
|
+
An ordinary route without that binding keeps its host policy. No `judge_choice`
|
|
525
|
+
block or other TOML key is introduced. Service fields that are present must form
|
|
526
|
+
a valid binding rather than being silently ignored. Every supported choice path
|
|
527
|
+
defaults off, accepts shadow and refuses enforce at load with the #554 follow-up.
|
|
528
|
+
|
|
529
|
+
One common service validator checks the existing backend/mode, bounded policy
|
|
530
|
+
identifier, numeric-loopback `/v1/route` endpoint, timeout and alias/effort options.
|
|
531
|
+
The S2 stage classifier, tier offerings, ambiguity band/defaults and stage-specific
|
|
532
|
+
validation retain their existing behavior. It does not turn into the phase or
|
|
533
|
+
judge route. The memo purposes are `stage`, `decision`, `phase` and `judge`,
|
|
534
|
+
separated by purpose, route, scope, configuration and opaque user turn. S2's
|
|
535
|
+
one-stage-question-per-turn held answer remains its own contract. Phase/judge
|
|
536
|
+
observation does not cache a valid pair as applied host authority; the service
|
|
537
|
+
rechecks its own pins and hard rules.
|
|
538
|
+
|
|
539
|
+
All these questions use policy-backed `POST /v1/route`. No generic ask or
|
|
540
|
+
System One shortcut is added. The host owns whether to review/escalate,
|
|
541
|
+
APPROVE/REDO, feedback, PII screening and peer assignment. A configured service
|
|
542
|
+
chooses only eligible model/effort pairs; off/shadow leaves the actual fallback
|
|
543
|
+
model, effort and forwarded conversation unchanged. Explicit model overrides
|
|
544
|
+
continue to bypass optional choice. The two shipped policy examples are
|
|
545
|
+
`ahub.stage` and `ahub.plan-execute` under `templates/adec`; the person supplies
|
|
546
|
+
provider, aliases and residency and copies policies into their own adec home.
|
|
547
|
+
The hub neither reads nor writes that home or a provider key.
|
|
548
|
+
|
|
549
|
+
### Numeric question evidence
|
|
550
|
+
|
|
551
|
+
The proposed ordinary R2 packet is closed and contains no transcript or arguments:
|
|
552
|
+
|
|
553
|
+
```ts
|
|
554
|
+
type HostChoicePurpose = "plan_execute_model" |
|
|
555
|
+
"advisor_judge_model" | "escalation_judge_model";
|
|
556
|
+
interface HostChoiceEvidence {
|
|
557
|
+
schemaVersion: 1;
|
|
558
|
+
kind: "host-route-choice-evidence";
|
|
559
|
+
purpose: HostChoicePurpose;
|
|
560
|
+
phase?: "planning" | "executing"; // phase question only
|
|
561
|
+
stage: StageEvidence;
|
|
562
|
+
}
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
The entire serialized packet must fit 1024 UTF-8 bytes at the request boundary.
|
|
566
|
+
Overflow is unavailable and sends no HTTP; no fragment is silently removed to
|
|
567
|
+
make it fit. `phase` and `judge` are memo purposes, not additional request-wire
|
|
568
|
+
fields. A sensitive request retains only R1's `schemaVersion`, `kind` and four
|
|
569
|
+
dimensions, with contextTokens zero; purpose, phase, history counts and text size
|
|
570
|
+
are omitted from its evidence. The request's opaque hashed turn identity still
|
|
571
|
+
separates purposes. Generic #813 decision evidence v1 and its tests remain
|
|
572
|
+
unchanged, including their distinct bounded-fragment contract.
|
|
573
|
+
|
|
574
|
+
### Host state and completed mutation
|
|
575
|
+
|
|
576
|
+
`PlanPhase.observe(view, scope)` starts capable/planning and adds the newly
|
|
577
|
+
written planning instruction. An associated, individually complete, non-error
|
|
578
|
+
mutation result establishes efficient/executing for that scope. Explicit failed,
|
|
579
|
+
denied, refused or cancelled results do not prove success. This is protocol
|
|
580
|
+
completion evidence, not filesystem-effect attestation. A clipped old history
|
|
581
|
+
does not block a complete current mutation; clipped/unknown current text cannot
|
|
582
|
+
prove completion. Once established, the scope latch survives later partial views.
|
|
583
|
+
A fresh or unavailable no-mutation view remains planning, not presumed execution.
|
|
584
|
+
|
|
585
|
+
`captureRouteView` reuses R1 association and diagnostics and adds only a local
|
|
586
|
+
`sourceTextComplete` observation. It uses the same bounded positions before R1
|
|
587
|
+
capture, rejects proxies/accessors/inherited data, and aligns captured results by
|
|
588
|
+
chronological tool ordinal. An inspected malformed record can make the local view
|
|
589
|
+
unavailable; that is unknown evidence, not proof that no mutation happened.
|
|
590
|
+
No completeness bit or other field is added to the StageEvidence wire.
|
|
591
|
+
|
|
592
|
+
The generic `ScopeStore` intentionally uses explicit 512-entry/one-hour limits:
|
|
593
|
+
expiry is since the last successful get or set, so active scopes renew their
|
|
594
|
+
idle lifetime and preserve established latches, execution phase, advisor budgets
|
|
595
|
+
and stage holds. Reads also update LRU order. Undefined values refuse, and a
|
|
596
|
+
backward clock clears all retained state. Opaque
|
|
597
|
+
local keys have a new 4096-byte ceiling. These explicit defaults/expiry semantics
|
|
598
|
+
are declared choices where the former default/clock behavior was not observed;
|
|
599
|
+
they are not claims of measured equivalence and belong in CHANGELOG.
|
|
600
|
+
|
|
601
|
+
### Advisor and escalation authority
|
|
602
|
+
|
|
603
|
+
Advisor uses a separate 1024-entry FIFO budget ledger and 1024-scope FIFO stalled
|
|
604
|
+
set, not the generic ScopeStore. The `instance` budget entry is never evicted.
|
|
605
|
+
A pending reservation is charged immediately; success keeps the charge, failure
|
|
606
|
+
refunds one and increments failures. Omitted review budget is one, and three
|
|
607
|
+
failed reviews block further review. Check budget before either trigger.
|
|
608
|
+
|
|
609
|
+
The ordinary primary trigger is a terminal no-tool answer with at least the
|
|
610
|
+
configured completed tool-result count (omitted minimum zero). The pattern primary
|
|
611
|
+
uses the configured Unicode regular expression instead. Assistant-message count
|
|
612
|
+
supplies stall turns. Omitted/zero stall is disabled; a positive threshold offers
|
|
613
|
+
a checkpoint at or above that count only when the scope is not already stalled.
|
|
614
|
+
Only a stall without a simultaneous primary marks the checkpoint. Success does
|
|
615
|
+
not rearm it. Failure settlement, budget-refused reservation and explicit eviction
|
|
616
|
+
clear the checkpoint. Automatic budget eviction deletes only its ledger entry;
|
|
617
|
+
the stalled set keeps its separate FIFO lifetime.
|
|
618
|
+
|
|
619
|
+
The capacity correction is intentional: only inserting a new key into a full
|
|
620
|
+
ledger trims that ledger. Same-key updates and unrelated-ledger operations cannot
|
|
621
|
+
evict charged reviews or rearm stalled scopes. Record this difference in CHANGELOG.
|
|
622
|
+
Escalation confirms two fresh same-category replies by default. Explicit old or
|
|
623
|
+
negative evidence breaks the streak, category change restarts it, unavailable
|
|
624
|
+
reply preserves it and an established latch remains set. Store no judge reason
|
|
625
|
+
in event or confirmation state. Runtime accepts only the checked reply parser's
|
|
626
|
+
output, never an assert-cast foreign verdict.
|
|
627
|
+
|
|
628
|
+
### Full local judge context and fresh prompt wording
|
|
629
|
+
|
|
630
|
+
`captureJudgeConversation` projects full inert native string/null messages,
|
|
631
|
+
function-call/result metadata, local opaque argument strings, instruction order,
|
|
632
|
+
assistant/tool counts and terminal-answer facts. It is separate from the recent
|
|
633
|
+
stage window and the service packet. It rejects malformed/explicitly unknown
|
|
634
|
+
fields instead of assembling partial judge context. The actual relay/local caller
|
|
635
|
+
must establish the supported native shape; unsupported formats are unavailable,
|
|
636
|
+
not blanket claims that every provider format is malformed. The existing 2M-byte
|
|
637
|
+
whole-wire ceiling applies before prompt construction and admits all valid
|
|
638
|
+
200000-codepoint cases. Getters, custom serialization and proxies do not execute.
|
|
639
|
+
|
|
640
|
+
Advisor transcript default is 200000 Unicode code points, with the existing
|
|
641
|
+
256..200000 validator. Serialize instructions first and messages next as JSON;
|
|
642
|
+
then retain floor(cap/4) points at the head and the remaining cap points at the
|
|
643
|
+
tail, separated by `\n...<middle of the conversation truncated>...\n`. The marker
|
|
644
|
+
is outside the cap. Only afterward append the latest-turn suffix without a byte
|
|
645
|
+
cut. Discarded telemetry counts code points. This preserves the recorded main
|
|
646
|
+
behavior rather than introducing a new transcript default. Advisor output is
|
|
647
|
+
2048 tokens; escalation output is 256. Its owned input window is the most recent
|
|
648
|
+
12 assistant turns with their following tool results, the closest preceding user
|
|
649
|
+
task, and system/developer instructions. Bound each serialized message to 1500
|
|
650
|
+
Unicode code points with an explicit middle-drop marker, then bound the assembled
|
|
651
|
+
transcript to 16000 code points including its middle-drop marker. Fixed prompt
|
|
652
|
+
and turn headers stay outside those bounds. Discarded telemetry counts omitted
|
|
653
|
+
original transcript code points, excluding inserted markers. These owned bounds
|
|
654
|
+
retain history for repetition/false-progress assessment while limiting one large
|
|
655
|
+
result's share; they provide no live quality or eight-second latency guarantee. Surrounding planning,
|
|
656
|
+
review, escalation and redo prompt wording is newly written; the owned caller's
|
|
657
|
+
short `senior reviewer` feedback cue remains.
|
|
658
|
+
The fresh request bytes invalidate former live request digests for these prompts.
|
|
659
|
+
Keep historical receipts unchanged; the new prompt-quality live leg is manual
|
|
660
|
+
and UNRUN, without a model call or restamp. Model-free protocol tests do not
|
|
661
|
+
establish real-model judgement quality.
|
|
662
|
+
|
|
663
|
+
Reply parsing is anchored APPROVE/REDO after optional leading Markdown/quote
|
|
664
|
+
decoration and an optional `Verdict:` prefix, case-insensitive. Closing verdict
|
|
665
|
+
decoration is removed before REDO feedback. Arbitrary leading prose remains
|
|
666
|
+
unparsed. Escalation accepts one optionally JSON-fenced object with the documented
|
|
667
|
+
consumed fields and closed categories. Unused extra keys remain ignored as before;
|
|
668
|
+
surrounding commentary or multiple objects refuse. New accepted-data ceilings
|
|
669
|
+
are 64 KiB reply input and 4096 bytes local feedback/reason; oversized input is
|
|
670
|
+
unavailable, not a partial verdict. These safety ceilings are declared in
|
|
671
|
+
CHANGELOG rather than described as observed former defaults. No prompt, reason,
|
|
672
|
+
argument, diagnostic or native identifier enters the numeric service packet.
|
|
673
|
+
|
|
674
|
+
### Owned observation outcomes and existing progress fences
|
|
675
|
+
|
|
676
|
+
`observation-signals` follows the owned R1 evidence/diagnostic precedence and
|
|
677
|
+
shared critical predicate, not former signal tables or source-port fixtures.
|
|
678
|
+
A full outcome batch must not be reported as complete from the recent 16-result
|
|
679
|
+
stage window. Unknown/over-bound input stays unavailable and omits an unproven
|
|
680
|
+
`next` label rather than inventing an all-clear value. Local native projection
|
|
681
|
+
uses the existing 2M whole-wire ceiling; native progress retains its existing
|
|
682
|
+
28-observation/name-80/text-500/source-40/turn-120 caller bounds.
|
|
683
|
+
|
|
684
|
+
The local adapter has explicit per-result facts: `readOnly`, `nativeError`,
|
|
685
|
+
`assertionDiagnostic`, `testInvocation` and `testMention`, plus the owned
|
|
686
|
+
`diagnoseStageResult` result. Read-only classification includes the owned
|
|
687
|
+
`text_editor` operation `view`; command/argument inspection is bounded and local,
|
|
688
|
+
never part of StageEvidence or service evidence. A missing/ambiguous association
|
|
689
|
+
or malformed flags do not establish a qualified complete batch.
|
|
690
|
+
|
|
691
|
+
- A successful read/view creates no execution failure, test failure or digest.
|
|
692
|
+
It also does not clear prior qualified test failures.
|
|
693
|
+
- Otherwise the shared R1 critical classification has first priority (severity
|
|
694
|
+
1). An explicit native error, AssertionError diagnostic or R1 exception has
|
|
695
|
+
local label severity 0.7. Other reported diagnostics retain 0.3, except an
|
|
696
|
+
unflagged test-failure-only report without those stronger flags is test evidence
|
|
697
|
+
only, with label severity zero. This preserves the owned wrapped numeric-test
|
|
698
|
+
fixture containing `exit code 0` without treating that text as native exit
|
|
699
|
+
attestation. This label adapter does not change stage severity or scoring.
|
|
700
|
+
- A test context is an owned test-invocation name/command or an observed test
|
|
701
|
+
term. A qualified failure in that context is retained across the full batch;
|
|
702
|
+
an unrelated execution failure is retained separately. Process all results in
|
|
703
|
+
chronological order. Only a non-read, non-error genuine positive test pass
|
|
704
|
+
accepted by R1's closed grammar clears retained test-category failures, not
|
|
705
|
+
unrelated failures. A commandless result may also inherit a retained qualified
|
|
706
|
+
failure from the exact same declared tool/operation name, within this batch or
|
|
707
|
+
across consecutive decisions in the same tracker run. Its own result must pass
|
|
708
|
+
R1's closed positive-pass grammar, and this inherited pass clears only that
|
|
709
|
+
operation's qualified failures. No retained failure, a different operation or
|
|
710
|
+
an explicit non-test command supplies no inherited test context. This preserves
|
|
711
|
+
recovery labels without turning arbitrary numeric migration summaries into test
|
|
712
|
+
evidence. Numeric failure takes priority over a simultaneous positive pass
|
|
713
|
+
count. An empty zero/zero run creates no pass and clears no failure.
|
|
714
|
+
- The tracker's existing private prior-failure entries extend their digest with
|
|
715
|
+
a declared operation name only for qualified test failures. Names are bounded
|
|
716
|
+
to 256 UTF-8 bytes; an oversized/unavailable name cannot grant inherited context.
|
|
717
|
+
Entries retain the existing two-million-byte source admission and at most
|
|
718
|
+
`2000000 / 20` result-entry ceiling. The metadata has the existing decision/turn
|
|
719
|
+
lifetime and is removed when cleared or the turn ends. No arguments, result
|
|
720
|
+
text, diagnostic fingerprint, persisted state, configuration or event field is
|
|
721
|
+
added. Prior context only qualifies the new batch's observed pass; it does not
|
|
722
|
+
copy an earlier batch's severity into a later outcome.
|
|
723
|
+
- Retained qualified test failure means `tests: "fail"` even after later plain
|
|
724
|
+
read or `ok` results. With none retained, the latest genuine qualified test pass
|
|
725
|
+
means `pass`; a batch with no eligible test evidence means `none`. Ordinary rows
|
|
726
|
+
do not replace qualified test evidence. This is an explicit LOCAL divergence
|
|
727
|
+
from R1's `signals.tests`, which describes the latest inspected result.
|
|
728
|
+
- Retain only SHA256 digests of the owned R1 diagnostic fingerprint for qualified
|
|
729
|
+
failures. Diagnostic text and raw fingerprints are transient local values,
|
|
730
|
+
never state/event fields. Repetition still passes the existing separate native
|
|
731
|
+
cross-turn predicate before progress judging. No source-port calibration is
|
|
732
|
+
inferred from these owned fixtures.
|
|
733
|
+
|
|
734
|
+
The fresh local APIs are `ToolObservation` (name plus optional command/resultText/
|
|
735
|
+
isError/source), `projectOutcomeBatch(assistant, tools)`,
|
|
736
|
+
`priorFailureDigests(messages)`, `failureFingerprint(text, isError)` and
|
|
737
|
+
`repeatedObservationFailure(observations)`. A batch projection returns bounded
|
|
738
|
+
severity, pass/fail/none and failure digests, or unavailable. The runtime obtains
|
|
739
|
+
assistant count from its complete JudgeConversation and phase from PlanPhase;
|
|
740
|
+
this is not a new general tier-picking ToolSignals formula.
|
|
741
|
+
|
|
742
|
+
Native `progressDimensions`, its eight-distinct-known-turn rule, cross-turn
|
|
743
|
+
failure predicate, attempted-frame deduplication, generation, owner/open-task and
|
|
744
|
+
privacy fences remain unchanged. Only owned observation/reply/type dependencies
|
|
745
|
+
migrate. Peer-reassignment advice remains a host inference purpose; this change
|
|
746
|
+
does not add an adec path to pure peer assignment or PII screening.
|
|
747
|
+
|
|
748
|
+
### Deadline, currentness and publication ceiling
|
|
749
|
+
|
|
750
|
+
For optional host judges, fallback has priority and does not wait for the shadow
|
|
751
|
+
model-choice answer. Priority means invoking the existing fallback execute port
|
|
752
|
+
before observer admission starts, after private common campus/currentness
|
|
753
|
+
preparation. The actual house quota transaction runs before that port's first
|
|
754
|
+
await; this does not attest downstream provider/GPU generation order or a custom
|
|
755
|
+
asynchronous host's physical admission. One absolute deadline covers common preparation and the judge/observation window;
|
|
756
|
+
there is no fresh timeout after a slow admission. The current common budget and
|
|
757
|
+
campus APIs cannot be cancelled: the deadline races them, it does not join them.
|
|
758
|
+
There is no strict physical eight-second completion or zero-pending-common-host
|
|
759
|
+
claim. Keep a `ponytail:` ceiling naming the optional abort/currentness API upgrade
|
|
760
|
+
if an actual hang is observed. No LocalWorker or OmniRoute API edit is part of
|
|
761
|
+
this approved choice. The separately owned `requestAdecRoute` observation is
|
|
762
|
+
aborted and joined when fallback finishes. A normal window close is not a failed
|
|
763
|
+
service memo or warning; actual failed transports keep bounded failure handling.
|
|
764
|
+
Cleanup always aborts the fallback signal even when observer close propagates an
|
|
765
|
+
authority or teardown error; preserving that error never skips the abort.
|
|
766
|
+
|
|
767
|
+
Re-read current actor/privacy/observer facts after awaits and before owned service
|
|
768
|
+
HTTP, metadata publication and feedback delivery. Changed/unavailable authority
|
|
769
|
+
propagates as `DecisionPolicyChangedError`; it is not converted into fallback or
|
|
770
|
+
swallowed as optional telemetry. Review/remote observer exclusion skips service,
|
|
771
|
+
and sensitive work requires positive campus admission. A client abort does not
|
|
772
|
+
prove the external service stopped provider generation.
|
|
773
|
+
|
|
774
|
+
The sole additional event field is `RouteEvent.decisionTarget?: "judge"`.
|
|
775
|
+
Absence preserves the executor event contract. A judge-choice observation uses a
|
|
776
|
+
separate existing `onRoute` callback: `tier` is the requested fallback judge
|
|
777
|
+
alias, `source` is `default`, and the remaining metadata uses existing checked
|
|
778
|
+
decision fields. It does not claim a served or applied model and adds no purpose
|
|
779
|
+
or phase field. Publication bypasses `addDecision` and the executor label path,
|
|
780
|
+
with no label, progress or usage credit. Off emits no observation. Recheck
|
|
781
|
+
privacy/currentness immediately before publication; sink failures stay optional,
|
|
782
|
+
but authority refusals are not swallowed as telemetry errors.
|
|
783
|
+
|
|
784
|
+
Before emission is enabled, executor consumers exclude `decisionTarget: "judge"`:
|
|
785
|
+
the report before timestamp/switch accounting, task research before generic
|
|
786
|
+
accumulation/peer involvement, and the owned routing corpus harness before its
|
|
787
|
+
last-executor-observation collector. This changes no corpus input, guard, expected
|
|
788
|
+
result or scoring. The raw research-quality `events.present` census remains a
|
|
789
|
+
truthful count of recorded event types, including metadata; it is not business
|
|
790
|
+
or executor credit. Token/cost and SDLC measures retain their separate inputs.
|
|
791
|
+
The closed operational projection already withholds the entire `route` kind,
|
|
792
|
+
while raw event export retains the target; this adds no console/display feature.
|
|
793
|
+
|
|
794
|
+
### Internal model-free lifecycle proof seams
|
|
795
|
+
|
|
796
|
+
An optional third `HubRouteRuntime` constructor proof port may receive
|
|
797
|
+
`choicePrepared(ready: Promise<void>)`. The promise is derived from the actual
|
|
798
|
+
owned observation result after selection settles; it exposes no choice data,
|
|
799
|
+
permission or cancel method, and readiness alone does not attest a valid choice.
|
|
800
|
+
The original result is still awaited and confirmed independently. Proof-sink
|
|
801
|
+
failure is isolated. With the port absent, no readiness promise is created.
|
|
802
|
+
There is no RouteHost, LocalWorker, OmniRoute, configuration or event-field change.
|
|
803
|
+
|
|
804
|
+
`ChoiceWindow.commonSettled` reports consumption of common preparation fulfillment
|
|
805
|
+
or rejection; close does not join it. This lets a controlled late-common test
|
|
806
|
+
release its host barrier and await consumption directly without elapsed-time
|
|
807
|
+
waits or guessed event-loop turns. The separately started owned HTTP task remains
|
|
808
|
+
the only abort-and-join claim.
|
|
809
|
+
|
|
810
|
+
The owned model-free routing harness has optional `beforeJudgeReply`,
|
|
811
|
+
`choicePrepared` and `observeRoute` proof ports. A value-only optional
|
|
812
|
+
`turnContext` binds one controlled fake logical user turn using the existing
|
|
813
|
+
trusted begin/end API, with end in finally. Its fixture must explicitly name the
|
|
814
|
+
owned loopback fake service endpoint, never an implicit default. Default absence
|
|
815
|
+
retains canonical missing-turn/no-HTTP behavior; no native/provider/person identity
|
|
816
|
+
or inferred multi-user lifecycle is introduced. The first pauses a scripted reply
|
|
817
|
+
only after execute arguments have been recorded; the last receives a detached,
|
|
818
|
+
frozen copy and has no return authority. An optional `observeExecute` read-only
|
|
819
|
+
tap similarly receives a detached/frozen snapshot of the actual requested model,
|
|
820
|
+
messages, judge flag and maxTokens arguments, never the signal. It is invoked
|
|
821
|
+
only when supplied, introduces no default clone/await/promise, and cannot alter
|
|
822
|
+
scripted replies or scoring. Exact host-input JSON bytes are compared, not
|
|
823
|
+
claimed as native/provider wire. The execute API has no effort argument, so no
|
|
824
|
+
effective/served effort value is invented. Absent ports introduce no new await or
|
|
825
|
+
readiness promise in canonical corpus execution. These ports do not change corpus
|
|
826
|
+
cases, expected outputs, splits, guards or scoring. Integration proof must still
|
|
827
|
+
show an actual judge-target event, off-mode absence and identical actual model,
|
|
828
|
+
input, judge-call count and last executor observation; a fulfilled void readiness
|
|
829
|
+
promise alone cannot satisfy it.
|
|
830
|
+
|
|
831
|
+
The test and report name is normalized event parity. In controlled judge-choice
|
|
832
|
+
off/shadow comparisons, executor events must be JSON-byte-identical after canonicalizing only `ms` and the opaque decision UUID
|
|
833
|
+
through a validated one-to-one mapping, with identical presence, count and type.
|
|
834
|
+
Every other field matches exactly. Actual execute model and input stay raw
|
|
835
|
+
byte-identical; the execute API exposes no effort argument to normalize or invent.
|
|
836
|
+
Judge observations are separate, one per admitted observation call and none when
|
|
837
|
+
off. No clock or UUID generation seam is added.
|
|
838
|
+
|
|
839
|
+
### R2 observation and inspection record
|
|
840
|
+
|
|
841
|
+
One approved public-API observation ran on committed baseline
|
|
842
|
+
`78891c179954f80adc90bec716f9f78107a2e872` with 24 newly authored synthetic cases,
|
|
843
|
+
no account/model/decider call, no dependency installation and scalar-only output.
|
|
844
|
+
The private guarded driver/fixture/command have distinct hashes; Git blob bindings
|
|
845
|
+
identify the opaque baseline APIs. All 24 scalar rows passed the closed collector;
|
|
846
|
+
network/process/server/output/write effect counters were zero, native-network and
|
|
847
|
+
owned-canary guard controls passed, source bindings matched before/after, and
|
|
848
|
+
owned stop/drains/temp cleanup succeeded. This is finite API evidence, not general
|
|
849
|
+
implementation equivalence, routing quality or live acceptance.
|
|
850
|
+
|
|
851
|
+
The committed fixture is `test/fixtures/model-route-public-api-scalars-v1.json`.
|
|
852
|
+
The exact argv is retained privately at workspace-relative
|
|
853
|
+
`scratchpad/temp/task856/public-api-scalars-v1/command.json`, SHA256
|
|
854
|
+
`43e1c7919945847f9d2859822901e42e6418f52488faa90417bacbd5f2395a4d`;
|
|
855
|
+
its raw result log SHA256 is
|
|
856
|
+
`e9790c07cae5e974cdc9695b08ecf7099bf72d2679a1a747bfc18078a57cb338`.
|
|
857
|
+
The fixture's redacted command shape is not executable; an exact-argv reference
|
|
858
|
+
requires that retained artifact, not an invented public reproducer. No additional
|
|
859
|
+
API probe, model call or TTL wait is implied.
|
|
860
|
+
|
|
861
|
+
On 2026-11-10 a conductor instruction mistakenly allowed AdvisorGate and text
|
|
862
|
+
helper reuse. The AdvisorGate class, one named stall test and the middleDrop
|
|
863
|
+
exported signature were read under that instruction. The helper body was not
|
|
864
|
+
read, and its temporary import was removed; truncation is newly authored from
|
|
865
|
+
the owner's literal behavior contract. The own advisor unit was written and
|
|
866
|
+
reviewed against that contract, including the later capacity correction, without
|
|
867
|
+
copying a ported function body. An earlier broad historical-doc search exposed
|
|
868
|
+
advisor behavior notes; review preparation also exposed limited excluded inventory
|
|
869
|
+
expression/key-pattern metadata after initial algorithm commits. These exposures
|
|
870
|
+
are recorded as process limits, not represented as unread history. No further
|
|
871
|
+
protected body, prompt, vector or ports read/import was authorized under R2.
|
|
872
|
+
This is a newly authored rewrite with explicit provenance. R3 removes the derived
|
|
873
|
+
implementations and their corresponding license/notice; this process record
|
|
874
|
+
remains historical evidence.
|
|
875
|
+
|
|
876
|
+
## Native progress projection, separate from stage selection
|
|
877
|
+
|
|
878
|
+
The nonported progress observer has a different public calibration from stage
|
|
879
|
+
routing. Its newly authored `progressDimensions(observations)` accepts the
|
|
880
|
+
observer's bounded native observations, not legacy ToolSignals or StageEvidence.
|
|
881
|
+
It inspects at most the existing latest 28 observations and bounded name/result/
|
|
882
|
+
native-turn fields; it does not inspect commands or tool arguments. It emits only
|
|
883
|
+
`severity`, `spinning`, `exploring` and `production`.
|
|
884
|
+
|
|
885
|
+
- An observed error has severity 0.7, including an AssertionError that stage
|
|
886
|
+
fallback treats as a reported failure. Stage scores do not recalibrate this
|
|
887
|
+
observer.
|
|
888
|
+
- Recognized reads and mutations contribute their proportions among inspected
|
|
889
|
+
observations. A completed Codex `fileChange` is mutation/production evidence.
|
|
890
|
+
- Spinning becomes 1 only after at least eight distinct known native turn IDs
|
|
891
|
+
with no observed mutation in the retained window; otherwise it is zero.
|
|
892
|
+
Missing IDs and repeated tool observations within one turn do not manufacture
|
|
893
|
+
separate attempts. Productive file changes do not become a spinning trigger.
|
|
894
|
+
- The existing repeated-failure-across-native-turns predicate remains separate.
|
|
895
|
+
Current privacy, open-task/owner, in-flight generation, latest-frame,
|
|
896
|
+
attempted-turn deduplication and judge/latch fences remain unchanged. A progress
|
|
897
|
+
dimension grants no execution, reassignment or model-routing authority.
|
|
898
|
+
|
|
899
|
+
This replacement removes the observer's dependency on the former stage helper.
|
|
900
|
+
At the R1 boundary, generic decision evidence v1 and the remaining legacy route
|
|
901
|
+
signal/judge code were unchanged. R2 supplies the owned signal/judge replacements;
|
|
902
|
+
R3 removes the replaced modules. Generic decision evidence v1 stays unchanged,
|
|
903
|
+
and the existing owned progress tests remain acceptance authority. The existing
|
|
904
|
+
progress observation type is exported as `NativeToolObservation`, including its
|
|
905
|
+
optional native `turn`, for host callers; this adds no runtime or event field.
|
|
906
|
+
|
|
907
|
+
## Privacy, authority and events
|
|
908
|
+
|
|
909
|
+
Off mode builds no service payload and sends no request. Local fallback features
|
|
910
|
+
may still be computed. Before any future stage service payload is built or sent,
|
|
911
|
+
the host must apply the current privacy/observer admission. Review-observer
|
|
912
|
+
exclusion and remote turns skip the service. PII/private evidence requires
|
|
913
|
+
positive `onCampus()` and remains dimensions only even on campus. The decider's
|
|
914
|
+
payload/constraints redact context size to zero and expose no stage counts or
|
|
915
|
+
text-size feature. That zero is a decider-payload privacy rule, not permission to
|
|
916
|
+
bypass existing local/backend context or requested-output headroom checks.
|
|
917
|
+
Physical fit admission still considers the whole actual input under its existing
|
|
918
|
+
host limits; neither the redacted zero nor a stage-window count is used to admit
|
|
919
|
+
an oversized request. The switch planner still omits the sensitive prefill-based
|
|
920
|
+
policy bound and trace as described above. Unknown/changed facts
|
|
921
|
+
refuse the stale turn, rather than becoming a service failure fallback. Recheck
|
|
922
|
+
admission, campus, request and metadata-emission awaits and the original turn
|
|
923
|
+
binding. A proposed pick grants no execution or release authority.
|
|
924
|
+
|
|
925
|
+
Keep current route-event keys and value categories: `route`, `tier`, `source`,
|
|
926
|
+
`score`, `ms`; optional decision/turn/task/PII linkage; four numeric dimensions;
|
|
927
|
+
existing stay/switch trace; existing decision-mode/alias/effort/margin/latency and
|
|
928
|
+
screened decider fields. `source` keeps its current override/dimensions/hold/
|
|
929
|
+
classifier/default/decision categories (relay reorder sources remain owned by
|
|
930
|
+
the relay). Add no text, arguments, prompt, credential, server error prose or new
|
|
931
|
+
unbounded diagnostic field. Labels and telemetry remain optional and cannot
|
|
932
|
+
change a route or turn through a sink failure.
|
|
933
|
+
|
|
934
|
+
The S2 stage question uses those fields and adds none. `source` already carries
|
|
935
|
+
the escalation judge's reclassification under `classifier`, so a stage answer
|
|
936
|
+
never sets it: the fallback's own category stands and the answer rides the
|
|
937
|
+
decision mode, alias, effort, margin, latency, reason and screened decider
|
|
938
|
+
fields. Shadow records and changes no tier; abstain, `no_candidate`, a transport
|
|
939
|
+
failure or timeout, `decision_mode = off` and an off-campus decider for a
|
|
940
|
+
PII/private turn each keep the fallback tier and record a closed reason. An
|
|
941
|
+
optional question cannot refuse a turn by itself: a service failure or an ended
|
|
942
|
+
turn records nothing to apply. Changed or unavailable privacy or observer
|
|
943
|
+
authority is not a service failure, so it keeps refusing the stale turn exactly
|
|
944
|
+
as on a `decision` route, never as a model fallback around that refusal.
|
|
945
|
+
|
|
946
|
+
## Bounded public sizing characterization
|
|
947
|
+
|
|
948
|
+
Conductor decision `41435398` permits one bounded, model-free, network-free and
|
|
949
|
+
account-free characterization of the public `estimateInputTokens` API. Inputs
|
|
950
|
+
are newly authored synthetic fixtures shaped by owned caller contracts; outputs
|
|
951
|
+
are scalar estimates only, including finite nonnegative fractional baseline
|
|
952
|
+
values. Integer/round-up requirements apply to the new estimator; a valid older
|
|
953
|
+
fraction is not discarded to make that requirement appear already satisfied.
|
|
954
|
+
The former implementation body, function text,
|
|
955
|
+
upstream vectors and error stacks are not inspected. This is public-API
|
|
956
|
+
observation for compatibility; it does not authorize reconstructing expressions
|
|
957
|
+
from source.
|
|
958
|
+
|
|
959
|
+
The reviewed preparation is under workspace-relative
|
|
960
|
+
`scratchpad/temp/task855/sizing-v1`. Root approved its corrected fixed command
|
|
961
|
+
before the one invocation. The baseline is committed code
|
|
962
|
+
at `2219e9dbd5861d87bc4bddbe857b3bbfd7a9a07c`, identified separately by its Git
|
|
963
|
+
tree/module blob. The new private driver, fixture and command have their own
|
|
964
|
+
hashes; the untracked contract document and private probe are not labelled as
|
|
965
|
+
verified code from that commit. No dependency installation is included.
|
|
966
|
+
|
|
967
|
+
The characterization used 24 fixtures (78803 JSON bytes, under a 128 KiB
|
|
968
|
+
bound), with an 8-second worker wall bound, 3-second CPU bound and 16 KiB closed
|
|
969
|
+
scalar-output bound. A private HOME/cache/cwd, empty npm configuration, no-auto-
|
|
970
|
+
install flag, kernel no-network/credential restrictions and transport/process/
|
|
971
|
+
output guards surround the import. An owned synthetic read-open canary is used;
|
|
972
|
+
no real credential file is read. Arbitrary stdout and all stderr/stacks are
|
|
973
|
+
excluded from the retained scalar record. The worker is addressed only through
|
|
974
|
+
its own created process handle, with bounded stop and source-binding checks.
|
|
975
|
+
Only the driver's own closed failure phase and optional authored fixture id
|
|
976
|
+
survive an unsuccessful response; error objects, prose and stacks do not.
|
|
977
|
+
The single invocation completed with exit 0, owned stop and drained output,
|
|
978
|
+
with all 24 finite nonnegative scalars accepted (fractional values were allowed).
|
|
979
|
+
Baseline/component bindings passed before and after. Observed baseline effect
|
|
980
|
+
counters were zero; guard and owned-canary controls passed. The result SHA-256 is
|
|
981
|
+
`d551376c2959c948792f34985c44fca5bb4c602c56062f6a1321919b5ee953e9`.
|
|
982
|
+
This is scalar API compatibility evidence, not routing-gain, model or account
|
|
983
|
+
proof.
|
|
984
|
+
|
|
985
|
+
This is a 24-scalar CPU-bounded probe, not a heavy gate. The Mac placement reason
|
|
986
|
+
is the Seatbelt no-network/real-home fence, with ordinary successful work expected
|
|
987
|
+
below the roughly four-second remote synchronization cost; that expectation is
|
|
988
|
+
not a timing measurement. If preparation indicates greater normal cost, a remote
|
|
989
|
+
alternative needs approval rather than an implicit local fallback. Actual local
|
|
990
|
+
invocation requires fresh complete resource/thermal/ownership admission.
|
|
991
|
+
|
|
992
|
+
The new estimator must be at least each observed scalar on every authored
|
|
993
|
+
fixture and exactly satisfy values pinned by owned tests. Unsupported/unpinned shapes round up or conservatively overestimate;
|
|
994
|
+
overflow remains unavailable. The arithmetic was written in our own words
|
|
995
|
+
before production implementation. The authored inputs and expected scalars are
|
|
996
|
+
committed as our fixture at `test/fixtures/model-stage-sizing-v1.json`. The PR
|
|
997
|
+
records that the former function was observed only through its public API.
|
|
998
|
+
No second characterization, model request or quiet/no-op follow-up is implied.
|
|
999
|
+
|
|
1000
|
+
## Historical R1 implementation and consumer map
|
|
1001
|
+
|
|
1002
|
+
This section records the R1 boundary before R2 replacement and R3 retirement.
|
|
1003
|
+
Fresh stage-only units were added under the reviewed task plan:
|
|
1004
|
+
|
|
1005
|
+
| Unit | Responsibility |
|
|
1006
|
+
| --- | --- |
|
|
1007
|
+
| `src/models/route/stage-input.ts` | Bounded local input capture, turn kind and token-estimate compatibility |
|
|
1008
|
+
| `src/models/route/stage-diagnostics.ts` | Own diagnostic classification and transient repetition keys |
|
|
1009
|
+
| `src/models/route/stage-evidence.ts` | Closed StageEvidence builder/validation and public numeric projection |
|
|
1010
|
+
| `src/models/route/stage-fallback.ts` | Pure fallback state and stay/switch planning |
|
|
1011
|
+
|
|
1012
|
+
The following API map comes from nonported consumer source, not the replaced
|
|
1013
|
+
implementations:
|
|
1014
|
+
|
|
1015
|
+
| Consumer | Existing boundary to preserve |
|
|
1016
|
+
| --- | --- |
|
|
1017
|
+
| `src/models/route/runtime.ts` | Stage state, tier/default/hold source, dimensions, token estimate and stay/switch result; R2 normalize/signal/review branches remain separately owned |
|
|
1018
|
+
| `src/models/route/relay-selector.ts` | Stage result, session pin, fit predicate, source mapping and switch trace; backend override/reorder remains outside fallback |
|
|
1019
|
+
| `src/models/relay.ts` | Token estimate and StaySwitchPolicy type; context/output headroom and fixed alias order remain unchanged |
|
|
1020
|
+
| `src/hub/routing.ts` | DEFAULT_STAY_SWITCH and StaySwitchMode imports; `assign()` and config grammar remain unchanged |
|
|
1021
|
+
| `src/adapters/local-worker.ts` | StaySwitchPolicy import; generic ToolObservation/research callback remains outside stage evidence |
|
|
1022
|
+
| `src/models/route/decision.ts` | Four dimensions and token estimate; generic #813 evidence/transport/privacy fences remain unchanged |
|
|
1023
|
+
| `src/models/route/decision-evidence.ts` | Four-dimension type dependency only; its function, payload and tests stay unchanged |
|
|
1024
|
+
| `src/models/route/labels.ts` / `src/hub/inference.ts` | Remaining generic normalization/signal/fingerprint or Conversation consumers; migration/compatibility needs separate path approval |
|
|
1025
|
+
|
|
1026
|
+
At R1, `parseAdvisorVerdict` and legacy `text.ts` remained R2 work. Generic
|
|
1027
|
+
normalization, signal/observation and outcome-label consumers still existed; R1
|
|
1028
|
+
did not remove those bodies by assuming the stage route was their only consumer.
|
|
1029
|
+
A small newly authored compatibility facade could retain an existing type/import
|
|
1030
|
+
boundary where required by unchanged consumers. A replaced stage-function file
|
|
1031
|
+
with no remaining consumer was removed without reading its removed body. The R1 PR listed retained
|
|
1032
|
+
R2/R3 source-port files; R1 did not remove licenses/notices or upstream tooling.
|
|
1033
|
+
R2 supplies the owned replacements and R3 retires the remaining derived modules
|
|
1034
|
+
and vectors without reading or copying their bodies. Nonported integration
|
|
1035
|
+
assertions remain in place, with owned type/import bindings where needed.
|
|
1036
|
+
|
|
1037
|
+
The precise new exports, compatibility facade and consumer wiring paths were
|
|
1038
|
+
pinned in the board plan before production edits. The own unit tests are
|
|
1039
|
+
`test/model-stage-input.test.ts`, `test/model-stage-diagnostics.test.ts`,
|
|
1040
|
+
`test/model-stage-evidence.test.ts` and `test/model-stage-fallback.test.ts`, with
|
|
1041
|
+
independently authored cases from this contract. Existing relay/local-worker/decision/doctor tests remain authority;
|
|
1042
|
+
no source-port golden cases are read or copied. Seed review uses id/path/test
|
|
1043
|
+
metadata only. Current route-directory seed count is zero; any consumer anchor
|
|
1044
|
+
that wiring touches is reviewed/rebound without weakening its named guard.
|
|
1045
|
+
|
|
1046
|
+
### Owned benchmark binding migration (R2)
|
|
1047
|
+
|
|
1048
|
+
The existing model-routing benchmark binds its prompt identities to the fresh
|
|
1049
|
+
exported host prompt constants. This is the R2 test-binding migration: assertions,
|
|
1050
|
+
corpus vectors, splits, guards, scores and thresholds remain unchanged. The receipt
|
|
1051
|
+
request builder captures the same completed advisor conversation and latest-turn
|
|
1052
|
+
suffix as the runtime, and preserves the public conversation-turn marker. This
|
|
1053
|
+
checks measurement fidelity; it supplies no live quality or promotion evidence.
|