Repository navigation
feat: measure input normalization and repair ergonomics - #774
Merged
Merged
Conversation
This was referenced Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This branch turns WebCodex's existing lossless model-input normalization into measurable, privacy-bounded turn-economy evidence without adding new aliases or changing the model tool surface.
The branch was rebased onto current main before this independent review:
347aa42d2f0b12c39b60b5f424c417bdabdfbf62(perf(sessions): index recency and coalesce ordinary ledger writes #773)68b2276a1a0945851901bb4ca66b31084738a60dperf/input-normalization-telemetryCommits
90fd22df—refactor(contracts): centralize input normalization codesdbafe9bd—feat(telemetry): measure model input normalization68b2276a—feat(report): summarize input repair ergonomicsCanonical normalization vocabulary
A small
ToolInputNormalizationCodeenum now owns the existing four stable machine codes:argv_to_argsrun_process_sh_c_to_run_shellrun_process_bash_c_to_run_shellrun_process_bash_lc_to_login_run_shellIt provides exact
all(),as_str(),from_wire(), and model hint projection. Parser/runtime/schema consumers derive from this one closed vocabulary.Existing wire strings, hints, triggering rules, ambiguity rejection, authority, effect, retry, and execution semantics are unchanged.
No generic alias registry, fuzzy correction, new input alias, tool-name alias, or model-surface descriptor was added.
ModelErgonomics v13
Persisted model ergonomics advances from schema v12 to v13 with one optional bounded field:
{ "input_normalization_code": "argv_to_args" }The runtime captures the known normalization code before late model-result compaction and persists only the closed machine code.
It does not persist:
Unknown, malformed, failed, or absent normalization records do not produce the field.
API, MCP Direct, and Adaptive MCP Gateway integration coverage verifies one ActionAudit row per invocation and the same canonical normalization code across transports.
Offline input ergonomics report
scripts/agent_loop_report.pyadds an additiveinput_ergonomicssection derived from existing ActionAudit JSON only; no table or migration is added.It reports:
invalid_argumentsrejection counts by toolimmediate_same_tool_repair_proxyThe normalization-rate denominator is exactly:
Legacy v12 rows never silently become zero use. Unknown normalization codes fail rate availability closed instead of lowering the ratio.
The immediate same-tool proxy is intentionally descriptive only. It requires exact same Window + principal correlation, meaningful-call adjacency, non-streaming continuity, serial predecessor identity, and ordered request/handoff timestamps. It never skips an intervening meaningful call.
The report explicitly does not claim:
Missing continuity makes the proxy unavailable rather than zero; a proven subset remains exposed separately as observed evidence.
Naming / alias scope
This PR deliberately does not rename canonical tools or modify the frozen GPT Actions surface.
Input aliases remain ergonomic normalization only. Future aliases should require concrete evidence (dogfood repetition, a stable provider spelling, or another concrete consumer) and should be weighed against any additional descriptor bytes.
Independent review
The rebased
347aa42d..68b2276arange was independently reviewed after #773.Review focus:
No production correctness/privacy/reporting blocker was found, so no artificial review-fix commit was added.
One intentionally retained behavior: a call can pass through more than one mechanical normalization path, but the existing ToolResult contract records at most one normalization code using its pre-existing precedence. This PR measures that existing per-call contract rather than changing it into a multi-step normalization log.
Validation
Post-rebase review validation:
webcodex-tool-contracts: 257 passedwebcodex --lib: 3104 passed, 0 failed, 3 ignoredscripts.tests.test_agent_loop_report: 72 passedtools/listserialization budget: included in the full root library passcargo fmt --all -- --check: passedgit diff --check origin/main...HEAD: passedThe full root library run includes #773's Session recency/ledger changes.
The validation subsystem marked some concurrently-started focused Cargo runs as source-fence stale because they overlapped each other; their process/test outcomes were still successful. A subsequent full root library run also completed successfully with 3104 tests.
No full workspace/release/E2E run was performed.
No deployment or Server/Runner restart was performed.