Repository navigation
feat(codex): add stateful inbox polling - #450
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a stateful “inbox” polling primitive intended for Codex/non-Monitor runtimes, replacing manual logs --since timestamp tracking with a per-scope cursor, and updates skills/docs/tests accordingly.
Changes:
- Introduce
airc inbox(aliases:poll,codex-poll) backed by a per-scope cursor file. - Update multiple skills/docs to use
airc inbox/airc inbox --peekfor catch-up instead of manuallogs --since. - Add an integration scenario validating peek vs. cursor-advancing behavior and alias usage.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/integration.sh | Adds scenario_inbox and wires it into the integration runner modes. |
| skills/update/SKILL.md | Switches Codex/non-Monitor catch-up guidance from logs --since to inbox. |
| skills/resume/SKILL.md | Adds airc inbox step after resuming in Codex/non-Monitor flow. |
| skills/repair/SKILL.md | Adds airc inbox after repair/connect flow to catch up on unread messages. |
| skills/msg/SKILL.md | Encourages checking inbox before sending to avoid missing unread inbound context. |
| skills/logs/SKILL.md | Documents airc inbox as preferred incremental catch-up; positions logs --since as forensic. |
| skills/join/SKILL.md | Updates Codex/non-Monitor guidance to use the stateful inbox rather than timestamp polling. |
| skills/inbox/SKILL.md | New /inbox skill describing unread catch-up, cursor advancement, and options. |
| skills/doctor/SKILL.md | Changes “most recent context” step to airc inbox --peek (non-advancing). |
| skills/canary/SKILL.md | Adds airc inbox after status in Codex/non-Monitor flow. |
| lib/airc_bash/cmd_status.sh | Implements cmd_inbox and related CLI help/flag parsing. |
| integrations/openai-codex/README.md | Updates Codex integration guidance to include /inbox and airc inbox usage. |
| airc | Adds CLI dispatch + help text for `inbox |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+404
to
+406
| local latest | ||
| latest=$(printf '%s\n' "$out" | sed -n 's/^\[\([^]]*\)\].*/\1/p' | tail -1) | ||
| printf '%s\n' "${latest:-$read_started}" > "$cursor_file" |
Comment on lines
+365
to
+400
| -h|--help) | ||
| echo "Usage: airc inbox [--peek] [--reset] [--since <ts|Ns|Nm|Nh>] [--count N]" | ||
| echo " Shows unread messages since this scope's last inbox check." | ||
| echo " Advances a per-scope cursor unless --peek is set." | ||
| echo " Alias: airc poll, airc codex-poll" | ||
| return 0 ;; | ||
| *) die "Unknown inbox option: $1" ;; | ||
| esac | ||
| done | ||
|
|
||
| case "$count" in | ||
| ''|*[!0-9]*) die "inbox --count must be a positive integer (got '$count')" ;; | ||
| 0) die "inbox --count must be ≥ 1 (got '$count')" ;; | ||
| esac | ||
|
|
||
| if [ -z "$since" ]; then | ||
| if [ -f "$cursor_file" ]; then | ||
| since=$(cat "$cursor_file" 2>/dev/null || true) | ||
| fi | ||
| since="${since:-5m}" | ||
| fi | ||
|
|
||
| local read_started | ||
| read_started=$(date -u '+%Y-%m-%dT%H:%M:%SZ') | ||
|
|
||
| local out | ||
| if ! out=$(cmd_logs "$count" --since "$since" 2>&1); then | ||
| printf '%s\n' "$out" >&2 | ||
| return 1 | ||
| fi | ||
|
|
||
| if [ -n "$out" ]; then | ||
| printf '%s\n' "$out" | ||
| else | ||
| echo "No new airc messages since $since" | ||
| fi |
Comment on lines
+22
to
+23
| `airc inbox` is the Codex/non-Monitor catch-up verb. It wraps `airc logs --since` with a per-scope cursor file, so future checks read only new messages instead of relying on the agent to remember and replay the last timestamp manually. | ||
|
|
Comment on lines
+2959
to
+2985
| scenario_inbox() { | ||
| section "inbox cursor tracks unread messages" | ||
| local root=/tmp/airc-it-inbox | ||
| local home="$root/state" | ||
| rm -rf "$root" | ||
| mkdir -p "$home" | ||
| echo '{}' > "$home/config.json" | ||
| { | ||
| printf '%s\n' '{"ts":"2026-05-04T10:00:00Z","from":"alpha","msg":"first unread"}' | ||
| printf '%s\n' '{"ts":"2026-05-04T10:01:00Z","from":"beta","msg":"second unread"}' | ||
| } > "$home/messages.jsonl" | ||
|
|
||
| local out | ||
| out=$(AIRC_HOME="$home" "$AIRC" inbox --peek --since 2026-05-04T09:59:00Z 2>&1) | ||
| printf '%s' "$out" | grep -q 'first unread' \ | ||
| && printf '%s' "$out" | grep -q 'second unread' \ | ||
| && pass "inbox --peek shows unread messages" \ | ||
| || fail "inbox --peek missing expected messages: $out" | ||
| [ ! -f "$home/inbox_cursor" ] \ | ||
| && pass "inbox --peek does not advance cursor" \ | ||
| || fail "inbox --peek unexpectedly wrote cursor" | ||
|
|
||
| out=$(AIRC_HOME="$home" "$AIRC" inbox --since 2026-05-04T09:59:00Z 2>&1) | ||
| local cursor; cursor=$(cat "$home/inbox_cursor" 2>/dev/null || true) | ||
| [ "$cursor" = "2026-05-04T10:01:00Z" ] \ | ||
| && pass "inbox advances cursor to newest printed message" \ | ||
| || fail "inbox cursor = '$cursor' (expected newest message ts); output: $out" |
This was referenced May 4, 2026
Merged
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 inbox/airc poll/airc codex-pollfor unread-message catch-up with a per-scope cursor/inboxskill and update Codex/non-Monitor skill flows to check it instead of manually trackinglogs --sincetimestampsVerification
bash -n airc lib/airc_bash/cmd_status.sh test/integration.shgit diff --check./test/integration.sh inbox/private/tmp/airc-codex-inbox/airc inbox --peekQA ask
Please test from canary after merge on Codex and Claude Code. This does not create push notifications inside Codex; it codifies the satellite/check-in behavior so Codex no longer has to remember manual timestamps.