Skip to content

Wait for the MAX_TOKENS diagnostic in the cut-off follow-through tests - #1951

Merged
Fei2411 merged 1 commit into
devfrom
chore/follow-through-max-tokens-race
Nov 21, 2026
Merged

Fei2411 merged 1 commit into
devfrom
chore/follow-through-max-tokens-race

Conversation

@Fei2411

@Fei2411 Fei2411 commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Issue

No issue. This fixes a flaky CI test: follow-through.test.js:396, "a turn that ended on the token limit gives what it said, marked as not complete", failed once on ubuntu · Node 24 with "expected 1 MAX_TOKENS diagnostic, got 0". It first showed up on the now-closed #1750.

What changed / 改了什么

The MAX_TOKENS record in logs/diagnostics.jsonl is written in the background. Two cut-off tests read the file once, so a slow runner could read it before the record was there. They now call readDiagnostics(home, list => list.some(entry => entry.code === 'MAX_TOKENS')), which waits up to 3 s for the record, the same way a sibling test in the file already does. This is a test-only change; product code is unchanged.

Changelog

none

How I checked it / 怎么验证的

  • npm test (in ds-bot/): 3602 passed, 0 failed, 4 skipped
  • node scripts/build-client.mjs --check
  • npm run lint
  • Smoke test, for changes to index.js or src/host/: not needed (test-only)
  • Screenshot attached, for interface changes: not needed

Checklist / 检查

  • One issue, one subject. / 只做一件事。
  • src/client/ changed → npm run build ran and client.js is committed: not applicable
  • No keys, tokens or personal data, also in screenshots. / 没有密钥、token 或个人信息,截图里也没有。
  • No AI tool as author or Co-authored-by. / 没有把 AI 工具写成作者或 Co-authored-by。

Agent: Devin (Cognition)


Product Engineer opened this PR for Lulu
Implemented in session Fix Telegram replies dropped with time-context message
Review with Devin · Open in Devin Desktop


The diagnostics log is written in the background. Two tests read it with no
wanted entry, so the first read could return before the MAX_TOKENS line
landed and fail with 0 !== 1 on a slow runner. Wait for that entry, as the
watched-turn test already does.
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access that start with 'Devin'.

  • Disable automatic comment, CI, and merge conflict monitoring

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 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-21T09:27:55.101225Z df197b4 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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

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

Code Reaper review at df197b46 — pass.

  • The two cut-off tests now pass a MAX_TOKENS predicate to readDiagnostics, which waits for the background write instead of reading once. This matches the sibling test at line 464 and is the same change as 40679da2 from #1750. Test-only.
  • follow-through.test.js passed 11/11 runs locally (36/36 tests each time, real harness).
  • PR body follows the template and has the Agent: Devin (Cognition) line. Base is dev and it merges cleanly.
  • Overlaps: no other open PR touches ds-bot/test/follow-through.test.js.

Written by Devin

@Fei2411
Fei2411 merged commit 0ba1978 into dev Nov 21, 2026
15 checks passed
@Fei2411
Fei2411 deleted the chore/follow-through-max-tokens-race branch November 21, 2026 09:43
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