Skip to content

fix: emit valid codex stop-hook cleanup output#1540

Open
zerone0x wants to merge 1 commit into
oraios:mainfrom
zerone0x:fix/codex-cleanup-stop-hook-json-1533
Open

fix: emit valid codex stop-hook cleanup output#1540
zerone0x wants to merge 1 commit into
oraios:mainfrom
zerone0x:fix/codex-cleanup-stop-hook-json-1533

Conversation

@zerone0x

@zerone0x zerone0x commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

fixes #1533.

for codex cleanup hooks, this now always emits valid stop-hook json ({"continue": true}) and treats a missing session id as a no-op instead of raising.

Fixes oraios#1533

Co-Authored-By: Claude <noreply@anthropic.com>
@zerone0x zerone0x force-pushed the fix/codex-cleanup-stop-hook-json-1533 branch from 5cc3dad to fdd29b5 Compare June 3, 2026 02:51

@MischaPanch MischaPanch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The issue describes the case "no session id sent" but this case should never occur. Does this actually happen with codex? If yes, none of our hooks would work for codex

Comment thread src/serena/hooks.py
shutil.rmtree(self.session_persistence_dir, ignore_errors=True)
if self._session_id is not None:
shutil.rmtree(self.session_persistence_dir, ignore_errors=True)
if self._client == HookClient.CODEX:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it a bad idea to always echo this?

Comment thread src/serena/hooks.py


class SessionEndCleanupHook(Hook):
def __init__(self, client: HookClient):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

super init is missing. The hooks assume that session_id is always passed, is that not true for codex? Serena's hooks don't work without a session id.

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.

Codex Stop hook: serena-hooks cleanup --client=codex emits invalid Stop-hook stdout

2 participants