Skip to content

0.1.8 Beta6: Implement generic Collaboration V2 over Chat Completions #394

Closed

Description

@NOirBRight

Parent

#259 (part of #248)

Outcome

Implement the generic, reversible Collaboration V2 lifecycle over selected third-party Chat Completions endpoints.

This consumes the exact Beta4 runtime contract and the runtime-derived Chat matrix in #66. The Codex Client remains the agent owner/executor; the Gateway converts protocol shapes only.

Required behavior

  • Preserve the six V2 direct function declarations and exact schemas through the Responses-to-Chat request boundary.
  • Convert Chat tool calls and results back to the exact V2 function-call lifecycle with stable call/item identity and ordering.
  • Preserve or reversibly adapt task identity, message/agent_message, follow-up, wait/result, list/interrupt, history, replay, and progressive streaming.
  • Keep V1 repair, agent-ID scheduling, close/resume, and wait-result fabrication structurally unreachable from V2.
  • Use one field/value-driven implementation for GLM-5.2, K2.7 Code, DeepSeek V4 Flash 0731, and unknown compatible Chat endpoints.
  • If an essential semantic cannot be represented reversibly, fail before upstream sampling; do not silently downgrade, transcript-convert an active lifecycle, or retry another codec.

Acceptance criteria

  • Deterministic fixtures cover declaration, call, result, history, and streaming for all six V2 tools.
  • Task identity and agent_message semantics survive the Chat round trip without V1 substitution.
  • Missing/duplicate IDs, mixed V1/V2 state, unknown aliases, malformed tool calls, and incompatible history fail visibly.
  • Translation failure after streaming begins emits exactly one standard response.failed terminal.
  • No Provider/model name selects production conversion behavior.
  • No Responses/Official fallback, cross-Provider execution, Gateway agent creation, scheduling, or fabricated completion occurs.

Non-goals

  • Chat Code Mode/custom/freeform, client tool_search, arbitrary namespace tools, or provider-hosted tools beyond separately proven Chat contracts.
  • Cross-Home topology/history migration.

Blocked by

Activity

  1. added
    enhancementNew feature or request
    ready-for-agentFully specified, ready for an AFK agent
    wayfinder:taskWayfinder implementation task
    tier:heavyOrchestrator provider tier: heavy
    P1Priority 1: current iteration goal
    on Aug 10, 2026
  2. CCanxue commented on Aug 11, 2026

    @CCanxue

    Useful reference for the agent_message semantics you need to preserve: on DeepSeek (Responses), the agent_message item itself is dropped even when its content is plaintext; only a standard message item is consumed reliably (verified with wire captures on codex-cli 0.146.0). So for third-party endpoints, converting the task to a plain user message is the representation that works, which is what our local patch does for non-OpenAI providers: https://github.com/CCanxue/codex-deepseek-subagent-fix

  3. 6 remaining items

  4. self-assigned this
    on Aug 19, 2026
  5. NOirBRight commented on Aug 19, 2026

    @NOirBRight
    OwnerAuthor

    Starting Chat Collaboration V2 adapter against the #66 matrix: first slice is declaration + call identity through compatible_request_body then prepare_exchange.

  6. NOirBRight commented on Aug 19, 2026

    @NOirBRight
    OwnerAuthor

    Candidate implementation is on local main at 3edaff6 plus fail-closed delta e25d382 (not pushed yet).

    Coverage:

    • six V2 declarations -> deterministic request-scoped Chat function aliases
    • call/result/history/progressive streaming for all six tools
    • exact call/item/task identity and namespace inverse
    • plaintext agent_message author/recipient/content through bound reversible envelopes
    • encrypted argument/agent-message handoffs, unknown aliases, invalid transport values fail before sampling
    • no Provider/model-name dispatch
    • captured real Codex defaults cross compatible_request_body -> prepare_exchange while staying local

    Verification on exact e25d382:

    • focused strict suite: 1,219 passed + 380 subtests
    • Python core: 2,431 passed, 85 skipped, 508 subtests; 62 known Linux host failures are the unchanged PowerShell/Windows launcher-release gaps
    • report-only quality scan: parse_errors=0

    Standards review found no hard violations. Spec review is still running before closeout.

  7. NOirBRight commented on Aug 19, 2026

    @NOirBRight
    OwnerAuthor

    Completed on local main at 3edaff6 + e25d382 (ahead of origin; not pushed yet).

    Acceptance mapping:

    • all six V2 declarations, calls, results, history/replay, and progressive streams: tests/test_issue_394_chat_collaboration_v2.py
    • task/call/item/namespace identity and plaintext agent_message inverse are request-scoped and deterministic
    • encrypted handoffs, malformed values, unknown aliases, mixed V1/V2, and missing/duplicate identities fail visibly
    • existing Handler coverage verifies post-commit translation errors emit exactly one response.failed
    • no Provider/model dispatch, fallback, Gateway agent execution, scheduling, or fabricated result path was added
    • exact real Codex transport defaults are locally consumed by value; unknown shapes fail closed

    Verification: focused strict 1,219 passed + 380 subtests; exact-SHA Python core 2,431 passed / 85 skipped / 508 subtests, with only the unchanged 62 Linux PowerShell/Windows launcher-release gaps; quality scan parse_errors=0. Standards review: no hard violations. Spec checklist: no blockers.

  8. NOirBRight commented on Aug 19, 2026

    @NOirBRight
    OwnerAuthor

    Reopened after #395 harness review found a live-path gap: TRANSPARENT_CONVERTED Chat SSE writes ChatToResponsesStreamConverter events directly without compatible_sse_line, so V2 aliases are not reverse-mapped on the production stream. Unit composition covered the two stages separately but not Handler wiring. Fixing with Handler integration coverage before closing again.

  9. NOirBRight commented on Aug 19, 2026

    @NOirBRight
    OwnerAuthor

    Reopened live-path gaps are fixed in 229e2a8, be80542, and 6aedd33:

    • production TRANSPARENT_CONVERTED Chat SSE now performs runtime-tool inverse before writing
    • the inverse-only path is isolated from legacy V1/worker repair
    • unknown alias after stream start emits exactly one standard response.failed, preserves response identity and bounded unknown_alias classification, and cannot later complete
    • malformed upstream Chat stream errors preserve their existing terminal contract
    • Codex CLI 0.147 child continuations use a fully validated agent_message shape (not a bare type tag); ADR-0002 records this continuation-only discriminator
    • script launch publishes the running __main__ module as codex_proxy, preventing a duplicate event writer during late compatibility imports

    Final focused suite: 609 passed + 129 subtests. Full Python core: 2,442 passed, 89 skipped, 508 subtests; 61 remaining failures are the unchanged Linux PowerShell/Windows launcher-release gaps. Quality scan parse_errors=0.

  10. NOirBRight commented on Aug 19, 2026

    @NOirBRight
    OwnerAuthor

    Final closeout after live-path review fixes: source through 6aedd33, no Standards or Spec blockers, final combined targeted 609 passed + 129 subtests, final full Python core 2,446 passed / 89 skipped / 508 subtests with only 61 known Linux PowerShell/Windows host gaps.

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

Metadata

Metadata

Assignees

Labels

P1Priority 1: current iteration goalcampaign:0.1.8-beta60.1.8 Beta6 usable Chat campaigncampaign:gateway-chatGateway deep modules and Codex↔Chat bridgeenhancementNew feature or requestready-for-agentFully specified, ready for an AFK agenttier:heavyOrchestrator provider tier: heavywayfinder:taskWayfinder implementation task

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions