Skip to content

feat: activate Agent Attention as installed plugin - #3

Merged
myagentdojo merged 3 commits into
mainfrom
codex/agent-attention-installed
Aug 12, 2026
Merged

feat: activate Agent Attention as installed plugin#3
myagentdojo merged 3 commits into
mainfrom
codex/agent-attention-installed

Conversation

@myagentdojo

@myagentdojo myagentdojo commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

Completes the Agent Attention playground arc after #1 added the bounded experiment. Agent Attention is now an installed Codex skill with a custody-launched runtime and an exact-task Stop hook, so fresh tasks can discover and execute it without repository source paths.

Design

  • Keep the reviewed Python/EventKit runtime as the lifecycle owner.
  • Bundle one thin Bun adapter beside the Python sidecar.
  • Share the Stop decision engine between experiment and installed adapters.
  • Generate skill, launcher, hook, catalog, sidecar, and inventory bytes from canonical sources.
  • Fail closed when Python or structured owner state is unavailable.

Validation

  • bun run prove:all: passed the commit-bound repository, runtime-custody, native isolated Claude/Codex install, deterministic distribution, and DX proofs.
  • Installed-path lifecycle: 65 Python tests passed against copied installed sidecar bytes.
  • Fresh Codex CLI task: discovered agent-attention, executed its installed launcher, returned agent-attention.approval-gate, and completed the installed Stop hook.
  • Fallow changed-code audit: consolidated the duplicate Stop engine; remaining introduced signals cover generated bundle bytes and tested contract exports.

Fresh Codex Desktop activation and the separately approved disposable live Reminders gate remain final acceptance receipts outside this PR's automated claim boundary.

Summary by CodeRabbit

  • New Features

    • Added Agent Attention approval gates for routing genuine yes/no blockers to Apple Reminders.
    • Added preview, submission, polling, approval application, outcome receipts, and readiness checks.
    • Added exact-task Stop enforcement to prevent premature task completion.
    • Added a portable Bun-powered runtime and launcher for installed plugin environments.
    • Added validation, crash recovery, secure audit records, and bounded reminder operations.
  • Bug Fixes

    • Improved handling of uncertain runtime outcomes, malformed input, and request-lock recovery.
    • Added structured diagnostics when the Python runtime cannot start.
  • Tests

    • Expanded integration and distribution checks for installed payloads, hooks, runtimes, and generated metadata.

@myagentdojo
myagentdojo deployed to hosted-canary-qualification August 12, 2026 08:58 — with GitHub Actions Active
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b07e7b45-fca0-40ab-8387-5a273f8b2f4e

📥 Commits

Reviewing files that changed from the base of the PR and between 9b717f3 and 39d7487.

📒 Files selected for processing (3)
  • experiments/agent-attention/runtime/agent-attention/agent-attention.py
  • experiments/agent-attention/runtime/agent-attention/test_agent_attention.py
  • plugin/runtime/agent-attention.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • experiments/agent-attention/runtime/agent-attention/test_agent_attention.py
  • plugin/runtime/agent-attention.py
  • experiments/agent-attention/runtime/agent-attention/agent-attention.py

📝 Walkthrough

Walkthrough

Adds the Agent Attention approval-gate runtime, shared Stop-hook handling, Python-backed Reminders workflows, Bun packaging, plugin integration, and installed-payload validation.

Changes

Agent Attention runtime

Layer / File(s) Summary
Shared Stop-hook contracts
packages/agent-attention/src/stop.ts, experiments/agent-attention/hooks/*
Adds shared input contracts, owner-state checks, fail-closed responses, and hook delegation.
Approval-gate state engine
plugin/runtime/agent-attention.py
Adds approval validation, atomic state, reminder gates, outcomes, delivery receipts, polling, diagnostics, and Stop decisions.
Runtime safety and state validation
experiments/agent-attention/runtime/agent-attention/*
Bounds remindctl calls, preserves request-lock inodes, secures audit files, and reports uncertain changes explicitly.
Bun and Python runtime bridge
packages/agent-attention/*, plugin/runtime/agent-attention-*.js
Adds Python process execution, Stop-hook dispatch, output forwarding, timeout handling, and structured startup errors.
Plugin integration and payload generation
plugin.config.json, plugin/*, runtime/*, scripts/agent-attention-payload.ts, scripts/build.ts, scripts/generate.ts
Registers the skill, launcher, runtime bundle, Codex hook, metadata, and generated payload projections.
Installed payload validation
scripts/*test.ts, scripts/prove-*.ts
Validates generated inventories, installed files, launcher custody, sidecar behavior, and blocking Stop-hook decisions.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Codex
  participant BunRuntime
  participant PythonRuntime
  participant AppleReminders
  Codex->>BunRuntime: invoke hook-stop or agent-attention command
  BunRuntime->>PythonRuntime: forward command and structured input
  PythonRuntime->>AppleReminders: create, inspect, or update approval reminder
  AppleReminders-->>PythonRuntime: return reminder state
  PythonRuntime-->>BunRuntime: return correlated result
  BunRuntime-->>Codex: return command output and exit status
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.28% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: activating Agent Attention as an installed plugin.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/agent-attention-installed

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 9

🧹 Nitpick comments (1)
packages/agent-attention/src/stop.ts (1)

31-37: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

cwd is required but never used.

isAgentAttentionStopInput rejects any payload without a nonempty cwd. The handler never reads cwd. A Stop payload that omits cwd therefore returns the fail-closed block and forces one extra continuation turn. Validate only the fields the decision needs, or document why cwd must be present.

♻️ Proposed narrowing of the validated surface
 export function isAgentAttentionStopInput(value: unknown): value is AgentAttentionStopInput {
 	if (!value || typeof value !== "object" || Array.isArray(value)) return false
 	const input = value as Record<string, unknown>
-	if (typeof input.cwd !== "string" || input.cwd.trim() === "") return false
+	if (input.cwd !== undefined && typeof input.cwd !== "string") return false
 	if (typeof input.session_id !== "string" || input.session_id.trim() === "") return false
 	return input.stop_hook_active === undefined || typeof input.stop_hook_active === "boolean"
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/agent-attention/src/stop.ts` around lines 31 - 37, Update
isAgentAttentionStopInput to stop requiring a nonempty cwd, since the stop
decision does not use it. Continue validating session_id and the optional
stop_hook_active boolean, while preserving rejection of invalid payload shapes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/agent-attention/src/main.ts`:
- Around line 34-47: Update the fabricated missing_python payload in runPython
to include contract_id, schema_version, and run_id consistently with
base_result. Regenerate plugin/runtime/agent-attention-202d4ab2aa5da04a.js from
the corrected packages/agent-attention/src/main.ts; do not edit the generated
bundle manually.
- Around line 78-87: Update main so the JSON write via process.stdout.write
completes before returning the exit status and invoking process.exit; await the
write completion or use an equivalent stream-draining mechanism. Preserve the
existing output formatting and exit-code behavior.

In `@packages/agent-attention/src/stop.ts`:
- Around line 44-45: Update the stop handling around runtime.checkStop and the
submit flow so both use the same canonical Codex identifier, rather than
allowing session_id and the owning thread UUID to diverge. Add an explicit
session_id-to-thread_id mapping or standardize both interfaces on one
identifier, then add an end-to-end test proving the Stop hook checks the
submitted thread and blocks when required.

In `@plugin/runtime/agent-attention.py`:
- Around line 1645-1658: Update the exception handler’s base_result call to keep
changed boolean-valued, matching all other result payloads and the Bun fallback;
move the unknown-state information into a separate appropriate field without
changing the existing error category or retry behavior.
- Around line 606-626: Pass an explicit timeout_seconds value to every relevant
run_json invocation: the remindctl add call in _submit_approval, the remindctl
edit call in update_request_state, and the read_exact_completed_reminder call.
Use the existing timeout configuration or constant, and ensure each call
executes within a finite bound while the per-thread request lock is held.
- Around line 165-181: Update release_request_lock so it never unlinks the lock
path; retain unlocking and descriptor cleanup in the finally block. Ensure
acquire_request_lock continues using the persistent lock-file inode for mutual
exclusion without adding path removal.
- Around line 183-188: Update append_audit so newly created audit files are
opened with private mode 0o600 from creation, rather than relying on os.chmod
after writing. Preserve the existing append behavior and JSON serialization,
while retaining chmod only if needed to enforce permissions on pre-existing
files.

In `@scripts/agent-attention-installed.test.ts`:
- Around line 69-90: The test currently invokes the commands diagnostics path
instead of validating Stop-event safety. Update the test around the installed
bundle invocation to call hook-stop with AGENT_ATTENTION_PYTHON set to
/missing/python3, then assert the fail-closed blocking response and expected
exit behavior for an unavailable Python runtime.

In `@scripts/prove-distribution.ts`:
- Around line 201-203: Update the error thrown by the expanded closure check in
scripts/prove-distribution.ts to use a generic closure-mismatch message or
report the actual mismatched keys, rather than naming capability-tour. Preserve
the existing surfaceKeys diagnostic and validation behavior.

---

Nitpick comments:
In `@packages/agent-attention/src/stop.ts`:
- Around line 31-37: Update isAgentAttentionStopInput to stop requiring a
nonempty cwd, since the stop decision does not use it. Continue validating
session_id and the optional stop_hook_active boolean, while preserving rejection
of invalid payload shapes.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 38af4192-f030-45d4-9899-d0f06190c230

📥 Commits

Reviewing files that changed from the base of the PR and between 9113268 and e00d239.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (30)
  • .claude-plugin/marketplace.json
  • experiments/agent-attention/hooks/agent-attention-codex-stop.ts
  • experiments/agent-attention/runtime/agent-attention/test_agent_attention.py
  • experiments/agent-attention/skill/SKILL.md
  • packages/agent-attention/package.json
  • packages/agent-attention/src/main.ts
  • packages/agent-attention/src/stop.ts
  • plugin.config.json
  • plugin/.claude-plugin/plugin.json
  • plugin/.codex-plugin/plugin.json
  • plugin/bin/agent-attention
  • plugin/hooks/codex/hooks.json
  • plugin/runtime/agent-attention-202d4ab2aa5da04a.js
  • plugin/runtime/agent-attention.py
  • plugin/runtime/bundle-inventory.json
  • plugin/runtime/bundle-inventory.sh
  • plugin/runtime/skill-catalog.sh
  • plugin/skills/agent-attention/SKILL.md
  • runtime/skill-catalog.json
  • scripts/agent-attention-installed.test.ts
  • scripts/agent-attention-payload.ts
  • scripts/build.test.ts
  • scripts/build.ts
  • scripts/generate.ts
  • scripts/native-capability-surface.test.ts
  • scripts/plugin-config.ts
  • scripts/prove-distribution.ts
  • scripts/prove-harness-install.ts
  • scripts/runtime-custody-config.test.ts
  • scripts/runtime-custody-generation.test.ts

Comment thread packages/agent-attention/src/main.ts
Comment thread packages/agent-attention/src/main.ts Outdated
Comment thread packages/agent-attention/src/stop.ts
Comment thread plugin/runtime/agent-attention.py Outdated
Comment thread plugin/runtime/agent-attention.py Outdated
Comment thread plugin/runtime/agent-attention.py
Comment thread plugin/runtime/agent-attention.py
Comment thread scripts/agent-attention-installed.test.ts Outdated
Comment thread scripts/prove-distribution.ts
Preserve structured error envelopes and flush hook output before exit. Keep request locking, audit creation, and Reminders calls safe under failure, with installed-path regression proof.
@myagentdojo
myagentdojo deployed to hosted-canary-qualification August 12, 2026 09:17 — with GitHub Actions Active
@myagentdojo

Copy link
Copy Markdown
Owner Author

cwd is required but never used.

Addressed: cwd is now optional and type-checked only when present. Stop correlation continues to require the canonical session_id; targeted hook tests pass.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@experiments/agent-attention/runtime/agent-attention/agent-attention.py`:
- Around line 621-622: Pass REMINDCTL_COMMAND_TIMEOUT_SECONDS to the post-create
read_inventory call in _submit_approval so verification is bounded like
remindctl add. Update
experiments/agent-attention/runtime/agent-attention/test_agent_attention.py
lines 917-953 to accept the timeout in the read_inventory mock and assert
post-create verification receives the same value.
- Around line 174-182: Harden append_audit by adding O_NOFOLLOW to the open
flags when supported, then immediately validate the descriptor with fstat:
require a regular file (S_ISREG) with st_nlink equal to 1 before writing. Close
the descriptor and reject the path on validation failure, while preserving the
existing permission handling.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3d229d42-61d6-4e41-a163-e0577fe8703b

📥 Commits

Reviewing files that changed from the base of the PR and between e00d239 and 9b717f3.

📒 Files selected for processing (12)
  • experiments/agent-attention/hooks/agent-attention-codex-stop.test.ts
  • experiments/agent-attention/runtime/agent-attention/agent-attention.py
  • experiments/agent-attention/runtime/agent-attention/test_agent_attention.py
  • packages/agent-attention/src/main.test.ts
  • packages/agent-attention/src/main.ts
  • packages/agent-attention/src/stop.ts
  • plugin/runtime/agent-attention-5133bb12807899e9.js
  • plugin/runtime/agent-attention.py
  • plugin/runtime/bundle-inventory.json
  • plugin/runtime/bundle-inventory.sh
  • scripts/agent-attention-installed.test.ts
  • scripts/prove-distribution.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/agent-attention/src/main.ts
  • scripts/agent-attention-installed.test.ts
  • plugin/runtime/bundle-inventory.sh
  • plugin/runtime/bundle-inventory.json
  • scripts/prove-distribution.ts

Reject redirected audit paths and bound post-create Reminders verification while holding request state.
@myagentdojo
myagentdojo deployed to hosted-canary-qualification August 12, 2026 09:26 — with GitHub Actions Active
@myagentdojo
myagentdojo merged commit 1dc0934 into main Aug 12, 2026
18 checks passed
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