fix(codex): avoid raw hints for non-authoritative rewrites - #214
Open
hxy91819 wants to merge 2 commits into
Open
fix(codex): avoid raw hints for non-authoritative rewrites#214hxy91819 wants to merge 2 commits into
hxy91819 wants to merge 2 commits into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
Codex PostToolUse previously added a
tokenjuice wrap --rawrecovery hint to every replacement, including normalized/status/formatting-only rewrites where no authoritative content omission was reported. This trained the agent to discard usable context and rerun commands unnecessarily.This PR now closes both paths that caused unnecessary raw retrieval:
compaction.authoritative === truecodex-post-tool-use --no-omitThe second change is necessary because Codex launches hooks from its own process, which may not inherit
TOKENJUICE_NO_OMISSION=1loaded by the Bash tool's login shell.doctor codexdetects an installed hook that no longer matches the requested no-omit policy and recommends reinstalling it.authoritative: falsemeans no authoritative omission was reported; it does not claim byte-for-byte or formatting preservation. Other host adapters and public reduction APIs are unchanged.Reproduction
In the affected environment:
TOKENJUICE_NO_OMISSION=1tokenjuice wrap --rawWith the updated installed command, the same hook input keeps the original result, records
noOmit: trueandcompaction.authoritative: false, and emits no raw hint even when the hook process environment does not contain the variable.Existing Codex hooks must be reinstalled after changing the no-omit policy:
Tests
env -u TOKENJUICE_NO_OMISSION pnpm verifyenv -u TOKENJUICE_NO_OMISSION pnpm e2e:localenv -u TOKENJUICE_NO_OMISSION pnpm exec vitest run test/hosts/codex.test.ts test/cli/main.test.tsdf734a6: clean, no accepted/actionable findingsThe focused coverage verifies non-authoritative rewrites, authoritative omissions, install-time no-omit capture, stale-hook diagnosis, CLI propagation, and explicit no-omit runtime passthrough.
Compatibility
Existing hooks without
--no-omitkeep their previous default behavior. Users who enable or disable no-omit should reruntokenjuice install codex;doctor codexreports the mismatch until they do.