Repository navigation
Preserve Worker selector and effective binding validation for external delegation #161
Description
Split from #156. This Issue owns only the CodexHub adapter contract for Worker selector preservation and supported effective-binding validation.
Problem
spawn_agent.agent_type=worker is advertised at the adapter boundary but can be removed or weakened during normalization/history processing. The adapter also lacks a fail-closed contract for supported effective agent type, model, and reasoning readback, so requested settings can be mistaken for effective execution evidence.
Outcome
CodexHub preserves the explicit Worker selector across every adapter stage, or rejects it before child execution, and consumes supported effective binding readback to prove the selected agent type, model, and reasoning. Missing, unknown, contradictory, rejected, or GPT-substituted results fail closed before edits.
Scope — CodexHub adapter only
- Preserve
spawn_agent.agent_type=workeracross tool declaration, argument normalization, call execution, response normalization, and history replay. - Reject unsupported
agent_typevalues before child execution; do not delete, coerce, or silently substitute them. - Consume the Host/runtime's supported effective agent type, model, and reasoning readback.
- Require effective readback to agree with the requested Worker selector, third-party model, and reasoning before edits begin.
- Fail closed for missing, unknown, contradictory, rejected, unsupported, or GPT-substituted readback/results.
- Emit sanitized, machine-classifiable telemetry for selector preservation/rejection and effective-binding validation outcomes.
- Add deterministic tests and a focused sanitized fixture derived only from shapes, enums, and synthetic values.
Non-goals
- Do not register Host callbacks or implement parent-result delivery; Enable sidebar-visible third-party Worker callbacks and binding readback #156 owns the Host/runtime surface.
- Do not implement the repeated identical empty-
tool_searchbound; Bound repeated empty tool_search misses for external models #159 owns it. - Do not use Codex SQLite, private Task/callback IDs, local paths, or rollout records as evidence.
- Do not broaden into unrelated transport, protocol routing, retry, apply-patch, or Task-activity work.
- Do not infer binding from requested settings and do not accept GPT substitution.
Acceptance criteria
-
agent_type=workersurvives declaration, normalization, call execution, result normalization, and history replay unchanged. - An unsupported selector is rejected with a sanitized terminal classification before child execution.
- Supported readback proves the effective agent type, model, and reasoning and matches the request before edits.
- Missing, unknown, contradictory, rejected, unsupported, or GPT-substituted readback/result stops before edits.
- Existing supported non-Worker collaboration behavior remains unchanged.
- Telemetry contains no credentials, prompts, private Task/callback identifiers, rollout data, or local paths.
Minimal deterministic tests
- Worker selector survives declaration, normalization, execution, response normalization, and history replay.
- Missing and unsupported selector values reject before child execution.
- Effective readback matching the requested Worker/model/reasoning passes.
- Missing, unknown, contradictory, rejected, unsupported, and GPT-substituted readbacks each fail closed before edits.
- Sanitized telemetry records only stable classification fields and synthetic fixture values.
Verification
python -m pytest -q tests/test_codex_semantic_adapter.py
python -m pytest -q tests/test_routing.py -k "agent_type or binding"
python -m pytest -q
git diff --check
python scripts/report_quality_gates.pyRun the full Python suite once at the candidate commit. python scripts/report_quality_gates.py is report-only.
Expected hotset
src-python/codex_semantic_adapter.pysrc-python/codex_proxy.pyonly where the selector/effective-binding result crosses the adapter boundarytests/test_codex_semantic_adapter.py- focused routing tests for
agent_type/binding - one focused sanitized fixture under
tests/fixtures/if required
Relationships
- Parent Host/runtime gate: Enable sidebar-visible third-party Worker callbacks and binding readback #156
- Sibling repeated-search bound: Bound repeated empty tool_search misses for external models #159
Execution contract
Execution-Contract: v2
Verification-Class: strict
Verification-Commands: targeted tests/test_codex_semantic_adapter.py; targeted routing tests for agent_type/binding; full Python suite once; git diff --check; python scripts/report_quality_gates.py report-only
Manual-Evidence: none; consume only supported effective readback supplied by the Host/runtime contract in #156
Architecture-Decision: resolved
Review-Owner: orchestrator
Activity
NOirBRight commentedon Jul 17, 2026
Implemented and merged to
devvia PR #165 (#165).Evidence:
4bb1acb0de2cc1980c6282dbe7b78b4e343f78efThe CodexHub adapter now preserves Worker/general selectors across body, native SSE, converted Chat SSE, semantic repair, and replay; missing/unsupported/generated selector failures stop before executable emission; original Worker/model/reasoning bindings are signed and call-correlated; supported effective readback is validated fail-closed. Live sidebar Worker materialization and Host readback production remain owned by parent gate #156.