Skip to content

feat(codex): add stateful inbox polling - #450

Merged
joelteply merged 1 commit into
canaryfrom
fix/codex-inbox-poll
May 4, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/codex-inbox-poll

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

  • add airc inbox / airc poll / airc codex-poll for unread-message catch-up with a per-scope cursor
  • add an /inbox skill and update Codex/non-Monitor skill flows to check it instead of manually tracking logs --since timestamps
  • add an integration scenario covering peek, cursor advancement, saved-cursor reuse, and alias behavior

Verification

  • bash -n airc lib/airc_bash/cmd_status.sh test/integration.sh
  • git diff --check
  • ./test/integration.sh inbox
  • live Continuum scope: /private/tmp/airc-codex-inbox/airc inbox --peek

QA 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.

Copilot AI review requested due to automatic review settings May 4, 2026 16:10
@joelteply
joelteply merged commit 0d48ccd into canary May 4, 2026
8 checks passed
@joelteply
joelteply deleted the fix/codex-inbox-poll branch May 4, 2026 16:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 --peek for catch-up instead of manual logs --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 thread skills/inbox/SKILL.md
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 thread test/integration.sh
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"
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.

2 participants