Skip to content

fix(agent): strip _flush_sentinel from API messages#227

Merged
teknium1 merged 1 commit intoNousResearch:mainfrom
Farukest:fix/flush-sentinel-leak
Mar 2, 2026
Merged

fix(agent): strip _flush_sentinel from API messages#227
teknium1 merged 1 commit intoNousResearch:mainfrom
Farukest:fix/flush-sentinel-leak

Conversation

@Farukest
Copy link
Copy Markdown
Contributor

@Farukest Farukest commented Mar 1, 2026

Added api_msg.pop("_flush_sentinel", None) next to the existing api_msg.pop("reasoning", None) in the flush API message building loop. This strips the internal marker before sending messages to the API.

Test

Added TestFlushSentinelNotLeaked to tests/test_run_agent.py that verifies no message sent to the API contains _flush_sentinel. Test confirmed the leak exists without the fix and passes with it.

Closes #226

@Farukest
Copy link
Copy Markdown
Contributor Author

Farukest commented Mar 1, 2026

Hi @teknium1 , I just discovered that issue too and opened PR. I hope all okay.
Fixed in #227 - the _flush_sentinel marker wasn't being stripped from API messages during memory flush.
Added a regression test.

@teknium1
Copy link
Copy Markdown
Contributor

teknium1 commented Mar 2, 2026

Merged — thanks for the fix!

Had to resolve merge conflicts (stale branch) and fix the test: flush_memories() uses get_text_auxiliary_client() which returns an auxiliary client that bypasses agent.client. Added a mock for that + a guard assertion so the test doesn't pass vacuously.

@Farukest
Copy link
Copy Markdown
Contributor Author

Farukest commented Mar 3, 2026

Merged — thanks for the fix!

Had to resolve merge conflicts (stale branch) and fix the test: flush_memories() uses get_text_auxiliary_client() which returns an auxiliary client that bypasses agent.client. Added a mock for that + a guard assertion so the test doesn't pass vacuously.

Thanks for fixing the test mock target 👍

@andrueandersoncs
Copy link
Copy Markdown

🔄 Started Work on Issue #227

Branch: auto/issue-227-react-hydration-error-418-on-all-pages
Worktree: /Users/andrue/.hermes/worktrees/vantage/issue-227-react-hydration-error-418-on-all-pages

Investigation Plan

  1. Identify components causing hydration mismatch between server/client
  2. Focus on localStorage-dependent rendering patterns
  3. Fix SSR/client rendering inconsistency
  4. Verify fix across all pages

Will update with findings and fix.

@andrueandersoncs
Copy link
Copy Markdown

✅ Fixed

Changes Made

Fixed the useIsMobile hook in hooks/use-mobile.ts to prevent server/client hydration mismatches:

Before:

After:

  • Initialize with false consistently for SSR
  • Added mounted state tracking
  • Return actual detected value only after client mount
  • Server and first client render now match perfectly

Code Changes

// Initialize with false for SSR consistency
const [isMobile, setIsMobile] = React.useState<boolean>(false)
const [mounted, setMounted] = React.useState(false)

React.useEffect(() => {
  setMounted(true)
  // ... detection logic
}, [])

// Return consistent values during SSR and initial render
return mounted ? isMobile : false

Verification

  • ✅ All 448 tests pass
  • ✅ Build compiles cleanly
  • ✅ Lint passes (no new errors)
  • ✅ Dogfood QA on Railway deployment shows no hydration errors on:
    • Today page (/)
    • Weekly Plan page (/weekly-plan)
    • Adjustments page (/adjustments)
    • Profile page (/profile)
    • Progress page (/progress)

The 503 errors visible in console are from API endpoints (Issue #231), unrelated to hydration.

Commit

  • Main branch: aa30ee2
  • Changes: hooks/use-mobile.ts (+9 lines, -2 lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants