Seam audit 2026-09-02: Gate-only ingress, SDK chassis default, CEG→Gate→EIE enrich - #259
Conversation
…IE egress Forensic seam audit repairs (CEG side of EIE <-> Gate <-> CEG): - engine/spec.yaml advertises only the CEG-owned, implemented, Gate-routable actions (match, sync, outcomes, resolve). The 23 unimplemented `graph-*` names are gone and `enrich` is never advertised: Gate owns that action name for EIE, and a CEG replica advertising it would collide on the same route. - chassis/entrypoint.py defaults to the SDK TransportPacket chassis; the legacy dict chassis (api-key auth, no Gate provenance) is a direct-ingress side door and is refused outside dev/local/test. require_sdk_chassis_in_prod now defaults to True. - engine/gate_egress.py is the only CEG -> peer egress: request_enrichment() asks Gate to run EIE's `enrich` with an EIE-shaped payload, one attempt, idempotency-keyed, fail closed when GATE_URL is unset. The ROI health trigger now actually dispatches through it instead of returning a payload it never sent. - Gate_SDK pinned to main a0827f2 (pyproject, requirements, poetry.lock via `poetry lock`, validate_sdk_pin); test fixtures updated for the pinned SDK. - docker-compose (dev + prod), Makefile, .env.template and the OpenAPI note select the SDK chassis, carry GATE_URL / registration / signing config, and drop `enrich` from L9_ALLOWED_ACTIONS. - tests/architecture/test_seam_gate_only.py locks all of the above. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179fXWHFZQcA47NMj11345X
The real-process seam E2E showed that with L9_REQUIRE_SIGNATURE=true every env-configured node rejected Gate's signed responses, because the SDK's get_gate_client_config_from_env() never loaded L9_VERIFYING_KEYS_JSON. Gate_SDK 69c6c67 (main a0827f2 + that fix) is the one revision the whole EIE <-> Gate <-> CEG rail now runs; poetry.lock regenerated with `poetry lock`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0179fXWHFZQcA47NMj11345X
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
📋 Best Practices for Large Changes
✅ This PR passes the blocking limit but is larger than recommended. |
L9 Audit Harness Report
Step Results
Architecture Audit Findings
See Spec Coverage
See Next StepsAll checks passed. Safe to merge. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38fc3defdc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🟡 Changes recommended
engine/gate_egress.py has concrete correctness/contract inconsistencies (idempotency normalization + entity field override risk) and several updated docs/help texts conflict with the actual allowed legacy env set.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR implements the 2026-09-02 seam audit outcomes by enforcing Gate-only ingress/egress boundaries for CEG: removing phantom advertised actions, making the SDK (TransportPacket) chassis the default (legacy allowed only in dev/local/test), and wiring the CEG → Gate → EIE enrich path through a single audited egress module.
Changes:
- Introduces
engine/gate_egress.pyand updates the health enrichment trigger to dispatchenrichvia Gate with fail-closed semantics. - Adds architecture/contract tests that lock seam invariants (advertised actions, chassis defaults, Gate-only egress/ingress, and no peer URL/raw HTTP).
- Updates deployment + dependency pinning to default to the SDK chassis and require Gate configuration in production.
File summaries
| File | Description |
|---|---|
| tests/unit/test_node_app.py | Updates SDK pin expectations around attachment/packet cap defaults. |
| tests/unit/test_gate_egress.py | Adds unit coverage for Gate-mediated enrich egress behavior and idempotency. |
| tests/contracts/test_chassis_parity.py | Extends contract tests for SDK default selection and stricter legacy refusal. |
| tests/architecture/test_seam_gate_only.py | Adds forensic seam guardrails across spec, code, env vars, and transport usage. |
| tests/architecture/init.py | Establishes tests/architecture as a test package. |
| scripts/validate_sdk_pin.py | Updates the SDK git pin validator to the new revision. |
| requirements.txt | Bumps constellation-node-sdk git pin. |
| pyproject.toml | Bumps constellation-node-sdk git pin (Poetry). |
| poetry.lock | Updates lockfile to reflect the new SDK revision and transitive dependency metadata. |
| Makefile | Defaults local run to SDK chassis; adds an explicit legacy target. |
| engine/spec.yaml | Replaces phantom graph-* advertised actions with implemented CEG-owned actions only. |
| engine/health/enrichment_trigger.py | Routes reenrichment triggering through engine.gate_egress.request_enrichment() and returns dispatch results. |
| engine/gate_egress.py | Adds the single permitted CEG→Gate egress API for requesting EIE-owned enrich. |
| engine/config/settings.py | Turns on require_sdk_chassis_in_prod by default to block legacy direct-ingress outside dev/local/test. |
| docs/contracts/api/openapi.yaml | Updates API contract docs to reflect chassis defaults and seam behavior. |
| docker-compose.yml | Switches local compose default to SDK chassis and Gate configuration; removes enrich from allowed actions. |
| docker-compose.prod.yml | Makes SDK chassis mandatory in prod and requires Gate + signing configuration (no defaults). |
| chassis/entrypoint.py | Sets SDK as the default chassis and restricts legacy chassis selection to dev/local/test when enforcement is enabled. |
| .env.template | Updates defaults and notes for SDK chassis + allowed actions consistent with seam ownership. |
Review details
Suppressed comments (1)
engine/gate_egress.py:81
enrichment_idempotency_key()hashestarget_fieldswithout the same normalization used bybuild_enrichment_request()(dedupe + drop empty). For example,['a']vs['a', '']produce different idempotency keys even though the request payload is identical, which undermines stable retries.
def enrichment_idempotency_key(tenant: str, entity_id: str, target_fields: Sequence[str]) -> str:
digest = hashlib.sha256("|".join([tenant, entity_id, *sorted(set(target_fields))]).encode("utf-8")).hexdigest()
return f"ceg:enrich:{tenant}:{entity_id}:{digest[:16]}"
- Files reviewed: 16/19 changed files
- Comments generated: 6
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Opt-in auto_enrich_via_gate, keep routing identity authoritative over entity payload fields, and align legacy/docs/compose with runtime contracts. Remediation-Cycle: Cognitive.Engine.Graphs#259/cycle-1 Co-authored-by: Cursor <cursoragent@cursor.com>
PR Remediation — Cycle 1 SummaryCommit: Fixed (9)
Deferred (0)none Acknowledged (0)none Disagreed (0)none Local verify: Unknown (no precommit-repo target) | Threads resolved: 9/9 |
|



Problem
CEG (Graph Cognitive Engine) previously advertised 23 phantom
graph-*actions that were never implemented, accepted theenrichaction (which Gate owns for EIE), and could be deployed with the legacy dict-based chassis in production. This violated the bidirectional seam contract: Gate is the single routing authority and the only peer transport for CEG.The seam audit (2026-09-02) identified three critical gaps:
graph-*namesenrichwas advertised locally, conflicting with Gate's ownershipFix
1. Seam Architecture Guards (New)
Added
tests/architecture/test_seam_gate_only.py— a forensic audit suite that locks the CEG side of the bidirectional seam:match,sync,outcomes,resolve);enrich,admin,health,healthcheckare forbiddenPEER_URL,EIE_URL, or raw HTTP transport outside the SDKenrichis implemented, not dormant2. Gate Egress Path (New)
Added
engine/gate_egress.py— the only CEG → peer egress:request_enrichment()asks Gate to run theenrichaction (owned by EIE in Gate's action map)3. Health Trigger Integration
Modified
engine/health/enrichment_trigger.py:trigger_reenrichment_v2()now dispatches throughengine.gate_egress.request_enrichment()triggeredis True only when Gate returns a non-failure packet4. Spec and Deployment
graph-*actions with 4 implemented CEG-owned actions:match,sync,outcomes,resolvelocal-api-legacytarget for explicit legacy testing5. Chassis Entrypoint
Modified
chassis/entrypoint.py:DEFAULT_CHASSIS = SDK(wasLEGACY)LEGACY_PERMITTED_ENVS = {"dev", "local", "test"}— legacy refused at startup outside these environments whenrequire_sdk_chassis_in_prod=True(the new default)6. Settings
Modified
engine/config/settings.py:require_sdk_chassis_in_prod: bool = True(wasFalse) — legacy side door is now opt-out, not opt-in7. SDK Pin
Updated
constellation-node-sdkfroma770e853to69c6c67:https://claude.ai/code/session_0179fXWHFZQcA47NMj11345X