Repository navigation
fix(cindy): recall with the end of a long prompt - #2780
Merged
Merged
Conversation
Cindy's will-user-message hook skipped recall for any prompt over 8,192 UTF-16 units, so pasted logs followed by a question got no context. Send the shared recall-query bound (tests/fixtures/recall_query_bound.json) through DSH's existing boundedRecallQuery export, as the other automatic recall hosts do: trim, keep the longest trailing text within 8,192 characters and 8,192 UTF-8 bytes without splitting a character, trim. Part of oceanbase#2250.
Fengzdadi
requested review from
PsiACE,
yihong0618 and
zhanghuidinah
as code owners
November 22, 2026 23:18
16 of 17 tasks
PsiACE
approved these changes
Nov 23, 2026
hidb4ai
approved these changes
Nov 25, 2026
hidb4ai
left a comment
Contributor
There was a problem hiding this comment.
Reviewed a7d850b. No blocking findings. Reusing the existing bounded recall query fixes skipped recall for long prompts and enforces the shared UTF-8 bound while preserving original-prompt capture and the existing privacy checks. No new database tables or interfaces. The Cindy tests pass locally; CI also verifies the rebuilt bundle and the pinned Cindy source chain. Merge score: 90/100.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue or RFC does this PR close?
Part of #2250.
Rationale for this change
Cindy's
will-user-messagehook skipped recall for any prompt longer than 8,192 UTF-16 units, so a common turn such as pasted logs followed by a question got no context at all. The other hosts that recall automatically (DSH, OpenCode, Pi, Bub, Hermes, LangChain, LangGraph, Pydantic AI, and the hook-based hosts) bound a long prompt with the shared rule intests/fixtures/recall_query_bound.jsonand recall with its end. OpenClaw moves to the rule in #2779. Cindy landed in #1564 a day before #2252 moved hosts to that rule, and was never switched.What changes are included in this PR?
integrations/cindy/src/worker.ts: the hook sendsquery: boundedRecallQuery(input.text), reusing DSH's existingboundedRecallQueryexport fromprepared-context.ts, which the worker already importsvalidatePreparedContextfrom. Thequery_too_longoutcome is removed. It appeared in no docs, tests or UI. The sensitive-content skip, the capture limits (source_too_long), the prepared-context marker check and the hook timing are unchanged. Capture still stores the original prompt, not the recall query.integrations/cindy/plugins/powercontext-hooks/node/worker.cjs: rebuilt with the Cindy tsdown config. The diff is the bundledboundedRecallQueryand the changed call.integrations/cindy/tests/hooks.test.cjs: two tests. One drives the hook with about 20,000 characters of pasted log lines followed by a question and asserts that recall is ready and that the prepare query ends with the question and fits 8,192 characters and 8,192 UTF-8 bytes. The other runs every case intests/fixtures/recall_query_bound.jsonthroughrunHookand asserts the query sent to/v1/context/prepare.docs/en/docs/integrations/cindy.mdanddocs/zh/docs/integrations/cindy.mdstate how a prompt over the bounds is recalled. The comparison table inintegrations/cindy/README.mdlists the shared recall-query bound.No CI path change is needed.
tests/fixtures/**already selects every suite.Are there any user-facing changes?
Yes. In Cindy, a prompt longer than 8,192 characters or 8,192 UTF-8 bytes now recalls with its end. Before this change, a prompt longer than 8,192 UTF-16 units got no recall, and a shorter prompt over 8,192 UTF-8 bytes was sent whole. For prompts within the bounds, the recall query is now trimmed of surrounding whitespace, matching the shared rule. Capture behavior is unchanged. There are no API or persisted-format changes.
How was this change tested?
node --test integrations/cindy/tests/hooks.test.cjsbefore the source change: 24 tests, 22 passed, 2 failed. Both failures were the new tests: the long-prompt test gotprepare: 'query_too_long'instead of'ready', and the fixture test got no prepare request.make cindy-test, run one by one:tsdown --config ../../../cindy/tsdown.config.tsfromintegrations/dsh/plugins/powercontext: build complete.git diff --exit-code -- integrations/cindy/plugins/powercontext-hooks/node/worker.cjsafter the commit: clean, so the committed bundle is fresh.node --test integrations/cindy/tests/*.test.cjs: 26 tests, 26 passed, 0 failed.uv run python integrations/cindy/scripts/package.py: wrotedist/powercontext-cindy-hooks-0.1.0.cindy.prek run --files <the six changed files>: all hooks applicable to those files passed, includingty check.make cindy-testwas not run as a single target. Its dependency install could not complete offline, sotsdownwas run directly from the same directory with the same config, against DSH dependencies installed from the samepnpm-lock.yaml. The real-Cindy chain tests (tests/e2e/test_cindy_hooks_chain.py,tests/e2e/test_cindy_mcp_chain.py) need a Cindy source checkout and were not run locally. CI runs them incindy-package.AI usage statement
Claude Code (Claude Opus 5.5) wrote the source change, the tests and the doc updates, rebuilt the bundle, ran the commands above, and drafted this description. A second Claude Code session reviewed the change, rebuilt the bundle in a clean checkout and found it identical to the committed one, reran the Cindy tests (26 passed) and the packaging step, and confirmed that both new tests fail against the previous bundle.