Skip to content

fix(relay): reject false submit receipts - #343

Merged
EtanHey merged 5 commits into
mainfrom
fix/spawn-send-focus-cluster
Aug 9, 2026
Merged

fix(relay): reject false submit receipts#343
EtanHey merged 5 commits into
mainfrom
fix/spawn-send-focus-cluster

Conversation

@EtanHey

@EtanHey EtanHey commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • require observable post-submit evidence before reporting relay delivery
  • recognize Codex's real queued-follow-up chrome only when the visible queued item correlates with the submitted text
  • recognize fresh Cursor response activity even when Cursor retains or truncates the composer after submission
  • fail supersede safely without patching registry state when the pane side effect cannot be verified

Related: #364

Review fixes

  • scoped queue detection to Codex queue chrome and submitted-text correlation, preventing stale/global transcript matches
  • reassembled wrapped/decorated Codex queue headings from terminal rows
  • retained bounded transient screen-read polling from current main
  • added exact live Codex/Cursor terminal fixtures, placeholder normalization, and structured supersede failure assertions
  • reproduced the retained-composer Cursor v3 false negative from its raw runtime poll and added a regression for the fresh Working transition
  • preserved literal submissions that equal CLI placeholder copy and reject supersede unless its receipt is explicitly verified
  • made terminal captures cross-platform, corrected post-Return fixture timing, and classify the live Cursor braille Working spinner as working

Verification

  • bun run typecheck
  • bun run build
  • bun run test — 107 files passed; 2,477 tests passed, 1 skipped
  • git diff --check
  • push hook: nightly contract receipts, terminal-state regressions, and full Vitest suite passed on the final head

Evidence boundary

Delivery is accepted only from evidence newer than the pre-submit baseline and correlated with the submitted content. Unchanged historical Cursor responses, unrelated queue blocks, dirty composers without fresh activity, and unverified supersede side effects remain failures.

— cmuxlayerCodex (worker) · codex/gpt-5.6-sol

Note

Reject false submit receipts in relay by verifying Codex queue and Cursor response evidence

  • Adds cursorSubmittedResponseEvidenceSignatures to detect Cursor Working/Thinking/Running activity and thought blocks as a pre/post-Return baseline, treating fresh post-Return evidence as positive submit verification even when the composer still shows text.
  • Adds screenShowsQueuedAgentInput to detect Codex live queue chrome correlated to the submitted text and fail submit verification immediately when a match is found.
  • Adds normalizeKnownPlaceholderComposerInput to collapse known placeholder texts (Codex Implement {feature}, Cursor Plan, search, build anything) to empty so they do not falsely indicate pending input.
  • supersede_agent_goal now fails closed on unverified submits, returning a structured supersede_submit_unverified error without patching the agent registry.
  • allow_busy sends are now subject to submit verification using a shorter 500 ms timeout (BUSY_AGENT_SUBMIT_VERIFY_TIMEOUT_MS), and markAgentWorking is only called when verification succeeds.
  • Adds a braille Working spinner regex (CURSOR_BRAILLE_WORKING_RE) so Cursor screens with the braille spinner are classified as working status in inferStatus.

Macroscope summarized a4fd710.

@cursor

cursor Bot commented Aug 1, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_a994601e-b4cf-4e79-8b40-544e623feb20)

@EtanHey

EtanHey commented Aug 1, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@greptileai review

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

@EtanHey I will review pull request #343.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@EtanHey, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 44 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 38813e9b-508c-47c1-a5db-392d49058129

📥 Commits

Reviewing files that changed from the base of the PR and between 52fb19d and a4fd710.

📒 Files selected for processing (7)
  • .gitattributes
  • src/screen-parser.ts
  • src/server.ts
  • tests/enter-reliability.test.ts
  • tests/screen-parser.test.ts
  • tests/server-agent-tools.test.ts
  • tests/server.test.ts
📝 Walkthrough

Walkthrough

Submission verification now detects queued Codex input, correlates fresh Cursor responses, and fails closed when evidence is unavailable. Relay and supersession flows use verified delivery results, bounded busy timeouts, and non-retryable reconciliation errors.

Changes

Submission verification

Layer / File(s) Summary
Evidence detection and verification flow
src/server.ts
Composer placeholders are normalized. Codex queue evidence and fresh Cursor response evidence are correlated with submitted text and pre-submit snapshots. Pending input prevents successful verification.
Busy relay verification
src/server.ts
Interactive and allow_busy relay deliveries now verify submissions. Busy deliveries use a 500 ms timeout and do not retry Enter.
Verified supersession state updates
src/server.ts, tests/server-agent-tools.test.ts
supersede_agent_goal updates registry state only after verified submission. Unverified pane input returns supersede_submit_unverified with no retry.
Reliability fixtures and regression coverage
tests/enter-reliability.test.ts, tests/server.test.ts, tests/painpoint-replay.test.ts, tests/fixtures/*, .gitattributes
Tests and fixtures cover queued Codex input, Cursor response correlation, placeholders, screen-read failures, timing bounds, and cleanup behavior.

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

Sequence Diagram(s)

sequenceDiagram
  participant AgentRelay
  participant SubmissionVerifier
  participant TerminalSurface
  AgentRelay->>SubmissionVerifier: submit agent input
  SubmissionVerifier->>TerminalSurface: capture pre-Return screen evidence
  TerminalSurface-->>SubmissionVerifier: parsed screen snapshot
  SubmissionVerifier->>TerminalSurface: send Return and poll verification evidence
  TerminalSurface-->>SubmissionVerifier: queued input, working state, or fresh Cursor response
  SubmissionVerifier-->>AgentRelay: verified success or fail-closed error
Loading

Possibly related PRs

Poem

A rabbit checks the queue with care,
No hidden message lingers there.
Fresh Cursor thoughts may pass the gate,
While Codex waits must calmly wait.
No double hops, no blind retry—
Verified paws go safely by.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: relay verification now rejects false submission receipts.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/spawn-send-focus-cluster

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Comment thread src/server.ts Outdated
Comment thread src/server.ts Outdated

@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: 191b963cde

ℹ️ 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 src/server.ts Outdated
Comment thread src/server.ts Outdated
@EtanHey

EtanHey commented Aug 1, 2026

Copy link
Copy Markdown
Owner Author

Independent Claude review — head 191b963cdeb24ffe7d41862c40608c94927e87d1

Verdict: NOT_SHIP

The diagnosis is right and the direction is right — evidence must outrank status, and requested verification must fail closed. But the ordering change ships a false-negative class broader than the false-positive class it removes, and the new tests cannot see it because they use a hand-authored screen mock while this repo already contains real captured agent frames that contradict the mock's assumptions.

Tests I ran (read-only, at this head, worktree clean before and after):

  • -t 'Probe (B|E)|fails closed when requested agent submission verification cannot read the screen'3 passed, 15 skipped
  • focused gate (5 files) → 379 passed
  • full gate → 106 files, 2330 passed

All three receipts reproduce exactly as claimed. The problems are not in the counts.


CRITICAL — Cursor relays regress from success to hard error.
tests/fixtures/cursor-2026-06-04-task-done.txt is a real capture in this repo. Line 9 shows the agent's answer TASK_DONE already printed — the submit unambiguously happened — and line 13 still shows the submitted prompt inside Cursor's input box. Verified by probe: screenShowsPendingInput(thatFrame, submittedText) === true. With Cursor's own running marker (⬡ Running..., screen-parser.ts:254status="working") the same frame yields status=working and pendingInput=true simultaneously.

Under server.ts:3571-3576 pending evidence now gates the status short-circuit; hasClearedAgentComposer can't fire (box holds the echo); retryEligiblePendingInput requires source_event==="spawn_agent" (3601) so no retry; loop runs the full 5000 ms (server.ts:347) → submit_verified:falseSubmitVerificationError. The message was delivered; the caller is told it wasn't and will resend. Affects send_to, send_to_agent, interact, supersede_agent_goal, dispatch_nudge, tracked send_input/send_command. No test covers Cursor on any changed path.

MAJOR — Codex has no cleared-composer success path. Probe on the real codex-0.144.3-surface-489-working.txt: an empty Codex composer renders its placeholder, so extractComposerInputRegion returns "Implement {feature}", never "". Same for Cursor ("Plan, search, build anything"). So Codex's only positive signal is a transient spinner — a short reply, an approval modal, or an unmatched status line now hard-errors where it previously returned null/ok.

MAJOR — supersede_agent_goal defaults allow_busy:true (10586-10592). Superseding a working agent is exactly the queue-chrome case, so it now throws — and the throw skips supersedePatch (10612+). The pane holds a queued /goal the registry has no record of, and the caller retries. dispatch_nudge has the same flag but catches and stays durable, so that one is fine.

MAJOR — the queue regex is unverified against a real frame. screenShowsQueuedAgentInput (1744-1757) requires the heading to be a bare full line. No raw Probe E capture exists in the evidence set or the repo; the only representation is enter-reliability.test.ts:202, composed by hand. The one real Codex capture here proves Codex draws bordered panels (╭──╮ │ >_ OpenAI Codex …). If the queue block is boxed or suffixed, the guard silently no-ops and Probe E's false green returns in production with all three new tests still green. The Probe B/E tests replay the narrative of the probes, not their bytes — a departure from this repo's own real-capture fixture practice.

MAJOR — the queue guard can false-positive. It scans the whole 30-line window rather than the composer chrome region, and never correlates the item with opts.text. Any Codex pane whose visible transcript contains the heading phrase plus a later line becomes unreachable via send_to — 5 s stall then error, every time. This fleet passes these exact strings around in agent panes.

MINOR — busy sends go from immediate-return to up to 5 s then throw (multiplied across broadcast/dispatch_to_agent fan-outs); CMUXLAYER_SUBMIT_VERIFY_TIMEOUT_MS default is 5000 in code vs 2000 in CLAUDE.md; allow_recovery_enter_retry is unreachable on every path this PR touches, so Probe B's one-Return assertion doesn't actually pin that contract; the allow_busy tool description (10342) no longer matches the behaviour.


Answers to the review questions

  1. Queue chrome false-positive/negative? Both — see the two MAJORs above.
  2. Can working/thinking still outrank pending input? No, correctly fixed. It now also outranks status for CLIs that legitimately retain submitted text — that's the CRITICAL.
  3. allow_busy duplicate Return? Avoided, confirmed. Truthful evidence: yes for Probe B/E, no for supersede (state divergence).
  4. Fail-closed consistent across all listed aliases? Yes — applied at all three exits, every alias routes through deliverInputChunks.
  5. spawn_agent advisory null justified and isolated? Yes to both — source_event:"spawn_agent" is used only for the launcher command (4344, 4357); boot_prompt is a separate event already failing closed via require_working_status.
  6. Do tests reproduce the probes faithfully? No — all three are FakeClaudeSurfaceClient reconstructions. Real captures exist in this repo for exactly this and weren't used.
  7. Compat/latency regressions? Yes — the CRITICAL, the two Codex/supersede MAJORs, and the 5 s busy-send stall.

Required before merge

Scope the pending-composer veto away from retain-on-submit CLIs (the Cursor capture is a ready-made RED); treat known CLI placeholders as cleared; keep supersede's registry patch consistent with the pane; re-derive the queue regex from a captured Probe E frame and commit it; anchor the queue scan to the composer region and prefix-match the item against the sent text; settle the busy-send latency and the timeout-default drift.

Keep as-is: the spawn_agent carve-out, fail-closed on unreadable/empty screens, the busy no-retry contract, and all three new tests — they are correct, just insufficient.

Runtime verification still outstanding

Mock-green is not live-green. Against the built artifact of this head (not the installed 0.4.16): (1) send_to a live working Cursor worker — must succeed; (2) a Codex short-reply relay — no false could not be verified; (3) Probe E replay with a verbatim read_screen(raw:true) capture committed; (4) Probe B replay asserting failure + exactly one Return; (5) supersede a working agent, registry and pane must agree; (6) fan-out latency vs the pre-PR binary.

Full review with line-level evidence and probe transcripts: docs.local/defect-lane/pr343-claude-review.md.

EtanHey and others added 3 commits August 9, 2026 12:38
These sat UNCOMMITTED in this worktree from the round-3 iteration that hit the
3-attempt cap. Not reviewed, not verified, NOT claimed working — the lane's known
blocker (Cursor retained-composer receipt matcher) was never resolved.

Committed only so a worktree prune or cleanup cannot delete them. #343 is still
CONFLICTING against main and needs a rebase on merit before any of this is trusted.

Preserved by the outgoing cmuxlayer lead; authored by the #343 worker.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: cmuxlayerCodex running gpt-5.6-sol <noreply@anthropic.com>
@EtanHey
EtanHey force-pushed the fix/spawn-send-focus-cluster branch from 191b963 to 52fb19d Compare August 9, 2026 09:52
@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_91ce0c41-a761-44b0-b300-42814e71606b)

@EtanHey

EtanHey commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

All NOT_SHIP items were reconciled on the rebased head:

  • Cursor retained/truncated composers can now verify through fresh, baseline-deduped response activity correlated after the submitted text. I reproduced the v3 Working false negative from the raw runtime poll, added a RED regression, and verified the inverse historical-response cases remain negative.
  • Placeholder matching is normalized to the exact terminal forms.
  • Supersede returns a non-retry-safe unverified-side-effect error and does not patch registry state when delivery cannot be proven.
  • Codex queue matching uses actual queue chrome, wrapped-heading reconstruction, and submitted-prefix correlation rather than a global transcript regex.
  • Transient reads are polled within the bounded verification window inherited from current main.

Fresh local and push-hook gates pass: typecheck, build, 107 Vitest files, 2,473 tests passed with 1 skipped, whitespace check, nightly contract receipts, and terminal-state regressions.

Local CodeRabbit's post-fix review produced no valid correctness defect: its supersede-reason suggestion was disproved by an added assertion (the shared error serializer already emits input_still_pending); module extraction is unrelated refactoring; and extending the bounded four-row heading scan would broaden terminal transcript acceptance without a real capture demonstrating the need.

— cmuxlayerCodex (worker) · codex/gpt-5.6-sol

@EtanHey

EtanHey commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@codex review

Please review the rebased final head, including the raw-runtime Cursor retained-composer regression and the Codex queue correlation fixes.

— cmuxlayerCodex (worker) · codex/gpt-5.6-sol

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

@EtanHey I will review the rebased final head. I will check the Cursor retained-composer regression and the Codex queue correlation changes.

⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment thread src/server.ts

@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: 52fb19d687

ℹ️ 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 src/server.ts

@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: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/enter-reliability.test.ts (1)

825-830: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Derive the verification-window boundary from a shared constant.

The test pins the window to the open interval between 4_900 ms and 5_900 ms with literal values. The PR objectives record a discrepancy between the documented timeout and the code default. If the default changes, this test fails with an opaque "settled === false" mismatch instead of a clear signal.

Export the verification timeout from src/server.ts (or expose it on __submitEvidenceTestHooks) and compute the two advance amounts from it.

🤖 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 `@tests/enter-reliability.test.ts` around lines 825 - 830, Replace the
hard-coded timer advances in the test around resultPromise with values derived
from a shared exported verification-timeout constant. Export that timeout from
server.ts or expose it through __submitEvidenceTestHooks, then compute the
pre-boundary and post-boundary advances from it while preserving the existing
assertions.
🤖 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 @.gitattributes:
- Around line 1-3: Update the .gitattributes rules for terminal-capture fixtures
to use a glob covering all relevant files under the fixture directories, and pin
their line endings to LF so Git does not normalize them to CRLF on Windows.
Preserve the existing whitespace handling for trailing blank-line padding while
applying both attributes consistently to future captures.

In `@tests/enter-reliability.test.ts`:
- Around line 280-282: Update the branch using postReturnPendingScreenText so it
also requires returnCount > 0 before returning the queued fixture. Preserve the
existing pendingText and non-null checks, ensuring pre-Return baseline reads
remain queue-free while post-Return reads still return the pending screen.
- Around line 1312-1321: Extend the assertions for the failed submit result and
emitted event in this test to verify both submit_verification_reason and
retry_safe, matching the expected unavailable-screen values used by the parallel
tests. Keep the existing submit_verified and retry_count assertions unchanged.
- Around line 1270-1295: Make the fake Codex frame realistic in the test
“ignores adjacent Codex queue chrome for another sender's visible prefix” by
setting client.requiredReturns to 1 so pendingText clears before the queued
read. Preserve the unrelated queued text and existing assertions, ensuring the
empty composer represents a successful Return rather than an unsubmitted
message.
- Around line 1468-1470: Update the Cursor screen parser to recognize the “⠀⠞
Working” spinner as the working status, add or extend parser coverage for this
fixture, and change the assertion on parsed.screen?.status to expect “working”
while preserving the existing screen-read assertions.

In `@tests/server.test.ts`:
- Line 3027: Update the test setup around vi.useFakeTimers() to register
vi.useRealTimers() before processScopedTmpDir("cmuxlayer-f8-send-command"), or
use Vitest’s test-finished cleanup hook, so setup failures cannot leak fake
timers into later tests.

---

Outside diff comments:
In `@tests/enter-reliability.test.ts`:
- Around line 825-830: Replace the hard-coded timer advances in the test around
resultPromise with values derived from a shared exported verification-timeout
constant. Export that timeout from server.ts or expose it through
__submitEvidenceTestHooks, then compute the pre-boundary and post-boundary
advances from it while preserving the existing assertions.
🪄 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: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bf4f644b-adbe-45f3-b711-4d1890e1760a

📥 Commits

Reviewing files that changed from the base of the PR and between 191b963 and 52fb19d.

📒 Files selected for processing (9)
  • .gitattributes
  • src/server.ts
  • tests/enter-reliability.test.ts
  • tests/fixtures/cursor-pr343-live-accepted-response.txt
  • tests/fixtures/cursor-pr343-v2-immediate-working-response.txt
  • tests/fixtures/painpoints/codex-pr343-live-queued-followup.txt
  • tests/painpoint-replay.test.ts
  • tests/server-agent-tools.test.ts
  • tests/server.test.ts
💤 Files with no reviewable changes (2)
  • tests/server-agent-tools.test.ts
  • src/server.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Macroscope - Correctness Check
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-03-15T10:42:35.917Z
Learnt from: EtanHey
Repo: EtanHey/cmuxlayer PR: 1
File: tests/quality-tracking.test.ts:171-200
Timestamp: 2026-03-15T10:42:35.917Z
Learning: In tests/quality-tracking.test.ts for the cmuxlayer project, ensure that at or above 80% context quality degradation, behavior depends on depth: depth-0 agents receive a /compact command; depth > 0 agents are killed and logged (kill + log). Respawn of non-root agents is out of scope for v1. Treat the design doc quality tracking section as the authoritative source for this behavior, and align test expectations accordingly.

Applied to files:

  • tests/server.test.ts
  • tests/painpoint-replay.test.ts
  • tests/enter-reliability.test.ts
🪛 LanguageTool
tests/fixtures/cursor-pr343-v2-immediate-working-response.txt

[grammar] ~3-~3: Ensure spelling is correct
Context: ... Duration 235ms (transform 59ms, setup 7ms, collect 56ms, tests 22ms, environment ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~30-~30: Ensure spelling is correct
Context: ... Duration 246ms (transform 57ms, setup 5ms, collect 60ms, tests 22ms, environment ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~57-~57: Ensure spelling is correct
Context: ... Duration 236ms (transform 61ms, setup 6ms, collect 59ms, tests 24ms, environment ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (15)
tests/enter-reliability.test.ts (10)

5-58: LGTM!


78-93: LGTM!


118-138: LGTM!


228-269: LGTM!


496-533: LGTM!


645-646: LGTM!

Also applies to: 718-718, 735-736, 860-861, 876-876, 892-893, 908-908, 925-926


967-1128: LGTM!


1130-1268: LGTM!


1349-1448: LGTM!


1480-1603: LGTM!

tests/fixtures/cursor-pr343-live-accepted-response.txt (1)

1-22: LGTM!

tests/fixtures/painpoints/codex-pr343-live-queued-followup.txt (1)

1-81: LGTM!

tests/painpoint-replay.test.ts (1)

70-70: LGTM!

Also applies to: 177-177

tests/server.test.ts (1)

3060-3082: LGTM!

tests/fixtures/cursor-pr343-v2-immediate-working-response.txt (1)

1-101: 🗄️ Data Integrity & Integration

Confirm the CI/former workflow preserves terminal-panic fixture whitespace.

This fixture has right-padding spaces on many lines, and .gitattributes only suppresses git diff blank-at-eol warnings. If Prettier/editorconfig/pre-commit/formatted commit hooks strip trailing whitespace, the fixture will stop reproducing the real pane and CURSOR_PR343_V2_PRE_RETURN_SCREEN will change. Add an ignore or config exception, or keep this capture without trailing-space-sensitive formatting.

Comment thread .gitattributes Outdated
Comment thread tests/enter-reliability.test.ts Outdated
Comment thread tests/enter-reliability.test.ts
Comment thread tests/enter-reliability.test.ts
Comment thread tests/enter-reliability.test.ts Outdated
Comment thread tests/server.test.ts Outdated
Co-Authored-By: cmuxlayerCodex running gpt-5.6-sol <noreply@anthropic.com>
@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_aeff1d52-948c-461e-8098-5102d4b98cf5)

Comment thread src/server.ts
Co-Authored-By: cmuxlayerCodex running gpt-5.6-sol <noreply@anthropic.com>
@cursor

cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_811398e7-6bfc-44b3-85bf-a0b22fa15bbb)

@EtanHey

EtanHey commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@codex review

Please review final head a4fd710. All findings from the prior round now have focused fixes or strengthened tests, and the push hook passes 107 files / 2,477 tests with 1 skipped.

— cmuxlayerCodex (worker) · codex/gpt-5.6-sol

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- PR metadata ---'
gh pr view 343 --repo EtanHey/cmuxlayer --json headRefOid,baseRefOid,files,title,url \
  --jq '{title, url, baseRefOid, headRefOid, files: [.files[].path]}'

printf '%s\n' '--- Recent commits on the PR branch ---'
git log --oneline --decorate -12

printf '%s\n' '--- Changed files relative to base ---'
git diff --name-status "$(git merge-base HEAD origin/HEAD)" HEAD 2>/dev/null || git diff --name-status HEAD~1 HEAD

printf '%s\n' '--- Outline: primary implementation ---'
ast-grep outline src/server.ts --items all --match 'deliverInputChunks|verify|screenShowsQueuedAgentInput|screenShowsPendingInput|hasClearedAgentComposer|supersede_agent_goal' --view expanded || true

printf '%s\n' '--- Outline: targeted tests ---'
ast-grep outline tests/enter-reliability.test.ts --items all --match 'Cursor|queue|queued|retained|supersede|allow_busy' --view expanded || true

Length of output: 3164


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="$(git merge-base HEAD origin/HEAD)"

printf '%s\n' '--- Implementation diff: server and screen parser ---'
git diff --unified=80 "$base" HEAD -- src/server.ts src/screen-parser.ts

printf '%s\n' '--- Test diff: verification and supersede paths ---'
git diff --unified=60 "$base" HEAD -- \
  tests/enter-reliability.test.ts \
  tests/screen-parser.test.ts \
  tests/server-agent-tools.test.ts \
  tests/server.test.ts \
  tests/painpoint-replay.test.ts

printf '%s\n' '--- Helper and call-site locations ---'
rg -n -C 4 -P '\b(screenShowsPendingInput|screenShowsQueuedAgentInput|hasClearedAgentComposer|verify[A-Za-z]*Submit|deliverInputChunks|supersedePatch|supersede_agent_goal)\b' \
  src/server.ts src/screen-parser.ts

printf '%s\n' '--- Server verification helper region ---'
sed -n '1840,2140p' src/server.ts
sed -n '3360,3740p' src/server.ts
sed -n '10480,10680p' src/server.ts

printf '%s\n' '--- New raw fixtures ---'
for file in \
  tests/fixtures/cursor-pr343-live-accepted-response.txt \
  tests/fixtures/cursor-pr343-v2-immediate-working-response.txt \
  tests/fixtures/painpoints/codex-pr343-live-queued-followup.txt
do
  printf '\n--- %s ---\n' "$file"
  cat -n "$file"
done

Length of output: 208591


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Composer and CLI inference primitives ---'
rg -n -C 8 -P '\b(function (inferComposerCli|matchComposerPromptLine|normalizeTerminalText|isSubmitVerifiedStatus)|const (CODEX|CURSOR).*PROMPT)' src/server.ts

printf '%s\n' '--- Exact source windows for the primitives and verification loop ---'
sed -n '1540,1845p' src/server.ts
sed -n '3930,4170p' src/server.ts

printf '%s\n' '--- Timeout and allow_busy documentation references ---'
rg -n -C 2 -i 'CMUXLAYER_SUBMIT_VERIFY_TIMEOUT_MS|submit.verify.timeout|verify timeout|allow_busy|queued-but-unsubmitted' \
  README.md CLAUDE.md docs src tests 2>/dev/null || true

printf '%s\n' '--- Final commit delta ---'
git diff --check HEAD~1 HEAD
git diff --stat HEAD~1 HEAD
git diff --unified=40 HEAD~1 HEAD -- \
  src/server.ts src/screen-parser.ts \
  tests/enter-reliability.test.ts tests/screen-parser.test.ts \
  tests/server-agent-tools.test.ts

printf '%s\n' '--- Fixture-backed test inventory ---'
rg -n -C 2 -P '(CURSOR_PR343|CODEX_PR343|PR343_LIVE_QUEUE|retained-composer|wrapped.*Codex|supersede_agent_goal reports)' \
  tests/enter-reliability.test.ts tests/server-agent-tools.test.ts tests/screen-parser.test.ts

printf '%s\n' '--- File-level diff check ---'
git diff --check "$(git merge-base HEAD origin/HEAD)" HEAD

Length of output: 76826


@EtanHey I found no new correctness issue in final head a4fd710.

The Cursor path now uses baseline-deduped response evidence. It accepts a verified post-submit response when Cursor retains composer text. It rejects unchanged historical response evidence and unavailable baselines.

The Codex path now scopes queue detection to the active composer region. It reconstructs wrapped queue headings. It requires the queued prefix to match the submitted text. It rejects matched queued input before a working-status receipt.

Busy relays use the bounded 500 ms verification window. They do not issue a recovery Return. supersede_agent_goal now preserves registry state when delivery is unverified and returns non-retry-safe reconciliation guidance.

The tests use the added raw Cursor and Codex fixtures. The PR diff passes git diff --check. I did not run the test suite because the review sandbox cannot execute repository code.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: a4fd7103a7

ℹ️ 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 src/server.ts
Comment on lines +2027 to +2029
const remaining = baselineCounts.get(signature) ?? 0;
if (remaining === 0) {
return true;

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 Track Cursor response blocks instead of mutable signatures

When allow_busy repeats text that already appears in a Cursor transcript while the earlier response is still evolving, a missed Return can still be reported as verified: the pre-Return baseline contains the old response's current signature, but a subsequent Working transition or additional streamed thought text produces a different signature, so this branch treats the same historical response as fresh and the pending composer is ignored. Compare stable response-block identity or require evidence created after the pre-Return boundary rather than treating any unseen content signature as a new response.

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