Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Extract flush_all teardown helpers into agent_server.teardown#1916

Open
Shi-Dong wants to merge 1 commit into
shi/refactor-agent-server-13-trial-runner from
shi/refactor-agent-server-14-teardown
Open

Extract flush_all teardown helpers into agent_server.teardown #1916
Shi-Dong wants to merge 1 commit into
shi/refactor-agent-server-13-trial-runner from
shi/refactor-agent-server-14-teardown

Conversation

@Shi-Dong

@Shi-Dong Shi-Dong commented Jun 13, 2026
edited by devin-ai-integration Bot
Loading

Copy link
Copy Markdown
Collaborator

What

Continues slimming the repo-root miles_agent_server.py toward a thin FastAPI entrypoint. Now that the mutable state (inflight_tasks, trial_projects) lives on the ServerState singleton, the two /flush_all teardown helpers no longer reach into miles globals and can move cleanly.

New agent_server/teardown.py holds:

  • _cancel_all_inflight — cancels every in-flight /run task (reads _state.inflight_tasks)
  • _kill_trial_containers — tears down the compose projects this server created (reads _state.trial_projects, calls docker_ops._list_compose_projects / _run_docker)

miles_agent_server.py re-imports both (the /flush_all route still calls them) and drops the now-orphaned _list_compose_projects / _run_docker imports. _prune_docker stays (still used directly by the /flush_all handler).

Tests

  • Added from agent_server import teardown to test_miles_agent_server_flush_all.py.
  • TestKillTrialContainers patches the helper's internal _list_compose_projects / _run_docker calls → repointed to teardown.* (patch-where-used: the moved function resolves those in its own namespace).
  • TestListComposeProjects invokes the helper directly → repointed to docker_ops._list_compose_projects() (no longer re-imported into miles).
  • /flush_all endpoint tests patch module._cancel_all_inflight / module._kill_trial_containers — unchanged (the route resolves them via the re-import).

Full tests/unit suite: 2854 passed, 1 skipped. ruff check + ruff format --check clean on the changed files.

Stacked

Targets shi/refactor-agent-server-13-trial-runner (#1914). Part of the miles_agent_server.pyagent_server/ decomposition chain.


Open in Devin Review

vercel Bot commented Jun 13, 2026
edited
Loading

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
harbor-docs Ready Ready Preview, Comment Jun 13, 2026 4:52pm

Request Review

Copy link
Copy Markdown
Contributor

Enjoy a better diff viewing experience by clicking one of these URLs:

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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

Reviewers

@devin-ai-integration devin-ai-integration[bot] devin-ai-integration[bot] left review comments

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /