Skip to content

Conversation

@igooch
Copy link

@igooch igooch commented Nov 11, 2025

This pull request addresses a bug in the sandbox_client.py that caused it to fail when using a SandboxWarmPool. The client made incorrect assumptions about the naming of Sandbox and Pod resources when they are sourced from a warm pool, leading to "not found" errors.

Specifically, this pull request introduces the change:

Correct Pod Name for Port-Forwarding: The client now correctly identifies the pod name for port-forwarding by checking for the agents.x-k8s.io/pod-name annotation on the Sandbox resource. If the annotation is present (indicating the pod is from a sandbox warm pool), it uses the specified pod name. Otherwise, it falls back to using the Sandbox name, preserving the existing behavior for on-demand sandboxes.

This change make the Python client fully compatible with SandboxWarmPools.

Other changes are for autopep8 formatting only.

Fixes #149

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 11, 2025
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 11, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@netlify
Copy link

netlify bot commented Nov 11, 2025

Deploy Preview for agent-sandbox canceled.

Name Link
🔨 Latest commit 3be3770
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/6913bde1f9a108000886e5ed

@k8s-ci-robot
Copy link
Contributor

Welcome @igooch!

It looks like this is your first PR to kubernetes-sigs/agent-sandbox 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/agent-sandbox has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 11, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @igooch. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Nov 11, 2025
@igooch igooch marked this pull request as ready for review November 11, 2025 21:31
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 11, 2025
Copy link

@aditya-shantanu aditya-shantanu left a comment

Choose a reason for hiding this comment

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

Add a test in this PR or have a fast follow up.
Do we have the framework set up to be able to test the python client ?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aditya-shantanu, igooch
Once this PR has been reviewed and has the lgtm label, please assign soltysh for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

if cond.get('type') == 'Ready' and cond.get('status') == 'True':
is_ready = True
break
if event["type"] in ["ADDED", "MODIFIED"]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary for the bug fix?

Copy link
Author

Choose a reason for hiding this comment

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

Not for this particular error. It does help with other possible errors as it filters for only the relevant events in the watch.

@janetkuo
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 11, 2025
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 11, 2025
@igooch
Copy link
Author

igooch commented Nov 11, 2025

Add a test in this PR or have a fast follow up. Do we have the framework set up to be able to test the python client ?

There is not currently a framework to test the python client. Also, as it stands the sandbox_client.py is quite specific to the agent-sandbox/examples/python-runtime-sandbox/main.py in that it assumes an /execute endpoint, assumes an exposed port, etc. That means this tests is dependent on having the python-runtime-sandbox image available to install into a sandboxtemplate and / or warmpool, and I don't believe this image has been publicly published yet.

So for an e2e test we'll either need to make this client more generic, or have a published version of the python-runtime-sandbox image available for the test to pull into the kind test cluster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python Client Fails with Warm Pools

5 participants