Skip to content

feat(compaction): explicit native protocol capabilities for Responses gateways - #6759

Draft
fliaping wants to merge 7 commits into
lidge-jun:devfrom
fliaping:feat/native-compact-gateway
Draft

fliaping wants to merge 7 commits into
lidge-jun:devfrom
fliaping:feat/native-compact-gateway

Conversation

@fliaping

@fliaping fliaping commented Oct 8, 2026 •

Copy link
Copy Markdown

Summary

  • Add independent opt-ins for native Responses v2 compaction_trigger and v1 /responses/compact. Custom gateways retain portable summaries by default. Generation capability does not imply ciphertext replay, OpenAI identity or permission to forward caller credentials.
  • Custom native v1 reuses normal Responses URL/header construction for key/local/forward routes and ordinary replay sanitization: explicit plaintext/metadata preservation, null-channel omission, drop-reasoning and strict adjacency policy. Generic OAuth retains routed compaction with its existing credential selection/refresh/dispatch fence; native v2 remains independent.
  • Validate successful nonempty native v1 replacement history before committing serving/replay provenance. Failed/empty/malformed HTTP 200 bodies preserve the prior identity. Cross-provider overrides and v1 fallback remain portable; canonical transport retains its existing policy. Update provider/configuration/protocol documentation and wire-level regressions.

Verification

  • Pushed head: b93c76f936fa6a2c8c2ab928d2dca60d521b61ee; contained/current dev: 7af092ca4f78828238b425bf351d5989e237f89f. Original contributor commit 61afaab15b5302dc10a954725bd2e14c69cee34e remains an ancestor. Normal push to the existing contributor branch; no force push/rebase.
  • OCX_TEST_NO_QUEUE=1 bun run scripts/test.ts --parallel=2 tests/responses/native-compaction-oauth.test.ts tests/responses/native-compaction-provenance.test.ts tests/responses/native-compaction-gateway.test.ts tests/responses/native-compaction-gateway-policy.test.ts tests/responses/responses-compaction.test.ts tests/responses/responses-compaction-routing.test.ts tests/responses/responses-compaction-policy-identity.test.ts tests/responses/responses-compaction-override.test.ts tests/responses/responses-compaction-recovery.test.ts tests/responses/responses-compaction-recovery-policy.test.ts tests/responses/responses-canonical-only-top-level-fields.test.ts tests/responses/responses-opaque-blob-recovery.test.ts tests/responses/opaque-blob-wrapped-rejection.test.ts tests/adapters/reasoning-replay-identity.test.ts tests/adapters/reasoning-replay-robustness.test.ts tests/lib/reasoning-replay-scope-source.test.ts tests/providers/deepseek-reasoning-replay.test.ts: 636 pass / 0 fail, 17 files.
  • New OAuth real-handler fixture: 6 pass / 0 fail, true/false/unset authenticated routed sends and missing-login zero inference; account/snapshot spies restore after each case. Removing only the OAuth direct-v1 guard produced 4 pass / 2 fail, then the guard was restored. Native v2 declaration remains enabled in these controls.
  • Earlier provenance mutation red proof 19 pass / 50 fail became 69 green new cases; earlier strict plaintext proof 86 pass / 2 fail became 88 green policy cases. These regressions are included in the final 636-case batch.
  • bun run typecheck, bun run structure:check, bun run privacy:scan: exit 0. Layout/tooling/ratchet/Lab guard batch initially 52 pass / 1 fail only for new seed classification. Corrected both seed regexes; final layout/tooling 19 pass / 0 fail. Ratchet 9 and Lab 25 passed before the seed-only correction; caps unchanged and both inventories registered.
  • Final bun run --cwd docs-site build: exit 0, 569 pages / 79,338 internal links. No dependency declarations/lockfiles changed.
  • Fresh independent gpt-6.1-sol full-diff and explicit security review PASS at b93c76f936fa6a2c8c2ab928d2dca60d521b61ee against dev 7af092ca4f78828238b425bf351d5989e237f89f: all 30 changed files reviewed, no concrete P0–P2 findings; 168 pure in-memory checks passed with zero network sends. Explicit maintainer security/merge disposition remains with the coordinator.
  • Concurrent-resource exception: full local and unfiltered changed-suite execution omitted. The changed graph selected 1,782 files with zero executed cases under a no-match selection probe, which is not a correctness pass. Focused coverage above exercises the changed contracts; full-suite, live upstream, required hosted and cross-platform CI remain with the coordinator's final integration.
  • PR remains draft. No merge, hosted dispatch/approval/wait, label or readiness change performed by this lane.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Review readiness checklist

  • Required local validation passed; commands, results, and any full-suite exception are documented.
  • I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
  • I resolved all correct Codex and CodeRabbit findings.
  • My PR is ready for review.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions github-actions Bot added the intake: hygiene-blocked Deterministic PR hygiene checks failed label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

⚠️ Deterministic hygiene checks failed.

  • unsponsored_surface — This changes an authentication, workflow, release-automation, or dependency surface. MAINTAINERS.md requires security review for these; ask a maintainer to apply maintainer-sponsored once they have reviewed it. Paths: src/server/auth-cors.ts.

@github-actions github-actions Bot added the enhancement New feature or request label Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

⏳ DRAFT

  • hygiene: unsponsored_surface.

What to do

  • Fix unsponsored_surface — This changes an authentication, workflow, release-automation, or dependency surface. MAINTAINERS.md requires security review for these; ask a maintainer to apply maintainer-sponsored once they have reviewed it. Paths: src/server/auth-cors.ts.
  • Tick all four boxes in the PR description once you're done (currently 2/4).

Review readiness checklist

  • ✅ Required local validation passed; commands, results, and any full-suite exception are documented.
  • ✅ I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
  • ⬜ I resolved all correct Codex and CodeRabbit findings.
  • ⬜ My PR is ready for review.

2/4 boxes ticked.

This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.
@fliaping Tick the boxes once required local validation has passed with commands, results, and any full-suite exception documented, your branch is on the latest dev commit, and every correct Codex and CodeRabbit finding is resolved.

@fliaping

fliaping commented Oct 8, 2026 •

Copy link
Copy Markdown
Author

@lidge-jun This draft is blocked by unsponsored_surface on src/server/auth-cors.ts. Could a maintainer review the security boundary and, if satisfied, apply maintainer-sponsored? That file adds the two new capability fields at the existing editor policy level beside decodesNativeCompactionBlobs; it does not grant canonical identity or caller credential forwarding. The shared transport and compact-v1 metadata/replay handling were also independently reviewed, with no remaining security or logic findings after the regression fixes. Head: 61afaab15b5302dc10a954725bd2e14c69cee34e. Local focused validation and the full-suite resource exception are documented in the description. Required upstream CI has not passed, and CodeRabbit skipped this draft; I am keeping it in draft rather than marking it ready or applying an approval label myself. Live sub2api evidence supports v2 generation plus replay only; its native v1 endpoint is explicitly documented as unsupported in that deployment.

@Ingwannu Both failed checks (hygiene and enforce-target) report the same unsponsored_surface requirement, not a compile/test failure. Could either maintainer perform the required security review and apply maintainer-sponsored if approved? The fork author cannot submit a formal reviewer request (GitHub returned a permission error), so this comment is the review request. The label should trigger both gates to reevaluate; no source or workflow changes are needed to hide or bypass the requirement.

@Ingwannu

Copy link
Copy Markdown
Owner

For the explicit review request: I confirmed head 61afaab15b5302dc10a954725bd2e14c69cee34e and the current unsponsored_surface hold. The schema/editor mapping and the transport/replay contract require their own explicit boundary review; author-reported or model-reported validation is not that sign-off. I have not completed that review in this pass and am not adding maintainer-sponsored as a gate workaround.

Cross-platform CI 37765275217 and React Doctor 37765275223 remain action_required, not compile/test failures or passing execution. Keep Draft and retain the documented v2-generation/replay versus unsupported native-v1 distinction. No workflow execution, scan or sponsorship label was authorized here.

This branch has not been deployed

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

Labels

enhancement New feature or request intake: hygiene-blocked Deterministic PR hygiene checks failed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants