fix(codex): cap SessionEnd hook timeout at Codex's 3s limit - #458
z3347212573-cloud wants to merge 1 commit into
Conversation
Which branch should this land on?I opened this against The bug from #381 is still present on the release branches as well — both Where would you like this to go?
Happy to retarget or open a backport — just tell me which branch you prefer. |
Codex clamps the SessionEnd hook timeout to 3s (the session is already exiting, so hooks may not drag on) and surfaces the clamped value as a hook loading problem in its config UI: clamping SessionEnd hook timeout to 3s in ~/.codex/hooks.json Memmy wrote the shared 60s timeout into every lifecycle hook, so the warning reappeared on every hook refresh and manual fixes were overwritten by the next install. Give codexHookEntries() an explicit timeout parameter and pass the 3s cap for SessionEnd only; SessionStart, PostCompact, UserPromptSubmit and Stop keep the 60s timeout. Fixes MemTensor#381
0ff5520 to
c54000e
Compare
|
Moved this to Nobody replied to the branch question above, and I rebased the commit onto Tests on the v1.1.9 base: For reference, the bug is present on every branch I checked — |
Problem
Fixes #381.
Codex hard-caps the
SessionEndhook timeout at 3s — the session is already exiting, so hooks are not allowed to drag on. When a hook declares a longer timeout, Codex clamps it and surfaces the clamped value as a hook loading problem in its config UI:Memmy wrote the same
HOOK_TIMEOUT_SECONDS = 60into every lifecycle hook it installs, includingSessionEnd, so the warning reappeared after every hook install/refresh — and hand-editing the timeout back to3was reverted by the next refresh.Change
codexHookEntries()now takes an explicittimeoutparameter, defaulting toHOOK_TIMEOUT_SECONDS(60).SessionEndpasses a newSESSION_END_HOOK_TIMEOUT_SECONDS = 3.SessionStart,PostCompact,UserPromptSubmitandStopkeep the 60s timeout.Both copies of the Codex target are updated, since they are byte-identical:
App/backend/src/adapters/outbound/skill-writer/codex/target.tsMemory/src/agent-source/integration/codex/target.tsOnly the Codex target is touched — the 3s cap is specific to Codex's
SessionEndevent.Tests
Added
caps the SessionEnd hook timeout at the Codex limit and keeps the other hooks at the defaulttoApp/backend/src/adapters/outbound/skill-writer/codex/tests/target.test.ts. It assertsSessionEnd→timeout: 3whileSessionStartandPostCompactstay at60.Verified locally:
npx vitest run src/adapters/outbound/skill-writer/codex/tests/target.test.ts→ 9 passedexpected { type: 'command', …(3) } to match object { type: 'command', timeout: 3 }, so the test does cover the fixnpm run typecheck -w @memmy/backend,npm run typecheck -w @memmy/memory, andeslinton the changed directory are all clean