Repository navigation
fix(codex-memory-plugin): stop PostToolUse usage hook from injecting additionalContext - #5738
Merged
ZaynJarvis merged 2 commits intoOct 8, 2026
Conversation
…additionalContext Codex inserts PostToolUse additionalContext as a developer message right after the tool output. With parallel tool calls this lands between function_call_outputs of one batch, which strict Responses-API providers reject with 400 InvalidParameter. The lookup hook now only records lookups; the Stop hook and the recall footer keep reporting usage.
…files Declare usageView (OPENVIKING_USAGE_VIEW) and usageOutput (OPENVIKING_USAGE_OUTPUT) as shared knobs so the OV-Usage footer can be configured in ovcli.conf's plugin / plugin.codex section, the workspace config (usage.view / usage.output), or ov.conf's codex section. The env vars still win and the defaults are unchanged. Bump every plugin that ships the shared config schema.
t0saki
marked this pull request as ready for review
October 8, 2026 07:01
ZaynJarvis
approved these changes
Oct 8, 2026
This was referenced Oct 8, 2026
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.
Description
The daily integration case
journey-g01-a-codex-cli-to-codex-cli-model-observedfailed two runs in a row: the model provider returned 400 InvalidParameter, the turn ended withturn.failed, andcodexexited 1. The rejected request had adevelopermessage sitting between twofunction_call_outputitems that belonged to the same tool-call batch.Root cause chain:
scripts/usage/track-lookup.mjsas aPostToolUsehook (matcherBash|(?:functions\.)?exec|mcp__.*openviking.*__.*). In desktop output mode it returnedhookSpecificOutput.additionalContextcarrying the current-turn usage footer fromanswerContext(...).PostToolUseadditionalContext as adevelopermessage immediately after that tool's output.function_call_outputitems of the same batch.Fix:
track-lookup.mjsnow only records the lookup and always returns{}. Lookup data still reaches the user through the existingStophook (report.mjs) in terminal mode, and the desktop footer is still supplied by theUserPromptSubmitrecall hook, which runs before any tool call and so cannot split a tool-output batch. The trade-off is that the desktop model-rendered footer no longer includes explicit lookups made during the turn; terminal reports are unchanged.Second change: OV-Usage was configurable only through
OPENVIKING_USAGE_VIEW/OPENVIKING_USAGE_OUTPUT. Both are now shared knobs (usageView,usageOutput) inconfig-schema.mjs, so they can also be set in ovcli.conf'splugin/plugin.codexsection, a workspace config file (usage.view/usage.output), or ov.conf's legacycodexsection. The env vars still win, the defaults (summary,auto) are unchanged, and the accepted spellings (off/false/0/disabled,expanded/full/details, case-insensitive) are unchanged. The usage hooks read the value from the plugin's existingloadConfig(); auto-recall passes its already-loaded config.Human Involvement
Related Issue
Regression from #5699.
Type of Change
Changes Made
scripts/usage/track-lookup.mjs: stop returningadditionalContextfrom thePostToolUsehook; drop the per-call transcript recall read and footer rendering that only fed it.scripts/marketplace.test.mjs: assert the lookup hook returns{}in both desktop and terminal modes, and verify lookup attribution through theStopreport instead of the hook output.README.md: describe the lookup hook as record-only and explain why it never returnsadditionalContext.memory-plugin-shared/lib/config-schema.mjs: addusageView(envOPENVIKING_USAGE_VIEW, workspaceusage.view) andusageOutput(envOPENVIKING_USAGE_OUTPUT, workspaceusage.output); synced vendored copies;examples/schemas/workspace-config-v1.jsongains ausagesection.scripts/usage/{settings,display,report,track-lookup}.mjs,scripts/auto-recall.mjs: read the resolved config instead of rawprocess.env.scripts/config.test.mjs: config file disables usage, workspace sets output, env overrides the file.docs/{en,zh}/configuration/02-client.mdworkspace key table.Testing
node --test examples/codex-memory-plugin/scripts/*.test.mjs: 189 passed, 0 failed.examples/memory-plugin-shared/*.test.mjs: 551 passed. claude-code 53, agent-hook 73, opencode 51, dsh 95 passed (1 skipped), all 0 failed;check-plugin-version-bumps.sh origin/mainand dshnpm run check:versionpass. pi: 281 passed, 4 takeover tests fail identically on origin/main (pre-existing).Checklist
Screenshots (if applicable)
N/A
Additional Notes
Not yet re-run against the integration case itself; the fix removes the only
PostToolUseoutput this plugin produces.