fix(providers): inject top-level instructions for openai-responses wire (#134)#160
Open
fix(providers): inject top-level instructions for openai-responses wire (#134)#160
Conversation
Contributor
There was a problem hiding this comment.
Findings
- No high-confidence issues found in added/modified lines.
Summary
- Review mode: initial
- No issues identified in the latest diff.
- Residual risk/testing gap: behavior depends on
pi-airequest payload shape foronPayload; repo tests cover unit-level mutation logic, but there is no in-repo integration test against a strict OpenAI-Responses gateway.
Testing
- Not run (automation)
open-codesign Bot
…re (#134) Strict OpenAI-Responses gateways reject requests that carry a system/developer role inside input[] without a matching top-level `instructions` field. pi-ai's plain `openai-responses` wire emits the former but not the latter, so sub2api-style routers return 400. Mirror the codex wire's strict behavior via the `onPayload` hook: - set params.instructions from the aggregated systemPrompt - filter out role === "system" | "developer" entries from input[] Only wired when model.api === "openai-responses" AND systemPrompt is non-empty. Other wires (anthropic-messages, openai-completions, openai-codex-responses) are untouched. Signed-off-by: hqhq1025 <1506751656@qq.com>
a7f8a5f to
3fdebd0
Compare
Contributor
There was a problem hiding this comment.
Findings
- No high-confidence issues found in added/modified lines.
Summary
- Review mode: follow-up after new commits
- No issues identified in the latest diff.
- Not found in repo/docs:
docs/VISION.mdanddocs/PRINCIPLES.mdin this checkout; review used available repo context plus full PR diff. - Residual risk/testing gap: behavior relies on
pi-aipayload shape foronPayload; current coverage is unit-level and does not include an integration test against a strict OpenAI-Responses gateway.
Testing
- Not run (automation)
open-codesign Bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
input[]carries asystem/developerrole without a matching top-levelinstructionsfield. pi-ai's plainopenai-responseswire emits the former but not the latter.openai-codex-responseswire's strict behavior via pi-ai'sonPayloadhook: setparams.instructionsfrom the aggregated systemPrompt, and filter outrole === "system" | "developer"entries frominput[].model.api === "openai-responses"AND systemPrompt is non-empty. Other wires (anthropic-messages, openai-completions, openai-codex-responses) are untouched.Fixes #134.
Four principles
complete(); if pi-ai later emitsinstructionsnatively we can delete the hook in one place.toPiContextoutput (no helper refactor).openai-codex-responsesalready behaves upstream.Test plan
pnpm --filter @open-codesign/providers test -- --run(10 files, 134 tests, incl. 3 new cases: payload mutation, no-op when systemPrompt empty, no-op for anthropic wire)pnpm typecheck(10/10 tasks successful)pnpm lint(biome clean)instructionsand confirm 200 with system prompt honored