Skip to content

feat: measure input normalization and repair ergonomics - #774

Merged
yyjeqhc merged 3 commits into
mainfrom
perf/input-normalization-telemetry
Sep 29, 2026
Merged

yyjeqhc merged 3 commits into
mainfrom
perf/input-normalization-telemetry

Conversation

@swjnxyf

@swjnxyf swjnxyf commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

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:

Commits

  • 90fd22df — refactor(contracts): centralize input normalization codes
  • dbafe9bd — feat(telemetry): measure model input normalization
  • 68b2276a — feat(report): summarize input repair ergonomics

Canonical normalization vocabulary

A small ToolInputNormalizationCode enum now owns the existing four stable machine codes:

  • argv_to_args
  • run_process_sh_c_to_run_shell
  • run_process_bash_c_to_run_shell
  • run_process_bash_lc_to_login_run_shell

It 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:

  • raw args/argv
  • command/script text
  • cwd/path values
  • stdout/stderr
  • normalization hints
  • parser error text

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.py adds an additive input_ergonomics section derived from existing ActionAudit JSON only; no table or migration is added.

It reports:

  • normalization event counts by code and tool
  • invalid_arguments rejection counts by tool
  • measured/eligible/legacy/missing coverage
  • normalization rate with explicit denominator
  • an immediate_same_tool_repair_proxy

The normalization-rate denominator is exactly:

successful canonical ModelErgonomics v13+ records

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:

  • model-turn identity
  • causal repair
  • field-spelling cause
  • saved model turns

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..68b2276a range was independently reviewed after #773.

Review focus:

  • single-source closed normalization vocabulary
  • preservation of existing normalization precedence/wire strings
  • late-projection capture correctness
  • telemetry privacy and schema-version handling
  • API/MCP/Gateway ActionAudit behavior
  • report denominator and legacy coverage
  • exact continuity boundaries for the same-tool repair proxy
  • no causal/model-turn overclaim
  • post-perf(sessions): index recency and coalesce ordinary ledger writes #773 integration

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 passed
  • webcodex --lib: 3104 passed, 0 failed, 3 ignored
  • model ergonomics focused: 46 passed
  • Python scripts.tests.test_agent_loop_report: 72 passed
  • MCP tools/list serialization budget: included in the full root library pass
  • cargo fmt --all -- --check: passed
  • git diff --check origin/main...HEAD: passed

The 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants