Skip to content

fix(ingest): stop pydantic dropping the 0.6.0 MCP fields - #124

Merged
blitzcrieg1 merged 1 commit into
masterfrom
fix/ingest-drops-mcp-fields
Aug 26, 2026
Merged

blitzcrieg1 merged 1 commit into
masterfrom
fix/ingest-drops-mcp-fields

Conversation

@blitzcrieg1

Copy link
Copy Markdown
Owner

The 0.6.0 headline does not survive HTTP.

ExternalIngestBody declares schema_fingerprint and schema_tool_count. Pydantic ignores unknown keys silently, so everything else 0.6.0 added was POSTed by the proxy and thrown away at the ingest boundary:

schema_tool_digests    survives ingest: False
server_version         survives ingest: False
list_changed           survives ingest: False
initiator              survives ingest: False

So a schema move could only ever name the server, never the tool. The initialize handshake that separates a shipped release from a rug pull never reached the trail. And external.py:66 has read payload["initiator"] the whole time, so the consuming code was already there; the model hid the field before it ran.

Why the tests passed

They call _ingest_observed_schema(payload) with a dict and never cross the model. Unit tests of the function, not the transport.

Which is the same shape as the trait bug this repo already documents: tests that pass because they inject a field production events do not have.

This is the second time in this file

tool.traits and tool.mitre were dropped exactly this way, and it made hashed-only events invisible to every command-based sequence rule. The comment explaining that sits four lines above the fields this PR adds.

So the fix is not four more fields. tests/test_ingest_roundtrip.py builds payloads with the real proxy builders and fails if any key does not survive the model. A field added to a builder without being added to the model now fails in CI rather than shipping.

Opening initiator without reopening spoofing

actor_type is constrained to {human, agent, autonomous, system} and coerced down to agent, never up. human resets approval gates, and autonomous is what autonomous-unapproved-write keys on, so an unrecognised string must not land on either. A new surface adds its kind deliberately.

Identity is unchanged. host_id and fleet_id are still stamped by the receiving orchestrator, with a test pinning that a client cannot assert them.

Not in scope

autonomous-unapproved-write still cannot fire on IDE capture, because the hook path emits human, agent and system and never autonomous (zero occurrences in ~32k trail events). That rule lives in frozen files and needs its own decision.

1146 tests pass, ruff clean, ruleset fingerprint unchanged at 56ad3de1ad8533cf.

🤖 Generated with Claude Code

`ExternalIngestBody` declared `schema_fingerprint` and `schema_tool_count` and
nothing else from 0.6.0. Pydantic ignores unknown keys silently, so
`schema_tool_digests`, `server_version`, `list_changed` and `initiator` were
POSTed by the proxy and discarded at the HTTP boundary.

The whole 0.6.0 headline was false on the live path. A schema move could only
name the server, never the tool, and the initialize handshake that separates a
shipped release from a rug pull never reached the trail. `external.py` has read
`payload["initiator"]` the whole time; the model hid it before that code ran.

The unit tests passed because they call the ingest functions with a dict and
never cross the model. That is the same shape as the trait bug: green tests
over a field production does not have.

This is the second occurrence in this file. `tool.traits` and `tool.mitre` were
dropped the same way, which made hashed-only events invisible to every command
rule, and the comment explaining it is four lines above the fields I just
added. So the fix is not four more fields, it is a structural guard:
`test_ingest_roundtrip.py` builds payloads with the real proxy builders and
fails if any key does not survive the model.

`initiator` is opened with `actor_type` constrained to a known set, coerced
down to `agent` rather than up. `human` resets approval gates and `autonomous`
is what `autonomous-unapproved-write` keys on, so an unrecognised string must
not land on either. Identity is untouched: `host_id` and `fleet_id` are still
stamped by the receiving orchestrator, with a test pinning that a client cannot
assert them.

Ruleset fingerprint unchanged at 56ad3de1ad8533cf.

Co-Authored-By: Claude Opus 5 <[email protected]>
@blitzcrieg1
blitzcrieg1 merged commit d6cba36 into master Aug 26, 2026
9 checks passed
@blitzcrieg1
blitzcrieg1 deleted the fix/ingest-drops-mcp-fields branch August 26, 2026 20:05
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant