Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Example 39c_serverless_code_execution.py needs to be changed for it to work

未关闭 适合新手
#512 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@nthmost-orkes 已经在做这个了。

开始于 2026年9月24日。

  • #513 来自 @nthmost-orkes —— 未关闭

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
90/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
cli, tooling

调研方向

问题位于文件 Example 39c_serverless_code_execution.py 中。修复方法是将行 mock_server = _start_mock_server(port=9753) 移动到 if __name__ == "__main__": 代码块内,以防止模块被重新导入时发生端口冲突。进行更改后,运行脚本以验证其启动时没有 'Address already in use' 错误,并且成功执行代理代码。

由索引模型根据 Issue 内容生成。

描述

currently we have start_mock_server not inside main. Moving it to main works

── Agent setup ───────────────────────────────────────────────────────

mock_server = _start_mock_server(port=9753)

serverless_coder = Agent(
name="serverless_coder",
model=settings.llm_model,
code_execution=CodeExecutionConfig(
executor=ServerlessCodeExecutor(
endpoint="http://127.0.0.1:9753/execute",
language="python",
timeout=15,
),
),
instructions=(
"You write Python code that runs on a remote execution service. "
"Use the execute_code tool to run code remotely."
),
)

if name == "main":
### #mock_server = _start_mock_server(port=9753). -> ADD THIS
with AgentRuntime() as runtime:
print("--- Serverless Code Execution ---")
result = runtime.run(
serverless_coder,
"Calculate 2**100 and print the result.",
)
result.print_result()

This was a claude code suggested fix and it works.
Claude's reasoning:
Before: mock_server = _start_mock_server(9753) was outside. You start the script — port 9753 grabbed. Worker starts, re-imports the file, hits that same line, tries to grab 9753 again. Already taken → Address already in use → worker dies.

After: it's inside the if. You start the script — port grabbed once. Worker re-imports, reaches the if, sees it's false, skips it. No second bind. Worker lives.

主要语言
Python
星标
104
派生
44
平均合并
4 天 18 小时
30 天内合并 PR
3

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

conductor-oss/python-sdk 的其他 Issue

查看 conductor-oss/python-sdk 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。