Skip to content

feat(codex): support VS Code notifications and precise Windows focus - #55

Open
steven-jianhao-li wants to merge 4 commits into
hellolib:mainfrom
steven-jianhao-li:feat/codex-vscode-notifications
Open

steven-jianhao-li wants to merge 4 commits into
hellolib:mainfrom
steven-jianhao-li:feat/codex-vscode-notifications

Conversation

@steven-jianhao-li

Copy link
Copy Markdown

Summary

  • add a native handle-codex-notify command for Codex's top-level legacy notify payload
  • install the managed notify fallback alongside official Codex hooks so VS Code/app-server clients receive completion notifications without the hooks trust flow
  • preserve unrelated custom notify commands and safely handle Codex Desktop's --previous-notify wrapper during install/uninstall
  • select the correct Windows IDE window by uniquely matching the Codex payload's workspace basename against ancestor window titles
  • rebuild the bundled Windows focus helpers from checked-in source and only call SW_RESTORE when the target is actually minimized

Why

VS Code Codex uses the app-server path, where the configured hooks are not reliably executed/trusted, but Codex's top-level notify command is still invoked. On Windows, all VS Code windows may share one Code.exe PID, so the existing process-tree fallback can choose the wrong window. The bundled helper also restored every window unconditionally, which removed the maximized state.

Details

  • normalizes agent-turn-complete into the same message as the Codex Stop hook, allowing the existing dedupe store to suppress CLI double delivery
  • keeps TOML comments/layout and the original pre-install backup
  • prefers SessionStart focus captures, then a unique workspace-title match, then the existing process-tree fallback
  • keeps maximized windows maximized and restores minimized-maximized windows back to maximized
  • documents the IDE fallback and Windows focus behavior in English and Chinese

Verification

  • go test ./...
  • go vet ./...
  • cross-built agent-notify for Windows, Linux, and macOS on amd64/arm64
  • rebuilt both bundled Windows helper binaries
  • Windows end-to-end: a simulated VS Code Codex payload for Rise-LLM selected the expected HWND 0x105b4 among three VS Code windows
  • Windows end-to-end: a minimized maximized target restored as maximized and became the foreground window
  • npm launcher suite on Windows: 69 passed; 3 existing platform-assumption failures remain (macOS executable mode, POSIX path regex, case-sensitive proxy env names)

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.

1 participant