Repository navigation
Make Codex hooks fire-and-forget #6110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7f774b4
Make Codex hooks fire-and-forget
lawrencecchen da98f61
Merge remote-tracking branch 'origin/main' into feat-codex-hook-timeouts
lawrencecchen d172ab8
Preserve Codex prompt baseline refreshes
lawrencecchen 68a6d3e
Preserve Codex turn tombstones
lawrencecchen c60ad40
Harden Codex stale hook ordering
lawrencecchen e2f065a
Drop stale Codex prompt baseline writes
lawrencecchen 6c8aef3
Simplify Codex prompt submit result state
lawrencecchen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| extension CMUXCLI { | ||
| static func codexFireAndForgetAgentHookShellCommand(_ command: String, for def: AgentHookDef) -> String { | ||
| let routedArguments = command.hasPrefix("cmux ") ? String(command.dropFirst("cmux ".count)) : command | ||
| let runner = "payload=\"$1\"; shift; \"$@\" <\"$payload\" >/dev/null 2>&1 & child=\"$!\"; ( sleep 30; kill \"$child\" 2>/dev/null || true ) & watchdog=\"$!\"; wait \"$child\" 2>/dev/null || true; kill \"$watchdog\" 2>/dev/null || true; rm -f \"$payload\"" | ||
| return [ | ||
| "cmux_cli=\"${CMUX_BUNDLED_CLI_PATH:-}\"", | ||
| "if [ -z \"$cmux_cli\" ] || [ ! -x \"$cmux_cli\" ]; then cmux_cli=\"$(command -v cmux 2>/dev/null || true)\"; fi", | ||
| "agent_pid=\"${CMUX_CODEX_PID:-${PPID:-}}\"", | ||
| "if [ -n \"$CMUX_SURFACE_ID\" ] && [ \"$\(def.disableEnvVar)\" != \"1\" ] && [ -n \"$cmux_cli\" ]; then payload=\"$(mktemp \"${TMPDIR:-/tmp}/cmux-codex-hook.XXXXXX\" 2>/dev/null || mktemp -t cmux-codex-hook 2>/dev/null)\" || { echo '{}'; exit 0; }; cat >\"$payload\" || true; if [ -n \"${CMUX_SOCKET_PATH:-}\" ]; then CMUX_CODEX_PID=\"$agent_pid\" nohup sh -c '\(runner)' cmux-codex-hook \"$payload\" \"$cmux_cli\" --socket \"$CMUX_SOCKET_PATH\" \(routedArguments) >/dev/null 2>&1 & else CMUX_CODEX_PID=\"$agent_pid\" nohup sh -c '\(runner)' cmux-codex-hook \"$payload\" \"$cmux_cli\" \(routedArguments) >/dev/null 2>&1 & fi; echo '{}'; else echo '{}'; fi", | ||
| ].joined(separator: "; ") | ||
| } | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repo's
.github/review-bot-rules/swift-file-package-boundaries.mdsays to report an existing production Swift file over 800 lines gaining more than 250 lines unless the change extracts responsibility or shrinks the oversized file. This commit adds hundreds of lines of Codex hook dispatch, persistence freshness, and socket/UI restore logic to the already 33k-lineCLI/cmux.swiftand accepts that growth by raising the budget here, so the smallest fix is to move the Codex hook freshness/fire-and-forget support behind a focused file or package boundary instead of increasing the monolith's allowance.Useful? React with 👍 / 👎.