Repository navigation
fix(codex): make join the uniform startup path - #524
Merged
Merged
Conversation
Public Codex flow now uses plain airc join. The shell dispatch detects Codex for join/resume and routes through the detached adapter, while the spawned child is guarded from recursive detach. Fresh scopes no longer fail before init.\n\nAlso emit join/part lifecycle notices through the normal message protocol as system events instead of local attach-only appends, and preserve the broadcast-peer listing fix from #523 in this branch.
joelteply
force-pushed
the
codex/uniform-join-flow
branch
from
May 5, 2026 16:13
f716c2c to
88715dd
Compare
There was a problem hiding this comment.
Pull request overview
This PR makes airc join/airc resume the single, uniform startup path across human/Claude/Codex runtimes by moving the Codex “detach from tool process group” behavior behind CLI dispatch, and by emitting join/part lifecycle notices via the normal message protocol.
Changes:
- Route
airc join/resumethrough the Codex detached-start adapter when a Codex environment is detected, with recursion guards (AIRC_CODEX_START_CHILD). - Add a
cmd_send --systemmode (from=airc) and use it to emit join/part lifecycle notices as signed messages. - Update skills/README guidance and add/extend tests to validate Codex join detaching behavior.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
airc |
Adds Codex-environment detection and routes join/resume through detached start when appropriate. |
lib/airc_core/codex_start.py |
Sets AIRC_CODEX_START_CHILD=1 and updates the detached-start banner to match the new public airc join flow. |
lib/airc_bash/cmd_status.sh |
Removes ensure_init precondition from cmd_codex_start so Codex can start in a fresh scope. |
lib/airc_bash/cmd_send.sh |
Introduces --system flag and stamps system events with from=airc. |
lib/airc_bash/cmd_connect.sh |
Replaces prior join-event emission with message-protocol system events on join. |
lib/airc_bash/cmd_rooms.sh |
Emits system lifecycle notices on /part via the normal send path. |
test/test_codex_start.py |
Extends unit test to assert the recursion-guard env var is set for the detached child. |
test/integration.sh |
Adds integration scenario validating “Codex uses plain airc join without recursive detach.” |
README.md |
Updates Codex documentation to use airc join rather than airc codex-start. |
skills/update/SKILL.md |
Switches Codex update flow to restart via airc join. |
skills/resume/SKILL.md |
Switches Codex resume flow to airc join. |
skills/repair/SKILL.md |
Switches Codex repair flow to airc join "$INVITE". |
skills/join/SKILL.md |
Updates Codex join guidance to use the public airc join command. |
skills/canary/SKILL.md |
Updates canary restart instructions for Codex to use airc join. |
Comments suppressed due to low confidence (1)
lib/airc_bash/cmd_status.sh:593
cmd_codex_startno longer callsensure_init(good for fresh scopes), but it still unconditionally callscmd_status(and thencmd_inbox) after only a fixed 2s sleep. If the detachedairc joinhasn’t created/repaired config.json yet,cmd_statuswilldieand makeairc joinin Codex fail even though the transport is starting. Consider making the status/inbox section best-effort (don’t exit on “Not initialized”), or polling briefly for config/health before callingcmd_status.
cmd_codex_start() {
local _log="$AIRC_WRITE_DIR/codex-airc.log"
"$AIRC_PYTHON" -m airc_core.codex_start \
--airc "$0" \
--home "$AIRC_WRITE_DIR" \
--log "$_log" \
-- "$@"
# Give the detached process a short startup window, then print the same
# useful local surfaces that `airc join` prints when it returns quickly.
sleep 2
echo ""
echo "Status"
echo "------"
cmd_status
echo ""
echo "Inbox"
echo "-----"
AIRC_INBOX_QUIET_EMPTY=1 AIRC_INBOX_EXCLUDE_SELF=1 cmd_inbox --count 10 || true
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+195
to
+205
| _join_emit_join_events() { | ||
| local _name="$1" | ||
| [ -z "$_name" ] && return 0 | ||
| [ -f "$CONFIG" ] || return 0 | ||
| local _channels _ch | ||
| _channels=$("$AIRC_PYTHON" -m airc_core.config read_channels --config "$CONFIG" 2>/dev/null || true) | ||
| [ -z "$_channels" ] && return 0 | ||
| while IFS= read -r _ch; do | ||
| [ -z "$_ch" ] && continue | ||
| local _gid | ||
| _gid=$("$AIRC_PYTHON" -m airc_core.config get_channel_gist --config "$CONFIG" --channel "$_ch" 2>/dev/null || true) |
Comment on lines
244
to
248
| if [ -z "$_ch_gist" ]; then | ||
| die "Not subscribed to #${arg_room} (no channel_gists mapping). Use 'airc list' to see open rooms; 'airc status' for your subscriptions." | ||
| fi | ||
| cmd_send --internal --system --channel "$arg_room" "$(get_name) left #${arg_room}" >/dev/null 2>&1 || true | ||
| # Delete the gist ONLY if we're hosting it — i.e., it appears |
Comment on lines
+2337
to
+2348
| _airc_should_use_codex_start() { | ||
| [ -n "${AIRC_CODEX_START_CHILD:-}" ] && return 1 | ||
| [ -n "${AIRC_NO_CODEX_DETACH:-}" ] && return 1 | ||
| [ -n "${AIRC_NO_ATTACH:-}" ] && return 1 | ||
|
|
||
| local _arg | ||
| for _arg in "$@"; do | ||
| [ "$_arg" = "--attach" ] && return 1 | ||
| done | ||
|
|
||
| [ -n "${CODEX_THREAD_ID:-}${CODEX_CI:-}${CODEX_MANAGED_BY_NPM:-}" ] | ||
| } |
Comment on lines
+2342
to
+2346
| local _arg | ||
| for _arg in "$@"; do | ||
| [ "$_arg" = "--attach" ] && return 1 | ||
| done | ||
|
|
Comment on lines
102
to
+108
| --internal) | ||
| internal=1 | ||
| shift ;; | ||
| --system) | ||
| system_event=1 | ||
| internal=1 | ||
| shift ;; |
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.
Summary
airc join; the CLI detects Codex forjoin/resumeand routes through the detached adapter internally.AIRC_CODEX_START_CHILD=1soairc joincannot recurse through the adapter.ensure_initprecondition so Codex can be the first user in a fresh scope.joined/leftlifecycle notices through the normal message protocol asfrom=aircsystem events instead of local attach-only appends. Join notices are limited to channels with a gist mapping, so legacy--no-room --no-gistsmoke starts stay untouched.airc codex-start.Verification
bash -n airc lib/airc_bash/cmd_connect.sh lib/airc_bash/cmd_send.sh lib/airc_bash/cmd_rooms.sh lib/airc_bash/cmd_status.sh test/integration.shpython3 test/test_codex_start.pypython3 test/test_system_event.pypython3 test/test_collaboration.py./test/integration.sh codex_join_detaches_transportairc connect --no-room --no-giststill writesairc.pidpromptly.airc peers.Notes
PR #523 is already merged to canary as
5991086; this branch is rebased on top of it.