Skip to content

fix(fe): drop stale replies in attention inbox and digest panel - #312

Merged
mergify[bot] merged 2 commits into
mainfrom
claude/fj-4-request-token-r2
Oct 4, 2026
Merged

mergify[bot] merged 2 commits into
mainfrom
claude/fj-4-request-token-r2

Conversation

@Cuarroc

@Cuarroc Cuarroc commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Die Anzeige von Empfehlungen und Tages-Digests konnte von einer älteren, langsameren Antwort überschrieben werden. Jetzt zählt nur noch die jeweils neueste Anfrage, und nach dem Schließen der Ansicht schreibt nichts mehr. Das ist rein Oberfläche, es gibt keine Rust-Änderung.

Ersetzt #294 (Trailer-Form, red-first)

Report

What changed

  • AttentionInbox: replaced the project-only guard with a request token (tokenRef), bumped on every request and on effect cleanup (project switch / unmount). Older polls of the same project can no longer overwrite newer data.
  • ActivityView DigestPanel: separate tokens for the date list and the page request, bumped on project switch and unmount. The activity feed already had a token.
  • Pattern reused from ActivityView/useBoard (as in fix(history): serialize message polling (INV-07) #149, fix(frontend): drop late poll replies after project/worker switch #194).
  • Tests: deferred-promise tests (request 1 starts, request 2 starts, request 2 resolves, request 1 resolves → UI shows request 2) for the inbox and the digest page, plus an unmount test. The unmount test already passed before the fix (React 18 does not warn); it is kept as a guard and was committed with the fix, not named as Test-First evidence.

Evidence (base origin/main 0c7b513ad79b800f5919370e0a2c3fcc1487f156, head 740c4c1cd192e299a307b673ad70099a5ac4b11e, +124/-12 lines including tests)

  • Red: commit de42c66ae66d1b661e36333176909f083a73ca9e fails exactly the two new race tests (npx vitest run src/components/AttentionInbox.test.tsx src/components/ActivityView.test.tsx, exit 1; 2 failed, 7 passed).
  • Green: the same command at the fix exits 0; 10 passed.
  • bash scripts/ci/red-first.sh: exit 0 (log /tmp/fj4-r2-red-first.log on the server); both exact named tests are missing at the merge base and green at the head.
  • bash scripts/ci/gates.sh lane prepush: exit 0 (log /tmp/fj4-r2-prepush.log on the server; frontend 463/463, HQ 510/510, Rust 1706/1706).
  • git ls-remote origin refs/heads/claude/fj-4-request-token-r2: exit 0; remote SHA equals final SHA.

NICHT ABGEDECKT

  • #[cfg(windows)] tests and Windows clippy arms (Windows lane runs in the merge queue).
  • No GUI/visual check; the app was not launched.
  • Provider limit was not checked because no usage file was supplied to the start check.

Review disposition

  • Reviewer: Codex (OpenAI), GPT-5; candidate 740c4c1cd192e299a307b673ad70099a5ac4b11e.
  • F1 (medium), src/components/AttentionInbox.tsx:69-80: accepted. Starting each 15-second poll invalidates every earlier reply, so responses that consistently take longer than the interval can never reach the UI. Countercheck confirmed that project-switch and unmount guards do not prevent this same-project starvation.
  • Remediation status: blocked before push. A red-first test reproduced the issue and the targeted suite passed after the local fix, but bash scripts/ci/red-first.sh exited 1 because the unpushed fix commit contains an invalid Regression-For SHA. History rewriting is prohibited, so no review commit was pushed.
  • Architecture drift: none found. The request-token approach matches the existing frontend pattern; the remaining issue is its settlement rule, not a second state/IPC/error pattern.
  • Queue: not requested because the review remediation is not pushable.

Cuarroc and others added 2 commits October 4, 2026 17:12
Test-First: src/components/AttentionInbox.test.tsx::keeps the newer poll reply when an older one for the same project lands last
Test-First: src/components/ActivityView.test.tsx::shows the newest digest page when an older page request resolves last

Co-Authored-By: GPT-5 <noreply@openai.com>
Regression-For: de42c66

Co-Authored-By: GPT-5 <noreply@openai.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 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-10-04T15:24:18.246871Z 740c4c1 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: 740c4c1cd1

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

const tokenRef = useRef(0);

const refreshRecos = useCallback(async () => {
const mine = ++tokenRef.current;

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 Avoid invalidating every slow poll response

When listRecommendations consistently takes longer than the 15-second interval, each timer tick increments this token before the preceding request completes, so every response is discarded at line 76 and the inbox can remain permanently empty or stale. This can occur during sustained backend or database latency; either avoid overlapping polls or track the newest successfully applied request rather than requiring the response to belong to the most recently started request.

Useful? React with 👍 / 👎.

@mergify

mergify Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@Cuarroc

Cuarroc commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

@Mergifyio queue

@Cuarroc Cuarroc added the priority Mergify: zuerst in die Queue (nur Koordinator) label Oct 4, 2026
@mergify mergify Bot added the queued label Oct 4, 2026
@mergify
mergify Bot merged commit 7b4fe4a into main Oct 4, 2026
11 checks passed
@mergify

mergify Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 11 minutes 41 seconds in the queue, including 11 minutes 20 seconds running CI.

Required conditions to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority Mergify: zuerst in die Queue (nur Koordinator)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant