Skip to content

fix(app): keep tracking auto-approve prompts that land while scrolled back - #86

Merged
simota merged 1 commit into
mainfrom
fix/auto-approve-scrolled-back-prompt
Sep 10, 2026
Merged

simota merged 1 commit into
mainfrom
fix/auto-approve-scrolled-back-prompt

Conversation

@simota

@simota simota commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Root cause of "Codex auto-approve does nothing": a prompt drawn while the viewport was scrolled back hit Suppressed(ViewportNotLive), which dropped the tracked match. Scrolling back to the live rows produces no pty output, so nothing rescanned and the prompt sat unapproved until the agent redrew. Codex's inline UI makes this common.
  • Detection now scans the live tail rows (not the scrolled viewport) and treats ViewportNotLive like the input cooldown: the match stays tracked and the 350 ms stability rescan polls until the viewport returns to offset 0. Firing still requires two unsuppressed matches at offset 0 (FR-5 / AC-6 unchanged).
  • Codex Environment: row is optional (codex 0.154 omits it without a selected environment); the cross-thread footer … or o to open thread is accepted.
  • NOA_AUTO_APPROVE_TRACE=1 logs every tracked decision and main-thread reject reason to stderr.
  • Spec: FR-5 addendum in docs/specs/auto-approve-mode.md.

Verification

  • cargo test -p noa-app: 1238 passed (+5 tests: real codex 0.154 capture replayed through the VT grid, scrolled-back re-arm, live-row reader, no-Environment: layout, screenshot layout with wide Reason:).
  • cargo fmt --check, cargo clippy -p noa-app --all-targets (warnings identical to main).
  • GUI end-to-end on macOS with codex 0.154.0 (-a on-request -s read-only, oracle = mkdir actually running):
Scenario v0.2.16 this branch
Waiting at live bottom approved after ~10 s approved
Shift+PageUp before the prompt lands, then scroll back down never approved (90 s + 30 s) approved 4 s after returning

https://claude.ai/code/session_01Nzt9w133uttk9d1FjUUJ2G

… back

A prompt drawn while the viewport was scrolled back was dropped by the
ViewportNotLive suppression, and a wheel scroll back to the live rows
produces no pty output to rescan on, so the prompt was never approved
until the agent redrew. Codex's inline UI makes this common.

- Scan the live tail rows instead of the scrolled viewport and treat
  ViewportNotLive like the input cooldown: keep the match tracked and
  let the 350 ms stability rescan poll until the viewport is live again.
  Firing still requires two unsuppressed matches at offset 0.
- Make the Codex `Environment:` row optional (codex 0.154 omits it
  without a selected environment) and accept the cross-thread footer.
- Add NOA_AUTO_APPROVE_TRACE=1 to log decisions and main-thread rejects.

Claude-Session: https://claude.ai/code/session_01Nzt9w133uttk9d1FjUUJ2G
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-10T23:30:27.249690Z 4dbe459 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 4dbe4593e3

ℹ️ 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".

Comment on lines +770 to +774
if !context.iter().any(|row| {
row.trim()
.strip_prefix("$ ")
.is_some_and(|command| !command.trim().is_empty())
}) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the local-environment guard when making it optional

When a Codex dialog contains Environment: <non-local>, this condition now accepts it as long as a $ command is present and automatically sends Enter. The documented recognition matrix still limits this signature to Environment: local (docs/specs/auto-approve-mode.md:50), and the stated compatibility case only requires accepting dialogs where the row is absent for a plain local run. Reject a present Environment: row unless its value is local, while continuing to allow the row to be omitted, so auto-approve cannot execute commands in an unintended selected environment.

Useful? React with 👍 / 👎.

@simota
simota merged commit 1d51f11 into main Sep 10, 2026
1 check passed
@simota
simota deleted the fix/auto-approve-scrolled-back-prompt branch September 10, 2026 23:32
@simota simota mentioned this pull request Sep 10, 2026
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