Skip to content

fix: enforce agent wake boundaries - #26

Merged
Codename-11 merged 1 commit into
mainfrom
codex/agent-wake-guardrails
Jul 14, 2026
Merged

Codename-11 merged 1 commit into
mainfrom
codex/agent-wake-guardrails

Conversation

@Codename-11

Copy link
Copy Markdown
Owner

What changed

  • centralizes the issue activity → agent wake policy around human replies, explicit mentions, assignment/restart, and true HIGH/URGENT escalation
  • keeps labels, ordinary status edits, non-escalating priority changes, SLA/stall/blocking markers, coach output, and other automated activity notification-only
  • prevents an agent's own terminal or stalled comment from waking a replacement run and makes nudge delivery single-shot
  • keeps RUNS agents parked until a validated canonical trigger creates a fresh provider turn, while webhook/completions agents reactivate directly
  • atomically creates exactly one terminal issue comment for completed, stalled, and abandoned runs

Root cause and impact

Wake routing mixed the durable activity timeline with executable agent work. Some branches trusted payload agentId instead of authoritative actor identity, status changes touched runs directly, all priority changes reached watchers, and terminal failure comments were emitted outside the run-closing claim. AXI-104 therefore demonstrated a stalled agent reply opening another run, and similar low-signal changes could invoke an LLM unnecessarily.

This patch makes notifications and activity broad while keeping the executable wake boundary intentionally narrow and engine-aware.

Validation

  • pnpm lint (existing repository warnings only)
  • pnpm typecheck
  • pnpm test — 1,236 passed, 1 intentional live-connector skip
  • isolated known flaky stale-work file — 9 passed
  • production Next.js build
  • Playwright, serial — 38 passed

Release: v0.13.1 — Reliable agent wake boundaries

@Codename-11
Codename-11 merged commit d0426cd into main Jul 14, 2026
3 checks passed
@Codename-11
Codename-11 deleted the codex/agent-wake-guardrails branch July 14, 2026 18:34

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ff6c4fee1b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

? (triggerEvent.payload as Record<string, unknown>)
: {};
let replyBlock: string | null = null;
if (triggerEvent.kind === EventKind.COMMENT_CREATED) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Handle COMMENT_UPDATED wake triggers

When an operator edits an existing comment to add @agent, recordChange still treats that COMMENT_UPDATED event as an actionable mention and stamps it onto the WAITING RUNS agent run, but this resume path only builds a reply for COMMENT_CREATED or priority events. In that edited-in mention scenario the run remains WAITING and no fresh provider turn is started, even though webhook/completions agents would be woken by the same event.

Useful? React with 👍 / 👎.

Comment on lines +728 to +731
id: commentId,
workspaceId: run.workspaceId,
issueId: run.issueId,
kind: "BODY",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Allow step-comment replies through this lookup

For a COMMENT_CREATED wake routed from an execution-step thread, the Comment row is stored with executionStepId and issueId = null while ensureCanonicalFromEvent maps it onto the parent issue run. Requiring issueId: run.issueId here makes reply null for those valid plan-step replies/mentions, so a paused RUNS agent on a step never resumes from the operator's comment.

Useful? React with 👍 / 👎.

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