Skip to content

fix(requestflag): preserve piped query arrays - #167

Merged
markstuart-oai merged 1 commit into
mainfrom
markstuart-oai/c18-piped-query-arrays
Sep 8, 2026
Merged

fix(requestflag): preserve piped query arrays#167
markstuart-oai merged 1 commit into
mainfrom
markstuart-oai/c18-piped-query-arrays

Conversation

@markstuart-oai

Copy link
Copy Markdown
Contributor

Piped JSON or YAML query arrays were passed to the flag parser as one serialized element. For example, responses retrieve with {"include":["first","second"]} sent one include[] value containing the JSON array instead of the same two values produced by --include first --include second.

Assign typed query collections through the existing element converter, then set the complete collection once. Preserve explicit flag precedence, aliases, provenance, scalar/null compatibility, and existing header/path/body behavior. Conversion and validation failures do not leave a partially assigned collection. No generated commands, schemas, dependencies, or policy files change.

Validation

Passed locally with Go 1.27.0 on Linux:

  • go test ./internal/...
  • go test ./... -run '^$' (compilation only)
  • go test ./internal/requestflag ./pkg/cmd -run 'Stdin|ApplyStdinDataToFlags' -count=1
  • The same focused tests with -race
  • go vet ./internal/requestflag ./pkg/cmd
  • go mod verify
  • ./scripts/lint (Go build)
  • Windows amd64 test cross-compilation for all packages; no Windows runtime testing
  • Fresh CLI/localhost HTTP captures: JSON/YAML parity with repeated flags, both stdin trust modes, explicit overrides, empty arrays, untrusted literal file references, and explicit trusted file expansion. The regression fails against the original implementation.
  • Baseline-versus-candidate probes for decoded null, mixed, and object collections; successful candidate collections match repeated CLI elements in JSON and query encoding.
  • Trusted-main custom-code check on the actual committed candidate: 495/1000 lines; isolation passes.

Full local mock suite NOT RUN: the pinned Steady setup/cache blocker persists; the supported launcher reports a missing cache, and the previously denied bootstrap was not retried or bypassed. Full hosted CI/mock tests and completed bot reviews with resolved feedback remain mandatory before SDK review.

Copilot AI lite review requested due to automatic review settings September 8, 2026 05:10
@markstuart-oai markstuart-oai added the autoimprove Scoped automated improvement label Sep 8, 2026
@markstuart-oai
markstuart-oai requested a review from a team as a code owner September 8, 2026 05:10
@markstuart-oai markstuart-oai added the autoimprove Scoped automated improvement label Sep 8, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-08T05:12:25.421250Z e50e11f PR opened
🔒 Security Review Completed 2026-09-08T05:14:46.754642Z e50e11f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Castiron custom code

✅ No new custom-code files detected.

5 mixed files remain; 0 existing customizations changed.

Compared 094a4ab96e80e50e11ff2dfd. Generated baselines verified.

5 existing customizations unchanged
  • pkg/cmd/adminorganizationcertificate.go
  • pkg/cmd/cmd.go
  • scripts/castiron/README.md
  • scripts/castiron/custom_code_report.py
  • scripts/castiron/test_custom_code_report.py

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 34189639373 --repo openai/openai-cli \
  --name castiron-custom-code-34189639373-1 --dir /tmp/castiron-custom-code-34189639373-1
git apply --stat /tmp/castiron-custom-code-34189639373-1/custom-code.patch
cat /tmp/castiron-custom-code-34189639373-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin 094a4ab96e80c2952c830ae36a9a9f009617e5ec e50e11ff2dfda799c1564883ec877ffee3bcd1ee
python3 scripts/castiron/custom_code_report.py report \
  --base 094a4ab96e80c2952c830ae36a9a9f009617e5ec \
  --head e50e11ff2dfda799c1564883ec877ffee3bcd1ee --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-e50e11ff2dfd
cat /tmp/castiron-custom-code-e50e11ff2dfd/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The change is narrowly scoped to stdin→query slice handling and is backed by targeted unit + end-to-end tests that exercise precedence, validation, and security-related literal handling.

Pull request overview

This PR fixes how piped YAML/JSON query arrays are applied to request flags so that a collection from stdin is treated as multiple flag elements (matching repeated --flag value behavior) rather than a single serialized element, while preserving existing precedence/provenance rules and non-query behavior.

Changes:

  • Route stdin-driven flag assignment through a new helper that can special-case query slice flags to populate collections element-by-element.
  • Implement collection-safe assignment for Flag[T] query slices to avoid partial mutation on conversion/validation failures.
  • Add unit and end-to-end regression tests covering JSON/YAML parity, explicit precedence, and untrusted-stdin file-reference literal behavior.
File summaries
File Description
pkg/cmd/stdincollection_test.go New end-to-end test asserting query array behavior matches repeated flags for JSON/YAML stdin and preserves untrusted reference literals.
internal/requestflag/stdincollection.go Adds stdin-to-flag assignment helper and slice-query collection assignment path using existing element parsing/validation.
internal/requestflag/stdincollection_test.go Adds unit tests validating stdin collection semantics, precedence, aliases, and non-query compatibility behavior.
internal/requestflag/requestflag.go Switches stdin application for query/header/path flags to the new helper to enable collection-aware assignment.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/requestflag/stdincollection_test.go
Comment thread pkg/cmd/stdincollection_test.go

@jbeckwith-oai jbeckwith-oai 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.

Thoroughly reviewed the exact head e50e11ff2dfda799c1564883ec877ffee3bcd1ee. The stdin collection path preserves repeated query-array semantics, explicit CLI precedence, aliases/provenance, validation atomicity, scalar/null compatibility, and existing non-query behavior. Targeted unit and end-to-end tests pass, ./scripts/lint and go vet ./... pass, and hosted exact-head CI is green. The full local suite encountered TestFilesCreateCLICancelClosesStalledFIFO, which reproduces unchanged on current main and is unrelated to this diff.

@markstuart-oai
markstuart-oai added this pull request to the merge queue Sep 8, 2026
Merged via the queue into main with commit 265cf63 Sep 8, 2026
15 checks passed
@markstuart-oai
markstuart-oai deleted the markstuart-oai/c18-piped-query-arrays branch September 8, 2026 05:53
@openai-sdks openai-sdks Bot mentioned this pull request Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autoimprove Scoped automated improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants