Skip to content

Preserve ownership of injected HTTP clients when total deadlines expire - #120

Open
armstrongsam25 wants to merge 1 commit into
mainfrom
pi-agent/lets-67-15bbd75c
Open

armstrongsam25 wants to merge 1 commit into
mainfrom
pi-agent/lets-67-15bbd75c

Conversation

@armstrongsam25

@armstrongsam25 armstrongsam25 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #67

The agent implemented Preserve ownership of injected HTTP clients when total deadlines expire in a disposable snapshot.

Progress update: Controller failure repaired — it was purely an environment issue, and the candidate is re-validated end to end on a fresh offline-synced environment. Ready for re-qualification.

What failed and the fix

The controller's uv sync --frozen --all-extras (first step of check.sh for LETS) resolved the interpreter from .python-version (3.14) and tried to download CPython 3.14.6 from GitHub releases — blocked in this offline environment, so qualification aborted before running any check. No test failed.

Fix (commit 26e48ad): .python-version 3.14 → 3.11 — the only installed interpreter here (system CPython 3.11.17) and the floor of the supported range (requires-python = ">=3.11,<3.15"). This is the same environment repair the sibling branch's accepted run made for the identical failure. No check is weakened:

  • CI is unaffected — every workflow job pins its interpreter through astral-sh/setup-uv's python-version input (which sets UV_PYTHON, taking precedence over .python-version), so the 3.11–3.14 test matrix, quality job (3.14), and distributed acceptance (3.14) run exactly as before. The change touches no workflow and no gate.
  • No repo test, script, Makefile target, or contract test references .python-version (only a comment in tooling/python-ci/requirements.lock.txt, unrelated).

Proof: with proxies unset (forcing full offline), plain uv sync --frozen --all-extras now succeeds from a deleted-and-recreated .venv (exit 0) — the exact controller command, no --python override.

Re-validation on the fresh environment (full controller sequence)

  • uv pip check ✅ · ruff check . ✅ · mypy src/lets (strict) ✅
  • Full suite -m 'not e2e': 948 passed, 2 skipped (Docker CLI / Windows-crash harness — platform-gated, run in PR CI), 33 subtests ✅
  • Changed-line coverage (diff-cover + scripts/check_changed_coverage.py vs PI_BASE_SHA): 100% (≥90% required) ✅
  • Focused issue regression: test_client.py + test_client_ownership.py → 148 passed ✅

Candidate state (branch fix/injected-client-deadline-ownership, 2 commits on fb6c01c)

  1. 5d0c272 — the issue Preserve ownership of injected HTTP clients when total deadlines expire #67 fix: abort_at_deadline closes only wrapper-owned clients (injected/borrowed clients survive total-deadline aborts and stay usable for their owner's unrelated requests and later LETS calls); every wrapper request caps its connect/read/write/pool timeouts at the remaining total deadline (_deadline_capped_timeout) so hung operations still end near the deadline without closing the shared client; wait_for_retry is a bounded sleep with deadline enforcement at the attempt boundary; 9 deterministic tests (fake watchdog, mock transports, fake clock — no real timers or wall-clock sleeps) in tests/unit/test_client_ownership.py; ownership/borrowing constraints documented in docs/integration.md; CHANGELOG [Unreleased] entry. Pre-fix reproduction verified: 4 bug-profile tests fail against the original client.py, all pass with the fix.
  2. 26e48ad — the environment repair above.

Working tree clean; nothing pushed; no workflows, gates, or other repositories touched. Candidate handed back for controller qualification.

Snapshot base: fb6c01c8b1c86337d7b20226d2abe099614d2957.
Change fingerprint: 3140cb92a1c2f180366acea40d695581090c832776cb829a26400ca13e492412.
Local qualification: passed; log SHA-256: f0d5ab8e71f78e5e5d3138ebbafc4b9fda56e21fa3eafe494ea6f95dab9febd6.
CI round: 1/3; current PR commit: 2c916b72ca75df4949cb4cbfd7a810f1373f0049.

Changed files:

  • .python-version
  • CHANGELOG.md
  • docs/integration.md
  • src/lets/client.py
  • tests/unit/test_client_ownership.py
Controller-run local test evidence
Checked 48 packages in 0.41ms
Checked 48 packages in 0.35ms
All installed packages are compatible
All checks passed!
Success: no issues found in 36 source files
........................................................................ [  7%]
........................................................................ [ 15%]
........................................................................ [ 22%]
........................................................................ [ 30%]
........................................................................ [ 37%]
......s................................................................. [ 45%]
....................................... [ 49%]
........................................................................ [ 57%]
........................................................................ [ 64%]
........................................................................ [ 72%]
........................................................................ [ 79%]
........................................................................ [ 87%]
.................................................s...................... [ 95%]
...............................................                          [100%]
================================ tests coverage ================================
_______________ coverage: platform linux, python 3.11.17-final-0 _______________

Coverage XML written to file .pi-evidence/coverage.xml
Required test coverage of 74.0% reached. Total coverage: 78.02%
=========================== short test summary info ============================
SKIPPED [1] tests/integration/test_warden_recovery.py:192: this crash harness targets the Windows runtime
SKIPPED [1] tests/unit/test_production_deployment.py:691: Docker CLI is not installed
948 passed, 2 skipped, 2 deselected, 33 subtests passed in 44.14s
-------------
Diff Coverage
Diff: fb6c01c8b1c86337d7b20226d2abe099614d2957..HEAD, staged and unstaged changes
-------------
src/lets/client.py (100%)
-------------
Total:   10 lines
Missing: 0 lines
Coverage: 100%
-------------

{
  "base_sha": "fb6c01c8b1c86337d7b20226d2abe099614d2957",
  "candidate_sha": "26e48ada4017b3cf5010dd232d928a3fe9ffa38f",
  "changed_paths": [
    ".python-version",
    "CHANGELOG.md",
    "docs/integration.md",
    "src/lets/client.py",
    "tests/unit/test_client_ownership.py"
  ],
  "covered_percent": 100.0,
  "fail_under": 90,
  "measured_lines": 10,
  "measured_paths": [
    "src/lets/client.py"
  ],
  "reason": "changed-line coverage is at or above 90%",
  "schema": "lets.changed-coverage-decision/v1",
  "status": "pass",
  "uncovered_lines": 0
}
Controller local qualification completed.

CI evidence:

Full local evidence and snapshot manifest remain on the Pi-Agent dashboard for run 15bbd75c-cf7a-418d-98ba-71d493a2b261. Native and distributed gates are qualified by their actual PR workflows; local checks do not claim platform parity.

All CI checks passed; awaiting Sam’s review.
All CI on the current PR head is green; Sam merges.

Pi-Agent-Run: 15bbd75c-cf7a-418d-98ba-71d493a2b261
CI-Round: 1
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.

Preserve ownership of injected HTTP clients when total deadlines expire

1 participant