-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
ai-triage-respondedIndicate whether the AI triage agent has responded to this issue.Indicate whether the AI triage agent has responded to this issue.bugSomething isn't workingSomething isn't workingfixed in next version (main)A fix has been implemented and will appear in an upcoming versionA fix has been implemented and will appear in an upcoming version
Description
I was using GPT 5.3 Codex and it keeps screwing up the pylanceRunCodeSnippet tool because it provides the
timeout option, I think the tool needs a better prompt.
Current prompt:
Description:
Execute Python code snippets directly in the workspace environment. PREFERRED over terminal commands for running Python code. This tool automatically uses the correct Python interpreter configured for the workspace, eliminates shell escaping/quoting problems that plague terminal execution, and provides clean, properly formatted output with stdout/stderr correctly interleaved. Use this instead of python -c "code" or terminal commands when running Python snippets. Ideal for: testing code, running quick scripts, validating Python expressions, checking imports, and any Python execution within the workspace context. No temporary files needed - code runs directly in memory.
Parameters:
workspaceRoot (string): The root directory uri of the workspace.
codeSnippet (string): The code snippet to run.
workingDirectory (string, optional): The working directory to use for the code snippet. If the code snippet is pulled from a file, this should be the directory for the file. Especially if the snippet has imports.
timeout (number, optional): The timeout for the code snippet execution. minimum: 0.0
Note the prompt just says timeout is number, which causes problems.
Environment data
- Pylance version: 1.16.0
- OS and version: Linux (Ubuntu 24.04)
- Python version (CPython 3.12 UV)
Code Snippet
print("hello")Repro Steps
- Use the Pylance MCP server
pylanceRunCodeSnippetmethod with:workspaceRoot:/home/jehan/ml_experiments/codeSnippet:print("hello")timeout:10
- Observe the request is cancelled.
- Run the same request again with no
timeoutfield (or withtimeout=30000). - Observe it succeeds.
Expected behavior
- Timeout units for
pylanceRunCodeSnippetshould be clearly documented. - It should be explicit that timeout is in milliseconds.
- It should be explicit that
timeout=0means immediate cancel, not “no timeout”. - Ideally, cancellation/error text should hint when timeout is likely too small.
Actual behavior
- With small timeout values like
10, request returnsrequest cancelled. - With
timeout=0, request is cancelled immediately. - With no timeout (or large values like
30000), same snippet succeeds. - Current behavior is easy to misinterpret as flaky execution unless timeout semantics are already known.
Logs
request cancelled
Reactions are currently unavailable
Metadata
Metadata
Labels
ai-triage-respondedIndicate whether the AI triage agent has responded to this issue.Indicate whether the AI triage agent has responded to this issue.bugSomething isn't workingSomething isn't workingfixed in next version (main)A fix has been implemented and will appear in an upcoming versionA fix has been implemented and will appear in an upcoming version