Skip to content

feat(memory): control rerank via env var, off by default - #84

Merged
Zhiyue-Wang merged 3 commits into
huaweicloud:mainfrom
neverland-lhy:feat/ts-mcp-disable-rerank
Oct 29, 2026
Merged

Zhiyue-Wang merged 3 commits into
huaweicloud:mainfrom
neverland-lhy:feat/ts-mcp-disable-rerank

Conversation

@neverland-lhy

Copy link
Copy Markdown
Contributor

Summary

The search API gained a rerank flag in SDK 0.1.9, enabled by default on the backend. The TS MCP server now sends it explicitly on every search: off by default, with an operator-only opt-in.

Design

  • AGENTARTS_MEMORY_RERANK env var (truthy: 1 / true) enables reranking; default is off.
  • The tool schema is unchanged — rerank is not a tool parameter, so the model cannot toggle it. Like user_id, it belongs to the deployment environment, not the caller.
  • The server always sends an explicit rerank value instead of relying on the backend default.
  • The startup log line now reports the rerank state, e.g. endpoint=..., rerank=false.

Testing

  • npm test — 9/9: default search body carries rerank: false; a server started with AGENTARTS_MEMORY_RERANK=1 sends rerank: true
  • Live verification against the data plane is pending — cn-southwest-2 was returning 500 (the database system is not yet accepting connections) while preparing this change. The field definition follows SDK 0.1.9 (MemorySearchFilter.rerank).

The search API gained a rerank flag in SDK 0.1.9, enabled by default
on the backend. The TS MCP server now always sends it explicitly:
off by default (deployment policy), with an operator-only opt-in via
AGENTARTS_MEMORY_RERANK. The tool schema is unchanged — the model
cannot toggle it. The startup log line reports the rerank state.
The constructor mixed a collaborator (api) with a policy flag (rerank).
rerank flows per-call through SearchOptions now, exactly like userId:
resolved from env in the tool layer, defaulted in the client. The
MemoryClient constructor is back to a single dependency.
@codecov-commenter

codecov-commenter commented Oct 29, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.89%. Comparing base (9d62fce) to head (c859b3e).
⚠️ Report is 22 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #84      +/-   ##
==========================================
+ Coverage   59.41%   59.89%   +0.47%     
==========================================
  Files         115      116       +1     
  Lines       10570    10646      +76     
  Branches     1695     1707      +12     
==========================================
+ Hits         6280     6376      +96     
+ Misses       3752     3707      -45     
- Partials      538      563      +25     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Self-review findings: the rerank default belonged inside the object
literal next to top_k/min_score (same value-with-default shape), and
the searchMemories docstring claimed all optional fields are omitted
when unset — rerank is the deliberate exception and now says so.
@Zhiyue-Wang
Zhiyue-Wang merged commit 528f394 into huaweicloud:main Oct 29, 2026
6 checks passed
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.

3 participants