Skip to content

fix: preserve MCP cleanup retries and accurate runtime discovery - #185

Merged
anycodes merged 4 commits into
mainfrom
fix/mcp-cleanup-retry-20261125
Nov 25, 2026
Merged

anycodes merged 4 commits into
mainfrom
fix/mcp-cleanup-retry-20261125

Conversation

@anycodes

@anycodes anycodes commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

Failed MCP cleanup previously discarded sandbox handles and the HTTP session, allowing DELETE to report success without a retry path. This change retains failed cleanup, waits for admitted resource acquisition, returns503 for incomplete termination and409 for closing-session POST, and keeps actual provider connections usable after a failed delete. An acknowledged delete is not repeated merely to finish local cleanup.

Explicit MCP HTTP protocol versions are validated before session or tool mutation. Missing harness errors now direct authors to prepare a pinned CLI in the image. Python package inventory reads the current interpreter's installed metadata, including uv environments without pip.

Closes #181. Closes #182. Closes #183. Closes #184.
Companion CLI: Alibaba-Agent-Sandbox/agent-sandbox#280

Type of Change

  • Bug fix
  • Documentation
  • Tests

Changes

  • Retain exact owned, borrowed, retained-task and duplicate-connection handles until successful cleanup; share concurrent HTTP termination and preserve retry after caller cancellation.
  • Keep failed sessions within capacity and retry idle cleanup at the existing TTL. Origin/auth precede protocol checks.
  • Preserve the package inventory response and sanitize metadata failures instead of returning a misleading empty success.
  • Update both languages, changelog, engineering records and two portable real-component harnesses.

Testing

  • Isolated full client suite:2483passed,36skipped. Isolated full server suite before the final inventory addition:891passed,1skipped; inventory route tests7passed,20deselected.
  • Lint, typecheck, formatting, hygiene, paired build/distribution checks; document health106passed,1existingoptionalwarning,0failed.
  • Real local uvicorn/Unix-socket HTTP failure/retry and cancellation checks; real Sandbox-class provider-close regression.
  • Real Express MCP HTTP:8/8 assertions, one ownedbase sandbox, actual command, DELETE200, independent native absence; no fallback cleanup.
  • Fresh uv environment without pip: real Server SDK HTTP lists the installed SDK and dependency.

The original shared-host failures remain in the evidence (server6,client13); isolated follow-ups are recorded separately. Final CI checks the combined tree. No FC deployment, OpenSandbox cloud qualification or package publication is claimed. Recovery remains in the live MCP process, with provider TTL as the fallback after process loss.

Definition of Done

  • Observable regression tests added
  • Real components and cleanup recorded under .agents
  • English and Chinese documentation updated
  • CHANGELOG updated
  • Secret scan and repository health checks passed
  • Two rounds of independent implementation review completed
  • Exact-head remote CI completed: CI45593792026 and Docs45593792059 both succeeded at e4edd6f.

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

Labels

None yet

Projects

None yet

1 participant