pub(crate) fn is_hidden_reinjection_text(text: &str) -> boolExpand description
True for a <system-reminder>...Your memory was reinjected because your working context was just reset... message — a hidden memory-reinjection
turn (frontend/app/view/agent/memory-reinjection.ts’s
composeReinjectionMessage). Mirrors that module’s
isMemoryReinjectionMessage exactly, including the exact signature
string — kept as a literal duplicate rather than a shared constant
(Rust and TypeScript can’t share one across the language boundary
without extra plumbing this one string doesn’t justify), so a future
change to the frontend’s wording must update this function too.
reagentx P0, PR #3502, FOURTH review round: extract_digest_text is the
single choke point BOTH next_prompt_suggestion and
activity_watcher.rs’s independent 20s periodic sweep funnel through —
fixing it here closes the leak for every current and future caller at
once, the same “one choke point, not scattered per-consumer patches”
lesson hiding-stream-flush-queue.ts already applied on the frontend
side, now applied at the layer that actually needed it. Every prior fix
on this PR (useAgentActivitySummary.ts’s hidden check,
useNextPromptSuggestion.ts’s lastTurnWasHidden) was frontend-only and
could only ever gate the frontend’s OWN two RPC call sites — neither
could reach activity_watcher.rs’s backend-only sweep, which has no
concept of “hidden” anywhere and fires independent of any turn boundary
whenever the output FileStore’s size changes.
The signature sentence is reason-independent by design — fresh_session
triggers (a persistent identity whose prior session could not be
resumed; SPEC_HIDDEN_MEMORY_REINJECTION_AFTER_COMPACTION_2026_09_22.md
§3.3a) use the same leading sentence as a real compaction, only the
second sentence differs (memory-reinjection.ts’s REASON_CLAUSE) — so
this one match suppresses both without needing to track which reason
fired.