Skip to content

fix(humanize): repair grounding and per-user thread state - #1

Merged
yunhai89 merged 1 commit into
masterfrom
agent/fix-humanize-grounding-thread-state
Aug 15, 2026
Merged

fix(humanize): repair grounding and per-user thread state#1
yunhai89 merged 1 commit into
masterfrom
agent/fix-humanize-grounding-thread-state

Conversation

@yunhai89

Copy link
Copy Markdown
Owner

Summary

  • Repair grounding assembly and injection so Planner receives structured grounding before memory lookup, with memory scoped by threadUserIds.
  • Resolve quoted messages outside the rolling window through getReply / get_msg / history and store them as lightweight replySource context.
  • Make correction timeouts and strong-signal chase limits per-user, so one member's correction does not silence the whole group.
  • Keep shadow and real replies consistent, and advance the cursor when cooldown or rate limiting skips a message.
  • Expose webSearch through the assembled runtime and fix the stress-test import path.

Root cause

  • groundingObj was referenced before declaration, so the resulting TDZ error was caught and silently disabled grounded memory.
  • Planner grounding injection returned the wrong shape.
  • Correction handling referenced getGroundingRaw outside its build closure and used group-global timers/streaks.
  • Quote resolution only searched the in-memory rolling buffer.
  • Shadow replies did not update the strong-reply streak, allowing inconsistent chase behavior.

Validation

  • node scripts/run-tests.mjs: 32/32 module files passed, 0 failures
  • node stress/anti-misread/deterministic.mjs: 61/61 passed
  • node stress/grounding-test.mjs: 9/9 passed
  • ESLint passed for all changed files
  • git diff --check passed

Note

A full-repository eslint . still reports the pre-existing unrelated model/selfstate/reflection.js:87 undefined budget issue; this PR does not modify that file.

@yunhai89
yunhai89 marked this pull request as ready for review August 15, 2026 17:15
@yunhai89
yunhai89 merged commit 23b2c83 into master Aug 15, 2026
1 check failed
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.

2 participants