Skip to content

fix(agentfield): add test for issue #624 - #834

Draft
Salomondiei08 wants to merge 1 commit into
Agent-Field:mainfrom
Salomondiei08:fix/624-python-sdk-unexpected-interna
Draft

fix(agentfield): add test for issue #624#834
Salomondiei08 wants to merge 1 commit into
Agent-Field:mainfrom
Salomondiei08:fix/624-python-sdk-unexpected-interna

Conversation

@Salomondiei08

Copy link
Copy Markdown

What

Adds test coverage for the behavior described in issue #624.

Why

Fixes #624

Testing

  • New test added

Copilot AI review requested due to automatic review settings July 29, 2026 00:36
Ref: Agent-Field#624
Signed-off-by: Jay <sallomondiei@gmail.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Jay seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to add regression coverage in the Python SDK for issue #624 (“Unexpected internal endpoints probe on start”) by asserting that creating an Agent with an explicit Kubernetes callback_url does not trigger external IP/metadata probing during startup.

Changes:

  • Adds a new regression test that patches container detection and captures outbound requests.get calls during Agent initialization.
  • Asserts no HTTP requests are made when callback_url is explicitly provided.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_issue_624.py
Comment on lines +9 to +31
def test_issue_624(monkeypatch):
"""An explicit Kubernetes callback URL must avoid metadata and ipify probes."""
requests_made = []

class DummyResponse:
status_code = 404
text = ""

def fake_get(url, *args, **kwargs):
requests_made.append(url)
return DummyResponse()

monkeypatch.setattr(agent_mod, "_is_running_in_container", lambda: True)
monkeypatch.setattr(requests, "get", fake_get)

Agent(
node_id="issue-624-agent",
callback_url="http://issue-624-agent.default.svc.cluster.local:8001",
auto_register=False,
enable_did=False,
)

assert requests_made == []
Comment thread tests/test_issue_624.py
Comment on lines +1 to +6
"""Regression test for issue #624 — startup must not probe external IP services."""

import requests

from agentfield import Agent
from agentfield import agent as agent_mod
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.

[Python SDK] Unexpected internal endpoints probe on start

4 participants