mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-11-22 13:29:19 +08:00
refactor(proxy): remove the unreachable debug branches from the Responses unit router (#4115)
## Description This removes debug code that can never run from `_compress_openai_responses_live_text_units_with_router` in `headroom/proxy/handlers/openai.py`. `_log_codex_compression_debug` has been a no-op sincee9cae013. `_codex_compression_debug_enabled()` returns true only when something replaces that function, and only tests do that. So every `if debug_enabled:` branch in the Responses unit router is unreachable in production, along with the per-item debug dictionaries it builds. Refs #4136 ## Type of Change - [ ] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Performance improvement - [x] Code refactoring (no functional changes) ## Changes Made - Removed 13 `if debug_enabled:` blocks. - Removed the `_log` closure and its 4 call sites. - Removed the `extraction_debug` and `unit_debug` lists, and the `excluded_folded` flag that only fed a debug record. - Removed the `pass_id` parameter, which was `None` whenever debug was off. Its one caller no longer passes it. - Removed `_json_shape` (a copy of the one in `content_router.py`) and `_routing_log_debug` (it returned `[]`). Their only callers were the removed branches. - Control flow is unchanged: - Every `continue` stays. - Two `else:` arms that held only debug appends are gone. - `if slots: for ...` became the plain `for` loop. Looping over an empty list does nothing, so this is equivalent. - Tests: - `tests/test_openai_responses_compression_units.py`: dropped the monkeypatch that switched the sink on, and kept the case-insensitive exclusion assertions. - `tests/test_openai_responses_read_protection.py`: same change in two tests, renamed to say what they check: the excluded list output and the read-protected output are forwarded unchanged. ## Testing - [x] Unit tests pass (`pytest`) - [x] Linting passes (`ruff check .`) - [x] Type checking passes (`mypy headroom`) - [ ] New tests added for new functionality - [ ] Manual testing performed ### Test Output ```text $ uvx ruff@0.16.8 check headroom/proxy/handlers/openai.py tests/test_openai_responses_compression_units.py tests/test_openai_responses_read_protection.py All checks passed! $ python -m mypy headroom/proxy/handlers/openai.py --ignore-missing-imports Success: no issues found in 1 source file $ pytest -q tests/test_openai_responses_compression_units.py tests/test_openai_responses_read_protection.py tests/test_openai_responses_context_compaction.py tests/test_openai_codex_ws_timings.py tests/test_codex_openai_contract_parity.py tests/test_openai_responses_t3_replay_regression.py 94 passed in 5.14s $ pytest -q tests/test_openai_codex_ws_lifecycle.py 53 passed in 3.12s $ pytest -q tests/test_openai_responses_additional_tools.py tests/test_proxy_openai_responses_integration.py tests/test_codex_ws_compression_scheduler.py tests/test_openai_responses_traffic_learner.py tests/test_openai_responses_output_shaper.py tests/test_proxy_openai_responses_stream_ccr.py 39 passed, 15 skipped in 14.47s ``` ## Real Behavior Proof - Environment: macOS, Python 3.12, repo venv, branch `cleanup/proxy-handlers-codex-debug-units` @b1bc6682, temp `HOME`/`HEADROOM_WORKSPACE_DIR`/`CODEX_HOME`, `HEADROOM_OFFLINE=1` - Exact command / steps: (1) the shared smoke harness: a real `headroom proxy` from this checkout against a local fake upstream, with one Anthropic and one OpenAI chat turn carrying a compressible tool result; (2) a direct run of the real app (`create_app` + TestClient) sending one `/v1/responses` turn whose `function_call_output` is a 25 KB JSON array. This goes through `_compress_openai_responses_payload` and the live-text-unit router this PR edits. The upstream send is replaced, which records the forwarded body. - Observed result: shown below. Both smoke turns return 200 with savings. The Responses turn returns 200, the tool output is forwarded compressed (25008 → 8261 bytes) and `/stats` books the saving. `origin/main` gives the same three numbers for (2), so compression output is unchanged. - Not tested: a real Codex client or hosted upstream, and the Codex WebSocket path ```text $ bash smoke.sh <worktree> branch: cleanup/proxy-handlers-codex-debug-units @b1bc6682health: 200 POST /v1/messages -> HTTP200 smoke-ok POST /v1/chat/completions -> HTTP200 smoke-ok stats: requests=2 failed=0 tokens_saved=13574 savings_percent=99.82 proxy.log WARNING/ERROR lines: (only the pre-existing offline-mode notice and Kompress offline-prefetch warnings) $ HOME=$T/h HEADROOM_WORKSPACE_DIR=$T/ws CODEX_HOME=$T/c HEADROOM_OFFLINE=1 python proof_responses.py status: 200 ok tool output bytes: client 25008 -> forwarded 8261 stats requests: 1 tokens_saved: 6787 ``` ## Runtime Rollout Safety - Rollout-managed feature(s): none - Minimum rollout channel: stable - Stable/default behavior changed: no; only branches gated on a flag that is never true in production are removed - Kill switch / disable path: not applicable (dead code removal) - Unsafe override required: no - Qualification impact: none - Rollback path: revert this commit ## Review Readiness - [x] I have performed a self-review - [x] This PR is ready for human review ## Checklist - [x] My code follows the project's style guidelines - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] I did **not** edit `CHANGELOG.md` — it is generated by release-please from my Conventional Commit PR title (a CI guard enforces this) ## Screenshots (if applicable) N/A ## Additional Notes Part of maintainer-requested cleanup #4136 (dead code, duplication, debuggability), split into small PRs for review. - `tests/test_openai_codex_ws_lifecycle.py` segfaults in a native worker thread when it runs in one pytest process after the other Responses test files. The same combined run segfaults on clean `origin/main`, so it is pre-existing. That is why it was run on its own. - The shared sink itself (`_log_codex_compression_debug`, `_CODEX_COMPRESSION_DEBUG_NOOP`, `_codex_compression_debug_enabled`, 9 lines) stays until this PR and its sibling `cleanup/proxy-handlers-codex-debug-payload` have both merged; a one-commit follow-up then deletes it. The two PRs touch different methods, so they merge in either order. - Split from one larger change (about 560 deleted lines) to keep each PR reviewable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
abbf36f052
commit
25cc2d5863
@@ -777,27 +777,6 @@ def _codex_compression_debug_enabled() -> bool:
|
||||
return _log_codex_compression_debug is not _CODEX_COMPRESSION_DEBUG_NOOP
|
||||
|
||||
|
||||
def _json_shape(value: str) -> dict[str, Any]:
|
||||
try:
|
||||
parsed = json.loads(value)
|
||||
except Exception as exc:
|
||||
return {"is_json": False, "error": type(exc).__name__}
|
||||
if isinstance(parsed, dict):
|
||||
return {
|
||||
"is_json": True,
|
||||
"kind": "object",
|
||||
"keys": list(parsed.keys()),
|
||||
"length": len(parsed),
|
||||
}
|
||||
if isinstance(parsed, list):
|
||||
return {"is_json": True, "kind": "array", "length": len(parsed)}
|
||||
return {"is_json": True, "kind": type(parsed).__name__}
|
||||
|
||||
|
||||
def _routing_log_debug(_router_result: Any) -> list[dict[str, Any]]:
|
||||
return []
|
||||
|
||||
|
||||
_OPENAI_TOOL_SCHEMA_DROP_KEYS = {
|
||||
"$id",
|
||||
"$schema",
|
||||
@@ -2138,7 +2117,6 @@ class OpenAIHandlerMixin:
|
||||
*,
|
||||
model: str,
|
||||
request_id: str,
|
||||
pass_id: str | None = None,
|
||||
timing: dict[str, float] | None = None,
|
||||
deadline_started_at: float | None = None,
|
||||
) -> tuple[dict[str, Any], bool, int, list[str], dict[str, int], list[str], int]:
|
||||
@@ -2152,18 +2130,6 @@ class OpenAIHandlerMixin:
|
||||
are intentionally not exposed as text units.
|
||||
"""
|
||||
|
||||
debug_enabled = _codex_compression_debug_enabled()
|
||||
|
||||
def _log(_event: str, **_fields: Any) -> None:
|
||||
if debug_enabled:
|
||||
_log_codex_compression_debug(
|
||||
_event,
|
||||
request_id=request_id,
|
||||
pass_id=pass_id,
|
||||
model=model,
|
||||
**_fields,
|
||||
)
|
||||
|
||||
input_items = payload.get("input")
|
||||
messages_items = payload.get("messages")
|
||||
items = input_items if isinstance(input_items, list) else messages_items
|
||||
@@ -2408,7 +2374,6 @@ class OpenAIHandlerMixin:
|
||||
# (item_index, slot_ref, folded_text, original_text). Spliced after the
|
||||
# normal candidate compression — no ML, byte/data-lossless only.
|
||||
lossless_excluded: list[tuple[int, tuple[str, int | None], str, str]] = []
|
||||
extraction_debug: list[dict[str, Any]] = []
|
||||
last_user_item_idx = max(
|
||||
(
|
||||
idx
|
||||
@@ -2421,65 +2386,20 @@ class OpenAIHandlerMixin:
|
||||
)
|
||||
for idx, item in enumerate(items):
|
||||
if not isinstance(item, dict):
|
||||
if debug_enabled:
|
||||
extraction_debug.append(
|
||||
{
|
||||
"index": idx,
|
||||
"eligible": False,
|
||||
"reason": "item_not_dict",
|
||||
"item_type": type(item).__name__,
|
||||
"item": item,
|
||||
}
|
||||
)
|
||||
continue
|
||||
item_type = item.get("type")
|
||||
if item_type in self.OPENAI_RESPONSES_OUTPUT_TYPES:
|
||||
call_id = item.get("call_id")
|
||||
if isinstance(call_id, str) and call_id in headroom_retrieve_call_ids:
|
||||
if debug_enabled:
|
||||
extraction_debug.append(
|
||||
{
|
||||
"index": idx,
|
||||
"eligible": False,
|
||||
"reason": "headroom_retrieve_output_protected",
|
||||
"item_type": item_type,
|
||||
"call_id": call_id,
|
||||
"item": item,
|
||||
}
|
||||
)
|
||||
continue
|
||||
if isinstance(call_id, str) and call_id in read_command_by_call_id:
|
||||
# Finalize by CONTENT (same gate as ContentRouter.apply):
|
||||
# protect unless the output is confidently non-code DATA.
|
||||
if _read_output_should_be_protected(_responses_part_text(item.get("output"))):
|
||||
read_protected_call_ids.add(call_id)
|
||||
if debug_enabled:
|
||||
extraction_debug.append(
|
||||
{
|
||||
"index": idx,
|
||||
"eligible": False,
|
||||
"reason": "read_command_protected",
|
||||
"item_type": item_type,
|
||||
"call_id": call_id,
|
||||
"command": read_command_by_call_id[call_id],
|
||||
"item": item,
|
||||
}
|
||||
)
|
||||
continue
|
||||
if isinstance(call_id, str) and call_id in excluded_call_ids:
|
||||
if call_id in verbatim_excluded_call_ids:
|
||||
if debug_enabled:
|
||||
extraction_debug.append(
|
||||
{
|
||||
"index": idx,
|
||||
"eligible": False,
|
||||
"reason": "exclude_tools_verbatim",
|
||||
"item_type": item_type,
|
||||
"call_id": call_id,
|
||||
"tool_name": function_name_by_call_id.get(call_id),
|
||||
"item": item,
|
||||
}
|
||||
)
|
||||
continue
|
||||
# Protected from lossy compression — but grep/log/json output
|
||||
# can still be losslessly compacted. Reuse the router helper
|
||||
@@ -2490,10 +2410,9 @@ class OpenAIHandlerMixin:
|
||||
# A file read skips the fold entirely: this is the Codex wire,
|
||||
# where `read` really does return raw file bytes, so a fold here
|
||||
# is exactly what breaks the next `Edit(old_string=…)`.
|
||||
excluded_folded = False
|
||||
raw_output = item.get("output")
|
||||
if call_id in byte_exact_call_ids:
|
||||
pass # byte-exact: no fold, fall through to the debug record
|
||||
pass # byte-exact: no fold
|
||||
elif isinstance(raw_output, list):
|
||||
for pidx, part in enumerate(raw_output):
|
||||
if (
|
||||
@@ -2504,7 +2423,6 @@ class OpenAIHandlerMixin:
|
||||
part_text = part["text"]
|
||||
pf = router._lossless_compact_excluded(part_text)
|
||||
if pf is not None:
|
||||
excluded_folded = True
|
||||
lossless_excluded.append(
|
||||
(idx, ("output_part", pidx), pf[0], part_text)
|
||||
)
|
||||
@@ -2512,128 +2430,20 @@ class OpenAIHandlerMixin:
|
||||
excl_out = _responses_part_text(raw_output)
|
||||
fold = router._lossless_compact_excluded(excl_out) if excl_out else None
|
||||
if fold is not None:
|
||||
excluded_folded = True
|
||||
lossless_excluded.append((idx, ("output", None), fold[0], excl_out))
|
||||
if debug_enabled:
|
||||
extraction_debug.append(
|
||||
{
|
||||
"index": idx,
|
||||
"eligible": False,
|
||||
"reason": (
|
||||
"exclude_tools_lossless_fold"
|
||||
if excluded_folded
|
||||
else "exclude_tools_protected"
|
||||
),
|
||||
"item_type": item_type,
|
||||
"call_id": call_id,
|
||||
"tool_name": function_name_by_call_id.get(call_id),
|
||||
"item": item,
|
||||
}
|
||||
)
|
||||
continue
|
||||
slots = _slot_texts(item)
|
||||
if slots:
|
||||
for text, slot_ref in slots:
|
||||
candidates.append((idx, slot_ref, text))
|
||||
if debug_enabled:
|
||||
extraction_debug.append(
|
||||
{
|
||||
"index": idx,
|
||||
"eligible": True,
|
||||
"item_type": item_type,
|
||||
"role": item.get("role"),
|
||||
"slot": slot_ref,
|
||||
"text_chars": len(text),
|
||||
"text_bytes": len(text.encode("utf-8", errors="replace")),
|
||||
"text_json_shape": _json_shape(text),
|
||||
"item": item,
|
||||
"text": text,
|
||||
}
|
||||
)
|
||||
else:
|
||||
if debug_enabled:
|
||||
extraction_debug.append(
|
||||
{
|
||||
"index": idx,
|
||||
"eligible": False,
|
||||
"reason": "output_type_without_text_slot",
|
||||
"item_type": item_type,
|
||||
"item": item,
|
||||
}
|
||||
)
|
||||
elif item_type == "message":
|
||||
if item.get("role") == "user" and idx == last_user_item_idx:
|
||||
if debug_enabled:
|
||||
extraction_debug.append(
|
||||
{
|
||||
"index": idx,
|
||||
"eligible": False,
|
||||
"reason": "current_user_message_protected",
|
||||
"item_type": item_type,
|
||||
"role": item.get("role"),
|
||||
"item": item,
|
||||
}
|
||||
)
|
||||
continue
|
||||
slots = _slot_texts(item)
|
||||
for text, slot_ref in slots:
|
||||
candidates.append((idx, slot_ref, text))
|
||||
if debug_enabled:
|
||||
extraction_debug.append(
|
||||
{
|
||||
"index": idx,
|
||||
"eligible": True,
|
||||
"item_type": item_type,
|
||||
"role": item.get("role"),
|
||||
"slot": slot_ref,
|
||||
"text_chars": len(text),
|
||||
"text_bytes": len(text.encode("utf-8", errors="replace")),
|
||||
"text_json_shape": _json_shape(text),
|
||||
"item": item,
|
||||
"text": text,
|
||||
}
|
||||
)
|
||||
if not slots and debug_enabled:
|
||||
extraction_debug.append(
|
||||
{
|
||||
"index": idx,
|
||||
"eligible": False,
|
||||
"reason": "supported_type_without_text_slot",
|
||||
"item_type": item_type,
|
||||
"item": item,
|
||||
}
|
||||
)
|
||||
else:
|
||||
if debug_enabled:
|
||||
extraction_debug.append(
|
||||
{
|
||||
"index": idx,
|
||||
"eligible": False,
|
||||
"reason": "unsupported_item_type",
|
||||
"item_type": item_type,
|
||||
"role": item.get("role"),
|
||||
"item": item,
|
||||
}
|
||||
)
|
||||
elif item_type == "message":
|
||||
if item.get("role") == "user" and idx == last_user_item_idx:
|
||||
continue
|
||||
slots = _slot_texts(item)
|
||||
for text, slot_ref in slots:
|
||||
candidates.append((idx, slot_ref, text))
|
||||
|
||||
_add_timing("compression_live_unit_extraction", extraction_started)
|
||||
_log(
|
||||
"codex_compression_extraction",
|
||||
item_count=len(items),
|
||||
candidate_count=len(candidates),
|
||||
payload=payload,
|
||||
extraction=extraction_debug,
|
||||
)
|
||||
if not candidates and not lossless_excluded:
|
||||
_log(
|
||||
"codex_compression_payload_result",
|
||||
modified=False,
|
||||
reason="no_candidates",
|
||||
tokens_saved_total=0,
|
||||
transforms=[],
|
||||
input_payload=payload,
|
||||
output_payload=payload,
|
||||
)
|
||||
return payload, False, 0, [], {}, [], 0
|
||||
|
||||
deepcopy_started = time.perf_counter()
|
||||
@@ -2662,7 +2472,6 @@ class OpenAIHandlerMixin:
|
||||
routed_units: list[RoutedCompressionUnit] = []
|
||||
|
||||
unit_build_started = time.perf_counter()
|
||||
unit_debug: list[dict[str, Any]] = []
|
||||
for item_idx, slot_ref, original_text in candidates:
|
||||
item = items[item_idx] if item_idx < len(items) else {}
|
||||
item_type = item.get("type", "unknown") if isinstance(item, dict) else "unknown"
|
||||
@@ -2689,34 +2498,10 @@ class OpenAIHandlerMixin:
|
||||
metadata=metadata,
|
||||
)
|
||||
routed_units.append(RoutedCompressionUnit(unit=unit, slot=(item_idx, slot_ref)))
|
||||
if debug_enabled:
|
||||
unit_debug.append(
|
||||
{
|
||||
"item_index": item_idx,
|
||||
"slot": slot_ref,
|
||||
"provider": unit.provider,
|
||||
"endpoint": unit.endpoint,
|
||||
"role": unit.role,
|
||||
"item_type": unit.item_type,
|
||||
"cache_zone": unit.cache_zone,
|
||||
"mutable": unit.mutable,
|
||||
"min_bytes": unit.min_bytes,
|
||||
"text_chars": len(unit.text),
|
||||
"text_bytes": len(unit.text.encode("utf-8", errors="replace")),
|
||||
"text_json_shape": _json_shape(unit.text),
|
||||
"text": unit.text,
|
||||
}
|
||||
)
|
||||
_add_timing("compression_unit_build", unit_build_started)
|
||||
|
||||
_log(
|
||||
"codex_compression_units",
|
||||
units=unit_debug,
|
||||
)
|
||||
|
||||
# Tally per-category counts as units stream in so the pass_summary
|
||||
# event below can emit a one-line breakdown — log readers shouldn't
|
||||
# have to re-aggregate from scattered unit_result events.
|
||||
# Per-category unit counts and the union of strategy chains, returned
|
||||
# to the caller with the compressed payload.
|
||||
units_by_category: dict[str, int] = {}
|
||||
strategy_chain_union: list[str] = []
|
||||
|
||||
@@ -2937,33 +2722,6 @@ class OpenAIHandlerMixin:
|
||||
# role-protected, or in a frozen cache_zone don't count.
|
||||
if result.router_result is not None or result.modified:
|
||||
attempted_input_tokens += result.tokens_before
|
||||
if debug_enabled:
|
||||
_log(
|
||||
"codex_compression_unit_result",
|
||||
item_index=item_idx,
|
||||
slot=slot_ref,
|
||||
modified=result.modified,
|
||||
reason=result.reason,
|
||||
reason_category=cat,
|
||||
text_bytes=result.text_bytes,
|
||||
min_bytes=result.min_bytes,
|
||||
strategy=result.strategy,
|
||||
strategy_chain=router_chain,
|
||||
tokens_before=result.tokens_before,
|
||||
tokens_after=result.tokens_after,
|
||||
tokens_saved=result.tokens_saved,
|
||||
transforms_applied=result.transforms_applied,
|
||||
router_strategy=(
|
||||
result.router_result.strategy_used.value if result.router_result else None
|
||||
),
|
||||
router_summary=result.router_result.summary() if result.router_result else None,
|
||||
router_routing_log=_routing_log_debug(result.router_result),
|
||||
router_cache_hit=(
|
||||
result.router_result.cache_hit if result.router_result else False
|
||||
),
|
||||
original=result.original,
|
||||
compressed=result.compressed,
|
||||
)
|
||||
if not result.modified:
|
||||
continue
|
||||
|
||||
@@ -3015,17 +2773,6 @@ class OpenAIHandlerMixin:
|
||||
if "router:responses_cross_turn_dedup" not in transforms:
|
||||
transforms.append("router:responses_cross_turn_dedup")
|
||||
|
||||
_log(
|
||||
"codex_compression_payload_result",
|
||||
modified=modified,
|
||||
tokens_saved_total=tokens_saved_total,
|
||||
attempted_input_tokens=attempted_input_tokens,
|
||||
transforms=transforms,
|
||||
units_by_category=units_by_category,
|
||||
strategy_chain=strategy_chain_union,
|
||||
input_payload=payload,
|
||||
output_payload=updated if modified else payload,
|
||||
)
|
||||
return (
|
||||
updated,
|
||||
modified,
|
||||
@@ -3311,7 +3058,6 @@ class OpenAIHandlerMixin:
|
||||
working,
|
||||
model=model,
|
||||
request_id=request_id,
|
||||
pass_id=pass_id,
|
||||
timing=timing_sink,
|
||||
deadline_started_at=deadline_started_at,
|
||||
)
|
||||
|
||||
@@ -882,14 +882,12 @@ def test_openai_responses_adapter_never_folds_a_file_read(tool, as_content_part)
|
||||
assert new_payload["input"][1]["output"] == output
|
||||
|
||||
|
||||
def test_openai_responses_adapter_excludes_tool_case_insensitively_with_debug(monkeypatch):
|
||||
"""Excluded match is case-insensitive, and the debug path stays exercised.
|
||||
def test_openai_responses_adapter_excludes_tool_case_insensitively():
|
||||
"""Excluded match is case-insensitive.
|
||||
|
||||
The configured name is lowercase only; the call advertises a mixed-case
|
||||
name, so the protection must hit via the lowercased fallback. Debug logging
|
||||
is enabled so the protected-extraction debug record is also covered.
|
||||
name, so the protection must hit via the lowercased fallback.
|
||||
"""
|
||||
monkeypatch.setattr(openai_handler, "_log_codex_compression_debug", lambda *_a, **_k: None)
|
||||
router = ContentRouter()
|
||||
router.config.exclude_tools = {"serena.find_symbol"}
|
||||
|
||||
|
||||
@@ -384,12 +384,9 @@ def test_responses_protected_read_survives_cross_turn_dedup(monkeypatch):
|
||||
assert new_payload["input"][3]["output"] == _NL_OUTPUT
|
||||
|
||||
|
||||
def test_responses_debug_path_with_excluded_list_output(monkeypatch):
|
||||
"""Regression: debug logging over an excluded tool's content-part output must
|
||||
not raise (latent unbound `fold` variable in the list branch)."""
|
||||
from headroom.proxy.handlers import openai as openai_handler
|
||||
|
||||
monkeypatch.setattr(openai_handler, "_log_codex_compression_debug", lambda *a, **k: None)
|
||||
def test_responses_excluded_list_output_does_not_raise():
|
||||
"""An excluded tool's content-part output takes the list branch without
|
||||
raising and is forwarded unchanged."""
|
||||
handler = _handler_with_router(_lossy_router())
|
||||
parts = [{"type": "output_text", "text": _FILE_CONTENT}]
|
||||
payload = {
|
||||
@@ -468,11 +465,8 @@ def test_responses_local_shell_call_string_command_read_stays_verbatim(monkeypat
|
||||
assert new_payload["input"][1]["output"] == _NL_OUTPUT
|
||||
|
||||
|
||||
def test_responses_debug_path_with_read_protected_output(monkeypatch):
|
||||
"""Debug logging over a read-protected output records and does not raise."""
|
||||
from headroom.proxy.handlers import openai as openai_handler
|
||||
|
||||
monkeypatch.setattr(openai_handler, "_log_codex_compression_debug", lambda *a, **k: None)
|
||||
def test_responses_read_protected_output_is_forwarded_unchanged(monkeypatch):
|
||||
"""A read-protected output does not raise and reaches the model verbatim."""
|
||||
monkeypatch.setenv("HEADROOM_PROTECT_READS", "1")
|
||||
handler = _handler_with_router(_lossy_router())
|
||||
payload = {
|
||||
|
||||
Reference in New Issue
Block a user