Skip to content

refactor: publish gateway-only paper-grounded reasoning contract - #765

Closed
seonghobae wants to merge 65 commits into
mainfrom
fix/auto-reasoning-effort-contract-rebased
Closed

refactor: publish gateway-only paper-grounded reasoning contract#765
seonghobae wants to merge 65 commits into
mainfrom
fix/auto-reasoning-effort-contract-rebased

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Current-main successor for gateway-owned model selection and paper-grounded reasoning policy. The stale #761 branch is closed unmerged.

  • keep provider access behind authenticated local:// or https:// gateway contracts and reject direct MLX transport configuration;
  • allow omitted chat and embedding models to be selected by explicit capabilities without model-name heuristics;
  • omit temperature unless the caller explicitly supplies it, then negotiate an explicit provider rejection once without model-name fallback tables;
  • force structured output through multi-agent conduct and validate synthesized JSON locally;
  • preserve multimodal evidence and reject unsupported tool or Responses controls with named errors;
  • retain server-derived embedding provider/model identity in responses and cost records, separate from caller attribution;
  • bound adaptive provider failover without same-agent retry amplification;
  • preserve request-scoped output caps on one-shot local failover;
  • keep reasoning_effort=auto and other unadvertised reasoning controls off the provider wire;
  • generate one universal hash-locked runtime dependency set for every supported platform marker branch.

Review repairs

The current exact head closes all current inline findings, including:

  1. finite, bounded CLI request-read timeout values;
  2. embedding capability and provider/model identity isolation;
  3. fail-closed Responses/tool-loop controls and local JSON validation;
  4. provider diagnostic preservation and one-shot candidate failover;
  5. request-scoped local output-token limits without caller-body mutation;
  6. orchestrator-owned reasoning effort on structured and explicit tool-loop paths;
  7. universal uv resolution retaining colorama, greenlet, tzdata, Python 3.10 compatibility branches, and hashes.

The Azure/LiteLLM symptom that triggered this repair no longer receives an orchestrator-invented temperature=0.2. The exact unsupported-temperature diagnostic triggers one bounded retry of the same provider without temperature; provider model-group configuration remains a gateway deployment concern.

Sources

The policy cites the literature registered in docs/papers/README.md, including Route to Reason, Route-and-Reason, Reasoning on a Budget, Ares, Fugu, TRINITY, and Conductor. ADR 0025 additionally records the official uv universal-resolution, PEP 508 marker, and PEP 751 lock-format evidence. Vendor documentation remains the wire-compatibility source, not the model-policy source.

Current exact-head verification

Exact head d19e3492192e21e4a040fa3fc13a0793443731bf:

  • full suite: 1,729 passed;
  • focused passthrough, provider reliability, embedding, and OpenAI contract group: 96 passed;
  • changed production diff coverage: 100%;
  • changed production docstring coverage: 100%;
  • universal hash-lock dry-run: passed on Python 3.10 and Python 3.13;
  • pip-audit: no known vulnerabilities;
  • compileall, CodeGraph sync/status, and git diff --check: passed;
  • unresolved review threads: zero after evidence-backed remediation replies.

Hosted checks, structured same-head security evidence, and an independent protected approval remain authoritative. No predecessor-head result transfers to this head; no bypass or force update is authorized.

Scope

This PR does not bootstrap provider secrets into the PostgreSQL credential registry. That separate deployment/database slice remains Draft in #764 until this secure discovery and capability boundary is integrated.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 47 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5a74cd1f-8e4f-4b50-9d80-2f8054fd00ec

📥 Commits

Reviewing files that changed from the base of the PR and between 39072a6 and b705404.

⛔ Files ignored due to path filters (1)
  • requirements.lock is excluded by !**/*.lock
📒 Files selected for processing (84)
  • .github/workflows/tests.yml
  • AGENTS.md
  • README.md
  • contextual_orchestrator/__init__.py
  • contextual_orchestrator/__main__.py
  • contextual_orchestrator/api_contract.py
  • contextual_orchestrator/batch_routing.py
  • contextual_orchestrator/chat_capability.py
  • contextual_orchestrator/cost_ledger.py
  • contextual_orchestrator/cost_router.py
  • contextual_orchestrator/model_discovery.py
  • contextual_orchestrator/orchestrator.py
  • contextual_orchestrator/passthrough_failover.py
  • contextual_orchestrator/server.py
  • contextual_orchestrator/telemetry.py
  • docs/adr/0122-otel-session-observability.md
  • docs/architecture.md
  • docs/doctoring/OPENTELEMETRY_REFERENCES.md
  • docs/doctoring/embedding-chat-capability-isolation.md
  • docs/doctoring/inbound-request-framing.md
  • docs/library_research.md
  • docs/planning/adrs/0004-pr-review-merge-loop.md
  • docs/planning/adrs/0011-structured-provider-features-stay-orchestrated.md
  • docs/planning/adrs/0014-gateway-owned-model-selection.md
  • docs/planning/adrs/0015-auto-embedding-model-selection.md
  • docs/planning/adrs/0016-optional-sampling-capability-negotiation.md
  • docs/planning/adrs/0020-provider-error-boundary.md
  • docs/planning/adrs/0025-universal-hash-locked-requirements.md
  • pyproject.toml
  • tests/test_analytics_runtime.py
  • tests/test_api_contract.py
  • tests/test_batch_routing.py
  • tests/test_bool_01_seed_str_http_honesty.py
  • tests/test_budget_enforcement.py
  • tests/test_chat_capability_unknown_identifiers.py
  • tests/test_chat_model_capability_isolation.py
  • tests/test_chat_passthrough_capability_isolation.py
  • tests/test_chat_tools_passthrough_controls_http_honesty.py
  • tests/test_chat_tools_shape_http_honesty.py
  • tests/test_chat_transport_role_separation.py
  • tests/test_cli_auth.py
  • tests/test_cost_review_server.py
  • tests/test_cost_router.py
  • tests/test_digit_n_bool01_echo_logprobs_http_honesty.py
  • tests/test_embeddings_model_pool_http_honesty.py
  • tests/test_gateway_seed_discovery.py
  • tests/test_generated_workflow.py
  • tests/test_inbound_request_framing.py
  • tests/test_inbound_request_total_deadline.py
  • tests/test_int_float_max_output_stop_ws_http_honesty.py
  • tests/test_local_gateway.py
  • tests/test_logit_bias_key_strip_http_honesty.py
  • tests/test_logit_bias_numeric_string_coerce_http_honesty.py
  • tests/test_model_discovery.py
  • tests/test_model_judge.py
  • tests/test_multimodal_workflow_evidence.py
  • tests/test_openai_passthrough.py
  • tests/test_passthrough_one_shot_local_semantics.py
  • tests/test_passthrough_provider_failover.py
  • tests/test_persistence.py
  • tests/test_pr765_review_regressions.py
  • tests/test_provider_embeddings.py
  • tests/test_provider_reliability.py
  • tests/test_repository_security_metadata.py
  • tests/test_responses_attribution_routing_http_honesty.py
  • tests/test_responses_logit_bias_logprobs_http_honesty.py
  • tests/test_responses_penalties_http_honesty.py
  • tests/test_responses_seed_stop_http_honesty.py
  • tests/test_responses_temperature_top_p_http_honesty.py
  • tests/test_responses_tools_shape_http_honesty.py
  • tests/test_routing_latency_stream_options_bool_coerce_http_honesty.py
  • tests/test_security_hardening.py
  • tests/test_spend_analytics.py
  • tests/test_telemetry.py
  • tests/test_temperature_capability_negotiation_honesty.py
  • tests/test_tip_reland_sdk_omit_persist_http_honesty.py
  • tests/test_tool_call_id_name_strip_http_honesty.py
  • tests/test_tool_choice_flat_name_http_honesty.py
  • tests/test_tool_choice_function_call_casefold_http_honesty.py
  • tests/test_tool_choice_required_requires_tools_http_honesty.py
  • tests/test_tool_description_length_http_honesty.py
  • tests/test_tool_description_parameters_null_noop_http_honesty.py
  • tests/test_trace_context.py
  • tests/test_whole_float_string_int_coerce_http_honesty.py
📝 Walkthrough

Walkthrough

이번 변경은 MLX 직접 전송을 인증된 local:// 게이트웨이로 대체합니다. 모델 자동 검색, 임베딩 자동 선택, 구조화 출력, 멀티모달 라우팅, 도구 루프 제한, 선택적 샘플링, HTTP 요청 프레이밍 검증을 추가했습니다.

Changes

게이트웨이와 모델 검색

Layer / File(s) Summary
게이트웨이 계약과 모델 검색
contextual_orchestrator/__main__.py, contextual_orchestrator/model_discovery.py, contextual_orchestrator/orchestrator.py, examples/agents.local.json, README.md
local:// 에이전트에 명시적 자격 증명을 요구합니다. mlx:// 직접 전송을 거부합니다. /models 기반 자동 검색과 CLI 옵션을 추가했습니다.

오케스트레이션과 capability 라우팅

Layer / File(s) Summary
구조화 출력과 capability 라우팅
contextual_orchestrator/orchestrator.py, contextual_orchestrator/cost_router.py, contextual_orchestrator/batch_routing.py
구조화 출력 요청을 conduct 경로로 전달합니다. 임베딩 에이전트를 capability로 선택합니다. 이미지 입력은 vision 에이전트로 라우팅하고 workflow 단계 전체에 보존합니다.
HTTP 프레이밍과 API 경계
contextual_orchestrator/server.py, contextual_orchestrator/api_contract.py
모델 생략, 임베딩 자동 선택, 도구 루프 헤더, Responses 제어 검증, JSON Schema 검증을 적용합니다. 요청 본문은 고정 길이와 제한된 데드라인으로 읽습니다.

정책과 검증

Layer / File(s) Summary
정책 및 설계 기록
docs/planning/adrs/*, docs/architecture.md, docs/doctoring/*, docs/papers/README.md
게이트웨이 전송, 적응형 추론, 임베딩 선택, 샘플링 협상, 요청 프레이밍, 멀티모달 증거 보존 정책을 문서화합니다.
회귀 검증과 계약 테스트
tests/*
도구 요청 거부, 구조화 출력, 모델 선택, capability 라우팅, 로컬 인증, provider 협상, 보안 경계와 HTTP 프레이밍을 검증합니다.

Estimated code review effort: 5 (Critical) | ~120 minutes

Merge Risk: 🟡 Moderate · up to 39072

The PR changes gateway selection, embedding defaults, provider-control handling, and CLI request validation, but current contracts still allow invalid batch requests, can fail omitted-model embedding calls, may misreport the selected provider, and can forward an orchestrator-only reasoning value to providers; invalid configuration and lint failures can also block or destabilize use. Merge is not ready until these bounded correctness and readiness issues are fixed or explicitly accepted.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant HTTPServer
  participant ModelClient
  participant TaskOrchestrator
  participant LocalGateway
  Client->>HTTPServer: Chat 또는 Responses 요청
  HTTPServer->>ModelClient: 모델과 capability 검증
  HTTPServer->>TaskOrchestrator: 구조화 출력 또는 이미지 workflow 실행
  TaskOrchestrator->>LocalGateway: 인증된 local provider 요청
  LocalGateway-->>TaskOrchestrator: 모델 응답
  TaskOrchestrator-->>HTTPServer: 계약 검증 결과
  HTTPServer-->>Client: API 응답
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.58% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 314 functions across 54 files. (41 skipped: 17 unsupported, 24 over the file limit.) Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 게이트웨이 전용 provider 경계와 논문 기반 reasoning 계약을 포함한 변경의 핵심을 정확하고 간결하게 설명합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/auto-reasoning-effort-contract-rebased

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

@opencode-agent Work on the existing branch at exact head a859ab976b9322e74bb5b61674decca3da706f6c; do not open another PR. Resolve the four current unresolved Major threads with RED→GREEN regressions: (1) route dynamic model discovery through the same public-address validation and DNS-pinned transport as provider inference before sending credentials; (2) preserve structured-output contracts by forcing synchronous routing or carrying and validating them through batch; (3) reject malformed nested JSON Schema structures with 400 invalid_response_format before execution; and (4) reject any Responses orchestration controls that are accepted but not applied. Keep gateway-only scope, run the full exact-head suite, remove .github/workflows/repair-pr-765.yml if superseded by your verified commit, and resolve only threads proven fixed.

github-advanced-security[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Closed as unsafe to merge at current head. The PR introduces a self-mutating workflow with contents: write and its exact-head Checks fail: Full unit and contract suite rejects existing tool compatibility contracts with 422, TDD repair fails, and Scorecard reports the workflow permission/credential findings. Reopen only as a focused production patch with direct tests and least-privilege workflow permissions.

@seonghobae

seonghobae commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@opencode-agent Re-review exact current head SHA: d3b31a2. Review findings were fixed with focused regression coverage; the one-shot self-mutating repair workflow was removed. Please publish a fresh formal verdict only from same-head checks and coverage evidence.

@seonghobae
seonghobae marked this pull request as ready for review August 20, 2026 04:10
@seonghobae
seonghobae enabled auto-merge (squash) August 20, 2026 04:10

Copy link
Copy Markdown
Contributor Author

@opencode-agent Review exact current head b03187f70241a04c2262856eb93f2ebbb5e73811. Re-evaluate the gateway-only provider contract, authenticated local:// boundary, DNS-pinned dynamic discovery before Authorization, structured-output forced-sync and local schema validation, fail-closed Responses controls, tool-loop 422 boundary, and paper-grounded auto/provider-capability distinction. All prior inline findings are resolved against current code; do not reuse predecessor-head verdicts.

@seonghobae

Copy link
Copy Markdown
Contributor Author

@opencode-agent Review exact current head SHA b03187f. The gateway-only patch now fails closed for local:// agents without an explicit KV credential and preserves the 422 tool-surface contract. Use only same-head required Checks and changed-file evidence; publish a fresh formal verdict.

@seonghobae

Copy link
Copy Markdown
Contributor Author

@opencode-agent Re-review exact current head SHA e928ada. The current patch also preserves tool_choice auto/none omit-equivalent behavior while rejecting only unsupported tool execution, and routes discovery tests through the validated transport seam. Use only same-head Checks and changed-file evidence; publish a fresh formal verdict.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head remediation and verification

Head: b6d53af
Live base observed after push: e226e11
Unresolved review threads: 0 after evidence-backed replies

Verification on the identical committed tree:

  • full suite: 1,729 passed
  • focused passthrough, local gateway, reasoning, metadata, and OpenAI contract group: 137 passed
  • changed production diff coverage: 100 percent
  • changed production docstring coverage: 100 percent
  • universal hash lock dry-run: passed on Python 3.10 and Python 3.13
  • pip-audit: no known vulnerabilities
  • compileall, CodeGraph sync/status, and git diff check: passed

Every prior hosted check and review is stale for this head. Normal protected merge still requires terminal exact-head checks, structured security evidence, zero unresolved threads, and an independent current-head approval; no bypass or force update.

@opencode-agent @cwl-noema-review please perform a review-only evaluation of this exact head. Do not update branches or merge.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head review disposition for d19e349: the current tree already contains the previously reported fixes for bounded CLI request-read timeout parsing, batch embeddings OpenAPI input/inputs requirements, Responses top_p echo assertion, directly runnable test entrypoints, S106 test-secret annotations, and rejection-contract test names. The current delta from b6d53af only removes two unused production bindings and corrects the Responses test to inspect the final synthesis call; no additional source finding is valid on this delta. Local evidence on this exact tree: full pytest 1729 passed, focused PR suite 131 passed, ruff check passed, compileall passed, git diff --check passed. Hosted required checks remain queued and no qualifying approval exists, so this PR stays WAIT_AND_REMEDIATE; no merge or bypass is performed.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review Please review exact current head d19e349. The exact Azure default-only temperature diagnostic is covered, the same-provider request is retried once without temperature, all threads are resolved, and the full suite passes 1729 tests. Please bind findings and approval to this exact head.

@seonghobae
seonghobae enabled auto-merge August 21, 2026 15:29
@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head local verification update (2026-08-22 KST):\n\n- Current head: d19e3492192e21e4a040fa3fc13a0793443731bf; base: e226e1197bdfc890c9d8e5b9b648c78857d7e465.\n- Full suite: 1729 passed in 555.47s. Focused passthrough/provider-boundary set: 78 passed.\n- Merge-result tree verification was performed against the exact base/head; no conflict tree delta was introduced.\n- Coverage: statement/branch aggregate 92%; interrogate 100% against the configured 80% threshold.\n- Earlier exact-tree checks also passed: actionlint, compileall, git diff --check, Semgrep 0 findings, pip-audit no known vulnerabilities, wheel build, and isolated wheel install/import smoke.\n\nThe aggregate coverage is reported honestly and is not being represented as 100%. Hosted required Checks remain queued and no independent approval is present; no merge is being represented as complete.

@opencode-agent opencode-agent Bot added area: api API, protocol, event, or external contract merge: urgent-review Central or critical pull request requiring immediate review attention status: needs-review Open pull request requiring current-head review or checks type: refactor Internal refactoring without intended product behavior change labels Aug 22, 2026
@opencode-agent
opencode-agent Bot disabled auto-merge August 24, 2026 09:08

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head d19e3492192e21e4a040fa3fc13a0793443731bf.

  • Head SHA: d19e3492192e21e4a040fa3fc13a0793443731bf

  • Workflow run: 32702015999

  • Workflow attempt: 1

Coverage evidence

Coverage Decision

  • Result: FAIL
  • Test evidence: not proven passing
  • Docstring evidence: not proven passing when configured
  • Failure count: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow: tests.yml"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> Conflict["Merge conflict blocks this path"]
  Conflict --> V1["actionlint plus required checks"]
  Evidence --> S2["Changed file (19 files)"]
  S2 --> I2["repository behavior"]
  I2 --> Conflict["Merge conflict blocks this path"]
  Conflict --> V2["required checks"]
  Evidence --> S3["Docs (22 files)"]
  S3 --> I3["operator or user guidance"]
  I3 --> Conflict["Merge conflict blocks this path"]
  Conflict --> V3["docs review"]
  Evidence --> S4["Test (89 files)"]
  S4 --> I4["regression suite"]
  I4 --> Conflict["Merge conflict blocks this path"]
  Conflict --> V4["targeted test run"]
Loading

@opencode-agent

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: d19e3492192e21e4a040fa3fc13a0793443731bf
  • Workflow run: 32702015999
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head d19e3492192e21e4a040fa3fc13a0793443731bf.

  • Head SHA: d19e3492192e21e4a040fa3fc13a0793443731bf

  • Workflow run: 32702015999

  • Workflow attempt: 1

Coverage evidence

Coverage Decision

  • Result: FAIL
  • Test evidence: not proven passing
  • Docstring evidence: not proven passing when configured
  • Failure count: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow: tests.yml"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> Conflict["Merge conflict blocks this path"]
  Conflict --> V1["actionlint plus required checks"]
  Evidence --> S2["Changed file (19 files)"]
  S2 --> I2["repository behavior"]
  I2 --> Conflict["Merge conflict blocks this path"]
  Conflict --> V2["required checks"]
  Evidence --> S3["Docs (22 files)"]
  S3 --> I3["operator or user guidance"]
  I3 --> Conflict["Merge conflict blocks this path"]
  Conflict --> V3["docs review"]
  Evidence --> S4["Test (89 files)"]
  S4 --> I4["regression suite"]
  I4 --> Conflict["Merge conflict blocks this path"]
  Conflict --> V4["targeted test run"]
Loading

Merge Conflict Guidance

  • Current merge state: DIRTY
  • Base branch: main
  • Head branch: fix/auto-reasoning-effort-contract-rebased
  • Fix direction: merge or rebase origin/main into fix/auto-reasoning-effort-contract-rebased, resolve conflict markers in the changed files, rerun the focused checks, then push the same branch.
  • Repair commands:
gh pr checkout 765 --repo ContextualWisdomLab/contextual-orchestrator
git fetch origin main
git merge --no-ff origin/main  # or: git rebase origin/main
git status --short
# resolve files, then git add <resolved-files>
# merge path: git commit
# rebase path: git rebase --continue
git push origin HEAD:fix/auto-reasoning-effort-contract-rebased
# rebase path only: git push --force-with-lease origin HEAD:fix/auto-reasoning-effort-contract-rebased

Resolves 14 conflicted files across the tool-fallback classification
system, DNS-pinned discovery transport, and embedding batch registry
persistence. Beyond textual conflicts, testing surfaced and fixed
three real bugs the merge exposed:

- _send_with_retry silently lost main's _is_tool_execution_stopped
  check during auto-merge (the two branches' rewrites didn't overlap
  enough to flag a conflict); restored it.
- --auto-discover-model-agents collided as two independently-authored
  CLI flags for different features (bootstrap seed expansion vs.
  runtime discovery); renamed the seed-expansion one to
  --auto-discover-seed-agents.
- agent_from_discovered/_parse_openai_compatible required chat-model
  naming eligibility unconditionally, rejecting explicitly-capable
  non-chat models (e.g. embedding-only sources); relaxed to accept
  either chat eligibility or a declared capability, while still
  rejecting malformed/missing model ids.

Also: _parse_request_framing's oversized-digit-string handling now
matches _request_body_size's classification (413, not 400) via a
string-length precheck before int() conversion, avoiding Python's
int<->str conversion digit limit; and requirements.lock is
regenerated via uv pip compile --universal per this branch's own
test_python_lockfile_uses_hash_pinning expectation.

Full suite: 1862 passed.
devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Maintainer decision needed before further automation: this 63-commit / ~10.5K-line stack overlaps the same issue-568 reasoning-effort feature that #785 now ships compactly (23 files, ~1.6K lines) and conflicts with current main in 15 files, including the sampling/temperature semantics that landed separately.

Proposed resolution: close this as superseded by #785 after confirming no unique commits remain unmerged (the trace-context additions look like the main candidates for salvage as a small follow-up). An automated rebase of the full stack is not safe to merge without line-by-line review of duplicated reasoning-effort behavior.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment thread contextual_orchestrator/__main__.py
@seonghobae

Copy link
Copy Markdown
Contributor Author

Integration plan (2026-08-25) — orphaned stack base discovered

This branch is the base of a landed-but-orphaned stack: #805, #813, #816, #801 (and related fixes: constant-time budget checks, structured-provider orchestration, budget-stop preservation, telemetry session correlation, request-sampling isolation) were merged into THIS branch, not into main. It must land to bring their content home — do not close it.

Merge-state facts

Semantic conflicts requiring decisions (verified by local merge attempt)

  1. cost_router.route(): stack's provider-request/proxy-completion + multi-record usage aggregation vs main's response-cache integration (cache_bypass/cache_partition/cache_hit channel). Integration: cache kwargs flow into orchestrator.run; passthrough requests force-sync and skip cache hits; aggregate records from either path.
  2. TaskOrchestrator.run/complete: stack's output_contract + owner binding vs main's effort-snapshot wrapper + cache kwargs + tool-retry params — signatures must union.
  3. model_discovery: capability-scoped id gates (main, post-fix: isolate embedding deployments from chat synthesis #768/feat: auto-select embedding-capable agents #789) supersede the stack's older filter version; keep main's parser + re-apply only the Bytez capability preservation fix (b705404).
  4. server.py/_StateStore: take main wholesale except where the stack adds budget-meter hot-path hooks (fix(perf): make provider budget gates constant time #816) — hook into main's renamed orchestration_records schema.
  5. pyproject.toml: runtime deps union = opentelemetry-* + cryptography (hypothesis stays in test extra per fix(packaging): keep property-test tooling out of production runtime #769); regenerate requirements.lock via canonical pip-compile afterwards.

Recommended execution order: resolve cost_router+orchestrator first (semantic core), then server/_StateStore, then mechanical theirs=main files (README/AGENTS/docs/workflows), regenerate locks, full suite, update PR body evidence.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Superseded after exact-head decomposition. The only current tip-only repair, preserving operator-declared Bytez endpoint capabilities, is now carried with regression coverage by #834 (f9dc08b5). The remaining branch is a conflict-heavy historical stack whose component changes were already delivered or are under current-head review in the focused successor PRs; merging it would reintroduce stale contracts and duplicate ADR history. Closing without merge; protected-main evidence remains with the focused PRs.

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

Labels

area: api API, protocol, event, or external contract enhancement New feature or request merge: urgent-review Central or critical pull request requiring immediate review attention priority: critical Immediate blocker, P0, urgent deadlock, or critical incident status: needs-review Open pull request requiring current-head review or checks type: refactor Internal refactoring without intended product behavior change

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants