Skip to content

Conversation

@Michaelsqj
Copy link
Collaborator

@Michaelsqj Michaelsqj commented Jan 6, 2026

update terminal toolkit with shell_wait & shell_write_content_to_file toolkits

Description

Describe your changes in detail (optional if the linked issue already contains a detailed description of the changes).

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • I have read the CONTRIBUTION guide (required)
  • I have linked this PR to an issue using the Development section on the right sidebar or by adding Fixes #issue-number in the PR description (required)
  • I have checked if any dependencies need to be added or updated in pyproject.toml and uv lock
  • I have updated the tests accordingly (required for a bug fix or a new feature)
  • I have updated the documentation if needed:
  • I have added examples if this is a new feature

If you are unsure about any of these, don't hesitate to ask. We are here to help!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the Review Required PR need to be reviewed label Jan 6, 2026
@Michaelsqj Michaelsqj changed the title update terminal toolkit with shell_wait and shell_write_content_to_fi… update terminal toolkit with shell_wait & shell_write_content_to_file toolkits Jan 6, 2026
Copy link
Member

@Wendong-Fan Wendong-Fan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @Michaelsqj , left some comments below, also one enhance PR to review: #3669

"too frequently)"
)

def shell_wait(self, id: str, wait_seconds: float = 5.0) -> str:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is shell_wait necessary? The existing _collect_output_until_idle() method already provides similar functionality with better efficiency (uses condition variables instead of polling with time.sleep(0.2))

if self.use_docker_backend:
try:
# Write content to a temporary file on the host inside log_dir
temp_host_path = os.path.join(self.log_dir, f"temp_{uuid.uuid4().hex}.txt")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to import uuid

# Copy the temporary file into the Docker container
dest_path_in_container = file_path
result = subprocess.run([
'docker', 'cp', temp_host_path, f"{self.docker_container_name}:{dest_path_in_container}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.docker_container_name is never set

"""
if self.safe_mode and self.working_dir:
abs_file_path = os.path.abspath(file_path)
if not abs_file_path.startswith(self.working_dir):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using startswith() for path validation can be bypassed (e.g., /workspace/../etc/passwd), let's use os.path.commonpath() instead

@Wendong-Fan Wendong-Fan added Waiting for Update PR has been reviewed, need to be updated based on review comment and removed Review Required PR need to be reviewed labels Jan 7, 2026
@Wendong-Fan Wendong-Fan merged commit 0b4c1bf into master Jan 12, 2026
12 of 13 checks passed
@Wendong-Fan Wendong-Fan deleted the update/terminal_toolkit branch January 12, 2026 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Waiting for Update PR has been reviewed, need to be updated based on review comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants