GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Timeout then tool errors with Devstral-Medium · Issue #2865 · anomalyco/opencode

Timeout then tool errors with Devstral-Medium #2865

New issue
Copy link
New issue
Copy link
Closed
#2440
Closed
Timeout then tool errors with Devstral-Medium#2865
#2440
Copy link
Assignees
rekram1-node

Description

@agileandy
agileandy
opened on Sep 30, 2025
Issue body actions

Keep getting an ongoing error using Devstral-Medium.

Here is the relevent snipper of the conversation.

Read src/phase3_vulnerability_assessment.py

"""
Phase 3: Vulnerability Assessment and PR Simulation
Analyzes scan results and generates simulated pull request remediation proposals
"""

import logging

Now I understand how the simulated PRs are generated. The issue is that the current implementation is using generic fixes that just add comments instead of actual code fixes. Let
me modify the generate_fix_for_vulnerability method to use the fix templates properly.

Let me check the current fix templates to understand what we have available:
Build devstral-medium-2507 (07:54 AM)

Read src/phase3_vulnerability_assessment.py (limit=100, offset=40)

        self.fix_templates = {
            "insecure_random_python": {
                "patterns": [r"random\.random\(\)", r"random\.randint\(", r"random\.choice\("],
                "fixes": {
                    r"random\.random\(\)": "secrets.token_hex(16)",
                    r"random\.randint\(([^)]+)\)": r"secrets.randbelow(\1)",

Now let me check the generate_fix_for_vulnerability method to understand how it's currently working:
Build devstral-medium-2507 (07:54 AM)

Read src/phase3_vulnerability_assessment.py (limit=240, offset=180)

            elif "command" in vulnerability_type:
                return "command_injection"
            else:
                return "generic_vulnerability"

    def generate_fix_for_vulnerability(self, scan_result: Dict, vuln_type: str) -> Optional[Tuple[str, List[str], str, str]]:

I can see the issue now. The problem is in the generate_fix_for_vulnerability method. It's trying to use the fix templates, but it's only applying the first matching pattern and
then breaking the loop. Also, the generic fixes are just adding comments instead of actual fixes.

Let me modify the code to properly apply all the fix patterns and ensure we're using the actual code fixes from the templates.
Build devstral-medium-2507 (07:55 AM)

Edit src/phase3_vulnerability_assessment.py

 209   fix_template = self.fix_templates[template_key]                                      209   fix_template = self.fix_templates[template_key]
 210                                                                                        210
 211   # Apply fix patterns                                                                 211   # Apply fix patterns
 212   fixed_code = code_snippet                                                            212   fixed_code = code_snippet
                                                                                            213 + pattern_matched = False
 213   for pattern, replacement in fix_template["fixes"].items():                           214   for pattern, replacement in fix_template["fixes"].items():
 214       if re.search(pattern, code_snippet):                                             215       if re.search(pattern, code_snippet):
 215           fixed_code = re.sub(pattern, replacement, code_snippet)                      216           fixed_code = re.sub(pattern, replacement, code_snippet)
 216 -         break                                                                        217 +         pattern_matched = True
                                                                                            218 +         break  # Apply only the first matching pattern
 217                                                                                        219
 218 - if fixed_code == code_snippet:                                                       220 + if not pattern_matched:
 219       # No pattern matched, try generic replacement                                    221       # No pattern matched, try generic replacement
 220       return self.generate_generic_fix(code_snippet, vuln_type)                        222       return self.generate_generic_fix(code_snippet, vuln_type)
 221                                                                                        223

edit
Build devstral-medium-2507 (07:59 AM)

TimeoutError: The operation timed out.

the change got a timeout - try again

AI_APICallError: Unexpected role 'user' after role 'tool'

This is occurring every time Opencode tries to make a code edit using Devstral.

Reacted by Baptiste Gaillard and Renato Lochetti

Activity

  1. github-actions commented on Sep 30, 2025

    @github-actions
    github-actionsBot
    on Sep 30, 2025 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • Persistent tool call errors with Deepseek v3 and Devstral #526: Persistent tool call errors with Deepseek v3 and Devstral - reports similar tool errors specifically with Devstral model
    • AI_APICallError: tool_use blocks found without corresponding tool_result blocks #2720: AI_APICallError about tool_use blocks found without corresponding tool_result blocks - describes the exact same "AI_APICallError" and tool role sequence issues you're experiencing

    The "AI_APICallError: Unexpected role 'user' after role 'tool'" error you're seeing appears to be related to the same underlying tool calling and message formatting issues reported in these other tickets.

    Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Sep 30, 2025

    @rekram1-node
    rekram1-node
    on Sep 30, 2025
    Member
    More actions

    @agileandy if it is timing out frequently are you running it locally? Have you tried increasing timeout? If u share your opencode.json I can show u how

  3. rekram1-node
    self-assigned this
    on Sep 30, 2025
  4. agileandy commented on Oct 2, 2025

    @agileandy
    agileandy
    on Oct 2, 2025
    Author
    More actions

    I'm running this through the Mistral API. I'll try and find the timeout settings and play around.

  5. rekram1-node commented on Oct 2, 2025

    @rekram1-node
    rekram1-node
    on Oct 2, 2025
    Member
    More actions

    @agileandy this is how you can override timeout (it is in ms):

    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "mistral": {
          "options": {
            "timeout": 600000 // 10 minutes
          }
        }
      }
    }
    
  6. ErwanLegrand commented on Nov 2, 2025

    @ErwanLegrand
    ErwanLegrand
    on Nov 2, 2025
    More actions

    This should be fixed by #2440 .

  7. rekram1-node
    closed this as completedin #2440on Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.