Skip to content

fix(pipeline): ground local-agent system prompt with current date - #2399

Open
leonoxo wants to merge 1 commit into
langbot-app:masterfrom
leonoxo:fix/local-agent-date-grounding
Open

fix(pipeline): ground local-agent system prompt with current date#2399
leonoxo wants to merge 1 commit into
langbot-app:masterfrom
leonoxo:fix/local-agent-date-grounding

Conversation

@leonoxo

@leonoxo leonoxo commented Aug 4, 2026

Copy link
Copy Markdown

Summary

  • The local-agent runner's system prompt is a static string with no template-variable support, so the model has no anchor for "today" and resolves relative time references (e.g. "this quarter", "latest", "currently") against whichever period is best represented in its training data instead of the actual current date — this can produce confident, stale answers to time-sensitive questions (e.g. answering a "this quarter's revenue" question with year-old earnings data) instead of triggering a search tool.
  • PreProcessor now appends a short, deterministically-computed Current date: YYYY-MM-DD (Weekday) note (plus guidance to verify time-sensitive facts with a search tool rather than answering from memory) to the system prompt on every request for local-agent pipelines — this is independent of LLM tool-call judgment, unlike binding a "get current time" MCP/tool, which the model may or may not choose to call.
  • Refactored the existing skill-awareness prompt injection to share the same _append_to_system_prompt helper instead of duplicating the append-to-system-message logic.

Test plan

  • uv run pytest tests/unit_tests/pipeline/test_preproc.py -q — 13 passed (10 existing + 3 new covering: append to existing system message, create system message when none exists, skip for non-local-agent runners)
  • uv run pytest tests/unit_tests -q — 2664 passed, 1 skipped
  • uv run ruff check / ruff format --check on changed files

The local-agent runner's system prompt is a static string with no
template-variable support, so the model had no anchor for "today" and
resolved relative time references (e.g. "this quarter", "latest")
against whichever period was best represented in training data instead
of the real date, sometimes confidently answering with stale
information for time-sensitive questions.

PreProcessor now appends a short, deterministically-computed
"Current date: ..." note to the system prompt on every request for
local-agent pipelines, alongside guidance to verify time-sensitive
facts with a search tool rather than answering from memory. The
existing skill-awareness prompt injection is refactored to share the
same append-to-system-prompt helper.
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. m: Prompts 情景预设模块 / Prompts related labels Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. ✅ 所有贡献者均已签署 CLA。
Posted by the CLA Assistant Lite bot.

@leonoxo

leonoxo commented Aug 4, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

RockChinQ added a commit to langbot-app/cla that referenced this pull request Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

m: Prompts 情景预设模块 / Prompts related size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant