codegen: fidelity gate reads the whole body; bound artifacts to engine ctx
The fidelity gate truncated the body to 4000 chars, so a body whose real
action sat after its helpers (the common shape) was judged on a prefix with
no action and wrongly returned `reconsider` -- a false reject that wasted a
rewrite and mislabeled a working skill. Live-engine probe: the truncated
state scored reconsider 0.96; the whole body scores accept 0.98.
- Fidelity gate: feed the whole body plus a deterministic operation
inventory and the de-identified goal; drop the raw request from the state
(a remote-engine PII path that added no signal). Ask the positive question
("is there a concrete operation that realizes the goal?") and give the gate
its own `codegen.fidelity.tau` instead of the run-assessment tau.
- Artifact size budget: a decision ingests a generated artifact whole, so
bound it. `parse_skill_body`/`parse_skill_test` reject an over-budget
artifact (`ArtifactTooLong`); the codegen retry ladder asks for a shorter
one. The ceiling derives from the active engine's context
(`DecisionEngine.context_tokens`: `engine.context_tokens` for the local
GGUF, `engine.winnow.context_tokens` for Winnow) minus
`codegen.decision_reserve_tokens`; `codegen.max_body_tokens` /
`max_test_tokens` override (separate limits).
- `codegen.operation_inventory()`: static HTTP-verb/path, CLI, mail, file,
and timer inventory, resolving the verb at the call site so a thin-helper
body's real endpoint is visible.
- Docs: AGENTS.md, README.md, CODEGEN.md, config.example.json.
- Tests: unit coverage for the budget, inventory, retry-shortening, and the
gate state; integration regression `test_fidelity_gate_reads_the_whole_body`
(real engine) guards the truncation bug.
This commit is contained in:
1 parent
1833932f1c
commit
9757ae893e
12 files changed
+527
-53
No files matched your search
@@ -34,6 +34,10 @@ class WinnowConfig:
|
||||
|
||||
base_url: str = "http://127.0.0.1:8091"
|
||||
model: str = "Winnow-12B"
|
||||
#: The server's decision context window (`--ctx-size`). Must mirror the
|
||||
#: running server; used to size generated skill bodies so a fidelity state
|
||||
#: always fits. The reference deployment runs `--ctx-size 32768`.
|
||||
context_tokens: int = 32768
|
||||
timeout: float = 120.0
|
||||
# Transient-failure retries before declaring the engine unavailable. 0 means
|
||||
# a single attempt: an unreachable remote engine is fatal by contract.
|
||||
@@ -59,6 +63,10 @@ class WinnowEngine(DecisionEngine):
|
||||
self._lock = threading.Lock()
|
||||
self._loaded = False
|
||||
|
||||
@property
|
||||
def context_tokens(self) -> int:
|
||||
return int(self.config.context_tokens or 32768)
|
||||
|
||||
@property
|
||||
def loaded(self) -> bool:
|
||||
return self._loaded
|
||||
|
||||
Reference in new issue
Block a user