Skip to content

fix(agent): continue after Chinese local-file ack before tool calls - #26913

Open
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:leon/fix-26892-turn-not-finished
Open

fix(agent): continue after Chinese local-file ack before tool calls#26913
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:leon/fix-26892-turn-not-finished

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes premature turn completion when the model emits a Chinese "starting now" acknowledgement for a tool-required local file-writing task, but has not called any tool yet.
The agent now treats this as an intermediate acknowledgement and auto-continues so the next call can emit actual tool calls.

Related Issue

Fixes #26892

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Expanded AIAgent._looks_like_codex_intermediate_ack(...) in run_agent.py:
    • Added Chinese future-action acknowledgement detection.
    • Added persistent local-file intent markers (保存到本地, 写入文件, save to file, etc.).
    • Added write/save action markers to classify tool-required follow-up turns.
  • Added regression test test_run_conversation_codex_continues_after_chinese_ack_for_local_file_write in tests/run_agent/test_run_agent_codex_responses.py.

How to Test

  1. uv run --extra dev python -m pytest -q tests/run_agent/test_run_agent_codex_responses.py -k chinese_ack_for_local_file_write
  2. uv run --extra dev python -m pytest -q tests/run_agent/test_run_agent_codex_responses.py -k continues_after_ack
  3. python3 -m py_compile run_agent.py tests/run_agent/test_run_agent_codex_responses.py

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Ubuntu 22.04 (reported issue platform) and local macOS runner

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

N/A

Screenshots / Logs

  • Targeted regression checks:
    • 1 passed for -k chinese_ack_for_local_file_write
    • 2 passed for -k continues_after_ack

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint labels May 16, 2026
@cardtest15-coder

This comment was marked as spam.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused regression case. The underlying CJK failure is still present on current main: agent/agent_runtime_helpers.py:2690-2694 accepts only English future-ack phrases, and agent/conversation_loop.py:5103-5135 relies on that detector before issuing the continuation.

Problems

  • The patch targets an implementation that moved. run_agent.py:1554-1565 is now a forwarder; the active detector is agent/agent_runtime_helpers.py:2661-2759 and the loop is agent/conversation_loop.py:5103-5135 (extracted in 053025238).
  • The positive-only regression does not protect against broad CJK markers such as 开始 and continuing a conversational or final response. Current detector guardrails are documented in agent/agent_runtime_helpers.py:2670-2679.

Suggested changes

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform area/i18n Localization, locales, translations labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/i18n Localization, locales, translations comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 任务并没有结束,但是报告会话已经结束了

4 participants