Skip to content

feat(compression): add Responses tool-output engine - #8010

Merged
diegosouzapw merged 7 commits into
cheaper-inference:release/v3.8.49from
JxnLexn:dev/feat/codex-responses-compression
Jul 22, 2026
Merged

diegosouzapw merged 7 commits into
cheaper-inference:release/v3.8.49from
JxnLexn:dev/feat/codex-responses-compression

Conversation

@JxnLexn

@JxnLexn JxnLexn commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add an opt-in Responses compression engine for supported tool outputs.
  • Integrate the engine with the compression catalog, registry, stacked pipelines, database normalization, MCP schemas, and settings UI.
  • Apply conservative JSON, diff, search-result, and build/test/lint-output rewrites only when both byte and token savings are demonstrated.
  • Preserve protected tools, unsupported shapes, and uncertain output; invalid input, scanner/tokenizer errors, and configured limits fail open.
  • Keep Responses envelope restoration and live-zone prefix reuse stable for repeated requests and combo target retries.

Validation

  • npm run lint
  • npm run test:unit
  • npm run test:coverage
  • Coverage is still >= 60% for statements, lines, functions, and branches
  • SonarQube PR analysis is green or any remaining issues are explicitly documented below
  • npm run typecheck:core
  • Focused compression, adapter, live-zone, pipeline, DB, MCP, and engine-catalog tests

Tests Added Or Updated

  • Added focused Responses tool-output compression coverage for eligible output types, protected tools, fail-open behavior, configured limits, envelope restoration, and standalone/stacked execution.
  • Updated compression type coverage for the new mode and engine.

Coverage Notes

  • The new engine is covered through direct engine tests and public compression-selector pipeline tests.
  • Existing adapter, live-zone, database, MCP, settings, and pipeline tests cover integration points and non-Responses regressions.

Reviewer Notes

  • The feature is disabled by default and can be enabled independently or in a compression combo.
  • Lossy rewrites for native local-shell outputs are intentionally skipped; protected file and retrieval tools remain unchanged.
  • The implementation restores the original Responses input shape after compression so downstream providers receive their expected envelope.

@JxnLexn
JxnLexn requested a review from diegosouzapw as a code owner July 21, 2026 15:13
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d7972779d

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@JxnLexn
JxnLexn force-pushed the dev/feat/codex-responses-compression branch from 8d79727 to 5483477 Compare July 21, 2026 15:17
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@JxnLexn
JxnLexn force-pushed the dev/feat/codex-responses-compression branch from 5483477 to 5fd242d Compare July 21, 2026 15:18
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@JxnLexn
JxnLexn force-pushed the dev/feat/codex-responses-compression branch from 5fd242d to 53b52dc Compare July 21, 2026 15:19
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@JxnLexn
JxnLexn force-pushed the dev/feat/codex-responses-compression branch from 53b52dc to 6b7ccc2 Compare July 21, 2026 15:20
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

1 similar comment
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Reviewed alongside #8008/#8009. The engine logic itself is solid — ran the new codex-responses.test.ts (6/6) and the touched shared-type/registry tests (22/22) locally, both clean, and tsc -p tsconfig.typecheck-core.json is clean too. Two things to fix before merge: (1) this PR is currently CONFLICTING against release/v3.8.49 — I traced it to CompressionHub.tsx, where #7935 (already merged) converted the literal English strings you're still editing into useTranslations() calls; a rebase reconciling that should be quick. (2) codexResponses/index.ts instantiates its own private o200k_base Tiktoken encoder instead of using the shared countTextTokens/resolveTokenizerEncoding your sibling PR #8009 adds to tiktokenCounter.ts — worth reusing that once #8009 lands, both to avoid a duplicate encoder in memory and to stay on one source of truth for tokenizer selection.

@JxnLexn
JxnLexn force-pushed the dev/feat/codex-responses-compression branch from bd9b32c to 184e689 Compare July 21, 2026 21:49
@JxnLexn

JxnLexn commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I addressed both requested items.

  • Rebased the PR onto the current upstream/release/v3.8.49 tip and reconciled CompressionHub.tsx with the existing useTranslations() implementation.
  • Reused the shared model-aware tokenizer API from tiktokenCounter.ts via countTextTokens(..., { provider: "codex" }), removing the private o200k_base encoder from the Responses engine.

The updated branch is pushed to origin/dev/feat/codex-responses-compression and the PR is mergeable again. Local validation passed: the targeted compression/tokenizer suites passed 31/31, npm run lint passed, and npm run typecheck:core passed.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 184e6891bb

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread open-sse/mcp-server/schemas/tools.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f51c2b6eb7

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +138 to +142
value: "codex-responses",
labelKey: "compressionModeCodexResponses",
descKey: "compressionModeCodexResponsesDesc",
icon: "data_object",
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Synchronize engine toggles when selecting Responses mode

When an operator has saved the engine panel, enginesExplicit makes the persisted engines map authoritative and ignores defaultMode during plan resolution. This newly added Advanced settings choice only changes defaultMode (while the save request retains the existing engine map), so selecting it reports success but continues running the previously enabled engine or no engine at all. Update the codex-responses toggle map as part of this selection, or remove this choice from the legacy mode selector.

Useful? React with 👍 / 👎.

diegosouzapw and others added 3 commits July 22, 2026 06:54
The codex-responses compression engine already imports the shared
countTextTokens/resolveTokenizerEncoding from tiktokenCounter.ts (no
duplicate encoder) and CompressionSettingsTab.tsx already threads the
new mode through the existing useTranslations()/labelKey pattern - both
pre-existing on this branch tip after rebasing onto release/v3.8.49.

What was missing after the rebase: the new compressionModeCodexResponses
/ compressionModeCodexResponsesDesc keys existed only in en.json. Filled
en-fallback into all 42 locales via scripts/i18n/fill-missing-from-en.mjs
and added real pt-BR/vi translations. Also rebaselined the three files
whose own growth (new codex-responses mode wiring) crossed the frozen
file-size caps: open-sse/mcp-server/schemas/tools.ts, open-sse/services/
compression/strategySelector.ts, and src/lib/db/compression.ts.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
@diegosouzapw
diegosouzapw merged commit fb6ea29 into cheaper-inference:release/v3.8.49 Jul 22, 2026
1 of 3 checks passed
diegosouzapw added a commit that referenced this pull request Jul 24, 2026
#8010 registered the codex-responses engine in the compression catalog
(engineCatalog.ts, stackPriority 12 between rtk's 10 and headroom's 15)
but never added it to adaptiveCompression/ladder.ts's AGGRESSIVENESS and
REDUCTION_FACTOR maps. Those maps' own header documents that they must
cover every real catalog/registry engine, not just the 7 in
DEFAULT_LADDER, so an operator adding codex-responses via ladderOverride
silently fell back to aggressivenessOf() === 0 (same as "off") and
expectedReductionFactor() === 0.9 (the generic default), breaking
floor-mode escalation ranking for any ladder that includes it.

Add "codex-responses" to both maps between rtk and ionizer, matching
its stackPriority (12) sitting between rtk's (10) and ionizer's (13):
- AGGRESSIVENESS: 22 (between rtk's 20 and ionizer's 25)
- REDUCTION_FACTOR: 0.84 (between rtk's 0.85 and ionizer's 0.83),
  reflecting its "lossless-first, bounded diagnostic" guidance in
  engineCatalog.ts

Validation: tests/unit/ladder-engine-maps-6533.test.ts red -> green
(2 of 3 tests were failing on the missing engine; all 3 pass after the
fix). Sanity-checked neighbors compression-exclusions.test.ts and
compression/adaptive-resolve-plan.test.ts still pass.

Refs #8010
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…e#8010)

* Add Responses tool-output compression engine

* fix: enable Codex Responses stacked steps

* fix(compression): share Codex tokenizer and rebase UI

* fix(compression): sync MCP engine selection

* fix(compression): i18n parity for codex-responses mode + rebaseline

The codex-responses compression engine already imports the shared
countTextTokens/resolveTokenizerEncoding from tiktokenCounter.ts (no
duplicate encoder) and CompressionSettingsTab.tsx already threads the
new mode through the existing useTranslations()/labelKey pattern - both
pre-existing on this branch tip after rebasing onto release/v3.8.49.

What was missing after the rebase: the new compressionModeCodexResponses
/ compressionModeCodexResponsesDesc keys existed only in en.json. Filled
en-fallback into all 42 locales via scripts/i18n/fill-missing-from-en.mjs
and added real pt-BR/vi translations. Also rebaselined the three files
whose own growth (new codex-responses mode wiring) crossed the frozen
file-size caps: open-sse/mcp-server/schemas/tools.ts, open-sse/services/
compression/strategySelector.ts, and src/lib/db/compression.ts.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…er-inference#8381)

cheaper-inference#8010 registered the codex-responses engine in the compression catalog
(engineCatalog.ts, stackPriority 12 between rtk's 10 and headroom's 15)
but never added it to adaptiveCompression/ladder.ts's AGGRESSIVENESS and
REDUCTION_FACTOR maps. Those maps' own header documents that they must
cover every real catalog/registry engine, not just the 7 in
DEFAULT_LADDER, so an operator adding codex-responses via ladderOverride
silently fell back to aggressivenessOf() === 0 (same as "off") and
expectedReductionFactor() === 0.9 (the generic default), breaking
floor-mode escalation ranking for any ladder that includes it.

Add "codex-responses" to both maps between rtk and ionizer, matching
its stackPriority (12) sitting between rtk's (10) and ionizer's (13):
- AGGRESSIVENESS: 22 (between rtk's 20 and ionizer's 25)
- REDUCTION_FACTOR: 0.84 (between rtk's 0.85 and ionizer's 0.83),
  reflecting its "lossless-first, bounded diagnostic" guidance in
  engineCatalog.ts

Validation: tests/unit/ladder-engine-maps-6533.test.ts red -> green
(2 of 3 tests were failing on the missing engine; all 3 pass after the
fix). Sanity-checked neighbors compression-exclusions.test.ts and
compression/adaptive-resolve-plan.test.ts still pass.

Refs cheaper-inference#8010
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…e#8010)

* Add Responses tool-output compression engine

* fix: enable Codex Responses stacked steps

* fix(compression): share Codex tokenizer and rebase UI

* fix(compression): sync MCP engine selection

* fix(compression): i18n parity for codex-responses mode + rebaseline

The codex-responses compression engine already imports the shared
countTextTokens/resolveTokenizerEncoding from tiktokenCounter.ts (no
duplicate encoder) and CompressionSettingsTab.tsx already threads the
new mode through the existing useTranslations()/labelKey pattern - both
pre-existing on this branch tip after rebasing onto release/v3.8.49.

What was missing after the rebase: the new compressionModeCodexResponses
/ compressionModeCodexResponsesDesc keys existed only in en.json. Filled
en-fallback into all 42 locales via scripts/i18n/fill-missing-from-en.mjs
and added real pt-BR/vi translations. Also rebaselined the three files
whose own growth (new codex-responses mode wiring) crossed the frozen
file-size caps: open-sse/mcp-server/schemas/tools.ts, open-sse/services/
compression/strategySelector.ts, and src/lib/db/compression.ts.

Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>

---------

Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouza.pw@gmail.com>
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…er-inference#8381)

cheaper-inference#8010 registered the codex-responses engine in the compression catalog
(engineCatalog.ts, stackPriority 12 between rtk's 10 and headroom's 15)
but never added it to adaptiveCompression/ladder.ts's AGGRESSIVENESS and
REDUCTION_FACTOR maps. Those maps' own header documents that they must
cover every real catalog/registry engine, not just the 7 in
DEFAULT_LADDER, so an operator adding codex-responses via ladderOverride
silently fell back to aggressivenessOf() === 0 (same as "off") and
expectedReductionFactor() === 0.9 (the generic default), breaking
floor-mode escalation ranking for any ladder that includes it.

Add "codex-responses" to both maps between rtk and ionizer, matching
its stackPriority (12) sitting between rtk's (10) and ionizer's (13):
- AGGRESSIVENESS: 22 (between rtk's 20 and ionizer's 25)
- REDUCTION_FACTOR: 0.84 (between rtk's 0.85 and ionizer's 0.83),
  reflecting its "lossless-first, bounded diagnostic" guidance in
  engineCatalog.ts

Validation: tests/unit/ladder-engine-maps-6533.test.ts red -> green
(2 of 3 tests were failing on the missing engine; all 3 pass after the
fix). Sanity-checked neighbors compression-exclusions.test.ts and
compression/adaptive-resolve-plan.test.ts still pass.

Refs cheaper-inference#8010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants