Repository navigation
feat(reborn): add OpenAI-compatible API contracts - #4459
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the ironclaw_reborn_openai_compat crate, establishing a Reborn-native OpenAI-compatible API contract surface with Chat Completions and Responses DTOs, route descriptors, and fail-closed route fragments. Feedback focuses on improving type safety by refactoring OpenAiResponsesInputItem and OpenAiResponseOutputItem from structs with optional fields into internally-tagged enums. Additionally, it is recommended to map all HTTP 5xx errors to a single status code (such as 503) in sanitize_status_code to ensure consistent recovery semantics.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
serrrfirat
left a comment
There was a problem hiding this comment.
Code Review
Reviewed PR #4459 at 035a2655122c73607cf7f0e15e033f6221e3039f with security, bugs, performance/concurrency, tests, and conventions passes. No Critical or High findings. I found 7 Medium findings: 2 security/contract sanitization risks, 3 API contract mismatches, and 2 focused coverage gaps.
Validation run during review: cargo test -p ironclaw_reborn_openai_compat --features openai-compat-beta passed.
abbyshekit
left a comment
There was a problem hiding this comment.
Code review — feat(reborn): add OpenAI-compatible API contracts
Multi-agent review (security · bugs · performance · tests · conventions) at 035a2655. Diff-only mode.
Independent review of an open PR.
5 findings — 4 Medium, 1 Low. Posted as a comment (advisory). Confidence ≥ 50, deduplicated across reviewers.
| Sev | Conf | Reviewer | Location | Finding |
|---|---|---|---|---|
| Medium | 90% | conventions | openai-compatible-api.md:73 |
Contract docs claim stub returns 501, but code/test return 503 |
| Medium | 80% | bugs | error.rs:160 |
Non-retryable 500 internal errors are emitted as HTTP 503 (retryable), contradicting their own error code and retryable flag |
| Medium | 80% | tests | error_contract.rs:1 |
5 of 7 ProductWorkflowRejectionKind mapping arms are never exercised |
| Medium | 78% | bugs | error.rs:119 |
Fail-closed stub returns HTTP 503, not the 501 documented across the crate's contracts |
| Low | 62% | tests | dto_contract.rs:1 |
No test that requests missing required fields (model/messages/input) deserialize to a clean Err |
Generated by near-ai-code-review (5 parallel reviewer agents + intent analysis). Diff-only; confidence ≥ 50; ≤ 15 inline comments.
* feat(reborn): add OpenAI-compatible product refs * fix(reborn): validate OpenAI-compatible ref mappings * fix(reborn): address OpenAI product refs review * Validate durable OpenAI compat ref records * Format OpenAI compat storage review fixes --------- Co-authored-by: Robert Yan <mstr.raphael@gmail.com>
|
@hanakannzashi lets fix themerge conflicts and merge this |
* feat(reborn): add OpenAI-compatible API contracts * fix(reborn): tighten OpenAI-compatible response contracts * fix(reborn): address OpenAI compat contract review * fix(reborn): satisfy merged main clippy * test(reborn): stabilize subagent cancellation propagation * feat(reborn): add OpenAI-compatible product refs (nearai#4489) * feat(reborn): add OpenAI-compatible product refs * fix(reborn): validate OpenAI-compatible ref mappings * fix(reborn): address OpenAI product refs review * Validate durable OpenAI compat ref records * Format OpenAI compat storage review fixes --------- Co-authored-by: Robert Yan <mstr.raphael@gmail.com> --------- Co-authored-by: Robert Yan <mstr.raphael@gmail.com>
Summary
ironclaw_reborn_openai_compatcrate for Reborn OpenAI-compatible Chat Completions and Responses API ingress contracts.Change Type
Linked Issue
Closes #4442
Validation
cargo fmt --all -- --checkcargo clippy --all --benches --tests --examples --all-features -- -D warningscargo buildcargo test -p ironclaw_reborn_openai_compat,cargo test -p ironclaw_reborn_openai_compat --features openai-compat-beta,cargo test -p ironclaw_architecturecargo test --features integrationif database-backed or integration behavior changedreview-prorpr-shepherd --fixwas run before requesting reviewAdditional validation:
cargo clippy -p ironclaw_reborn_openai_compat --all-targets --all-features -- -D warningsgit diff --checkSecurity Impact
Yes. This defines Reborn OpenAI-compatible ingress contracts and route policies, but does not bind sockets or enable runtime traffic. Descriptors require host-owned LocalGateway bearer-token ingress, ProductWorkflow/projection effect paths, host-configured CORS, body/rate limits, and no direct v1 gateway or LLM proxy path. Error tests assert backend details, paths, and secret-like values do not serialize through the compatibility error envelope.
Database Impact
None.
Blast Radius
Limited to the new
ironclaw_reborn_openai_compatcrate, Reborn contract docs, workspace membership, and architecture guardrails. No existing route, listener, database, runtime, or v1 gateway behavior changes.Rollback Plan
Revert this PR to remove the OpenAI-compatible contract crate, route descriptors, docs, and architecture guardrail additions. Since no listener/runtime path is wired, rollback should not require data migration or runtime cleanup.
Review Follow-Through
Reviewer judgment requested on the exact route set (
/v1/*and/api/v1/*aliases), the OpenAI-compatible DTO surface to freeze in this first contract slice, and whether the beta router stubs should remain feature-gated until ProductWorkflow wiring lands.Review track: C