Skip to content

fix: add missing re.DOTALL flag to DeepSeek V3 tool call parser#444

Merged
teknium1 merged 1 commit into
NousResearch:mainfrom
PercyDikec:fix/deepseek-v3-parser-dotall
Mar 6, 2026
Merged

fix: add missing re.DOTALL flag to DeepSeek V3 tool call parser#444
teknium1 merged 1 commit into
NousResearch:mainfrom
PercyDikec:fix/deepseek-v3-parser-dotall

Conversation

@PercyDikec

Copy link
Copy Markdown
Contributor

What does this PR do?

The DeepSeek V3 tool call parser regex was missing re.DOTALL, so .* couldn't match newlines in the function_arguments capture group. Since tool call JSON arguments are almost always multi-line, the parser silently failed on most real tool calls and returned raw text instead.

Every other parser in the codebase (hermes, mistral, glm45, glm47, qwen3_coder, kimi_k2, longcat) already uses re.DOTALL for their patterns.

Related Issue

Fixes #443

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Changes Made

  • environments/tool_call_parsers/deepseek_v3_parser.py: Added re.DOTALL flag to PATTERN regex compilation

How to Test

  1. Check every other parser file in environments/tool_call_parsers/ - all use re.DOTALL
  2. Without the flag, this regex only matches single-line JSON: {"query": "hello"}
  3. With the flag, multi-line JSON is matched correctly:
{
  "query": "hello",
  "limit": 5
}

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've tested on my platform: Ubuntu 24.04

Documentation & Housekeeping

  • N/A (one flag added, no docs/config/schema changes)

@teknium1 teknium1 merged commit 936fda3 into NousResearch:main Mar 6, 2026
1 check passed
teknium1 added a commit that referenced this pull request Mar 6, 2026
The V3.1 parser had the same issue — .*? without re.DOTALL fails to
match multi-line JSON arguments. Found during review of PR #444.
@teknium1

teknium1 commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Merged in commit 936fda3 🎉 Thanks @PercyDikec!

Also found the same bug in deepseek_v3_1_parser.py — its regex also used .*? without re.DOTALL, so multi-line JSON arguments would fail there too. Fixed in follow-up commit dc55f49.

angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…k V3 tool call parser

Authored by PercyDikec. Fixes NousResearch#443. Without re.DOTALL, the regex .*
doesn't match newlines, so multi-line JSON arguments (the normal case)
silently fail to parse. Every other parser in the codebase that matches
across lines already uses re.DOTALL.
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
The V3.1 parser had the same issue — .*? without re.DOTALL fails to
match multi-line JSON arguments. Found during review of PR NousResearch#444.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…k V3 tool call parser

Authored by PercyDikec. Fixes NousResearch#443. Without re.DOTALL, the regex .*
doesn't match newlines, so multi-line JSON arguments (the normal case)
silently fail to parse. Every other parser in the codebase that matches
across lines already uses re.DOTALL.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
The V3.1 parser had the same issue — .*? without re.DOTALL fails to
match multi-line JSON arguments. Found during review of PR NousResearch#444.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…k V3 tool call parser

Authored by PercyDikec. Fixes NousResearch#443. Without re.DOTALL, the regex .*
doesn't match newlines, so multi-line JSON arguments (the normal case)
silently fail to parse. Every other parser in the codebase that matches
across lines already uses re.DOTALL.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
The V3.1 parser had the same issue — .*? without re.DOTALL fails to
match multi-line JSON arguments. Found during review of PR NousResearch#444.
rafe-walker added a commit to rafe-walker/kora that referenced this pull request May 24, 2026
…lti-tenant cockpit chrome + wizard resume (#207)

Deliverable A — tenant-picker cockpit chrome:
  * /api/tenants/list BE endpoint (wraps list_cost_holder_tenants;
    always default-first, synthesizes default when registry is
    named-only)
  * useActiveTenant() hook with URL ?tenant= → localStorage →
    "default" resolution; cross-tab + in-tab event-driven re-render
  * TenantPicker dropdown in sidebar header chrome; renders nothing
    when <2 tenants observed (A.6 single-tenant degradation)
  * /api/cost-state extended with optional ?tenant_id= → per-tenant
    holder lookup; CostStatePage + DashboardPage CostCardBody read
    snap.cost_ladder_by_tenant[activeTenant] when non-default
  * Audit + promotion pages forward ?tenant_id= (Probe + Alert
    Investigations, Email Intent + Outbound + Autofix logs, Kora
    Actions, PromotionReviewPage); BE-side filter lands with CC#1
    NousResearch#444 — FE wires the param + graceful fallback today
  * Drift-guard pins: TENANT_ID_QUERY_PARAM_NAME (BE) ↔
    TENANT_ID_QUERY_PARAM (FE) cross-stack test in
    tests/test_tenants_endpoint.py + storage-key + default-id pins

Deliverable B — wizard sessionStorage resume:
  * sessionStorage["kora_wizard_state"] persists step + non-cred
    config on every change
  * On mount past step 0, render Resume? prompt (yes restores +
    jumps to saved step; no clears + fresh start)
  * Credentials NEVER stored (anthropicApiKey,
    substrateServiceRoleKey, slackBotToken stripped before
    persist); validation results also reset on resume so the
    operator re-validates re-entered creds
  * Cleared on wizard complete + skip (terminal states)

Note: PM bucket attributed cost_ladder consumption to
CostTelemetryPage; in HEAD the cost_ladder block is consumed by
DashboardPage CostCardBody + CostStatePage (CostTelemetryPage
reads per-route /api/cost_telemetry, not per-tenant cost_ladder).
A.4 applied to the actual cost_ladder consumers.

Co-authored-by: CC#2 Kora Web <kora-pm@stormhavenenterprises.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…k V3 tool call parser

Authored by PercyDikec. Fixes NousResearch#443. Without re.DOTALL, the regex .*
doesn't match newlines, so multi-line JSON arguments (the normal case)
silently fail to parse. Every other parser in the codebase that matches
across lines already uses re.DOTALL.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
The V3.1 parser had the same issue — .*? without re.DOTALL fails to
match multi-line JSON arguments. Found during review of PR NousResearch#444.
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.

[Bug]: DeepSeek V3 tool call parser silently drops multi-line JSON arguments

2 participants