Skip to content

fix(notifications): reset Eat program status on reuse and harden OSC 7501 parser - #611

Merged
tninja merged 2 commits into
mainfrom
fix/osc-7501-eat-reuse-and-parser-bounds
Nov 23, 2026
Merged

tninja merged 2 commits into
mainfrom
fix/osc-7501-eat-reuse-and-parser-bounds

Conversation

@tninja

@tninja tninja commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Follow-up to #610 addressing two edge cases found during PR review:

Changes

  1. Reset program-status and busy state on Eat buffer reuse (ai-code-backends-infra-eat.el, ai-code-backends-infra.el):
    • Add ai-code-backends-infra--reset-program-status-state and call it in ai-code-backends-infra-eat-create-session before eat-exec.
    • When an Eat session exits abnormally, its buffer is kept alive in eat-mode, so reusing the buffer skips (eat-mode) and previously retained stale ai-code-backends-infra--program-status-records, ai-code-backends-infra--program-status-pending, and ai-code-backends-infra--busy-signal. A stale blocked child record could shadow all root updates for the new process, and a stale busy signal could trigger a spurious "Response Ready" notification on startup idle.
  2. Enforce OSC 7501 query and limit bounds (ai-code-backends-infra.el):
    • Match feature-detection queries with (string= (string-trim body) "?") instead of (string-prefix-p "?" body) so echoed terminal replies such as ?:states=... are not answered as queries.
    • Enforce ai-code-backends-infra--program-status-max-length (4096) on complete single-chunk sequences as well as pending fragments.
    • Enforce the 128-byte total id length limit (ai-code-backends-infra--program-status-id-max-length) and ensure id values containing newlines fail validation instead of being skipped and falling back to the root record.
    • Cap ai-code-backends-infra--program-status-records at ai-code-backends-infra--program-status-max-records (256) with LRU eviction.
  3. Regression tests (test/test_ai-code-backends-infra.el):
    • Cover Eat buffer reuse state reset, echoed query-reply non-matching, oversized single-chunk sequence rejection, invalid newline / >128-char id rejection, and record-count LRU capping.

Validation

  • emacs -Q --batch strict byte-compilation (byte-compile-error-on-warn t) on ai-code-backends-infra-eat.el and ai-code-backends-infra.el: 0 warnings, 0 errors.
  • checkdoc-file on all three modified files: 0 new warnings.
  • emacs -Q --batch ERT suites (test_ai-code-session-attention.el, test_ai-code-backends-infra.el, test_ai-code-backends-infra-ghostel.el): 294/294 passed, 0 unexpected.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T17:07:00.905294Z 2564a66 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: 2564a66d50

ℹ️ 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 thread ai-code-backends-infra.el Resolved

@tninja tninja left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Reviewed at 3053b18dcd0f28f60246decaae213e0724bb409f — all findings resolved.

Verification Summary

  • Eat Buffer Reuse & Parser Bounds: Verified ai-code-backends-infra--reset-program-status-state on Eat session reuse, exact ? support-query matching, 4096-byte sequence cap across single-chunk and multi-chunk inputs, 128-char / newline id validation, and root-preserving 256-record LRU cap in ai-code-backends-infra--program-status-apply.
  • Cross-Feature UI Check: Verified tab-bar attention badges (ai-code-session-attention-mode), Session Dashboard status, Vterm, and Ghostel remain intact without premature done flips or dropped completion notifications.
  • CI & Local Batch Checks: unit-tests (ert, windows-platform) and melpazoid (build) all passed on 3053b18; local emacs -Q --batch strict byte-compilation, checkdoc-file, and 318/318 ERT tests passed.

Ready to merge.

@tninja
tninja merged commit faad927 into main Nov 23, 2026
6 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.

1 participant