Release v3.3 (copy of misc-org/collaborative-intelligence-harbor)
Browse files- README.md +16 -1
- adapter/README.md +5 -2
- adapter/adapter-release.json +3 -3
- adapter/src/collab_harbor/generate.py +4 -1
- adapter/src/collab_harbor/google_compat.py +120 -10
- adapter/src/collab_harbor/sweep.py +13 -4
- inventory.json +0 -0
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/environment/Dockerfile +1 -0
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/environment/agent/Dockerfile +1 -0
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/environment/model-compat/compatibility.json +1 -1
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/environment/model-compat/google_compat.py +120 -10
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/environment/team/runtime.json +4 -4
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/environment/team/runtime.tar.gz +2 -2
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/environment/team/task.json +18 -18
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/tests/runtime.json +4 -4
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/tests/runtime.tar.gz +2 -2
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/environment/Dockerfile +1 -0
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/environment/agent/Dockerfile +1 -0
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/environment/model-compat/compatibility.json +1 -1
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/environment/model-compat/google_compat.py +120 -10
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/environment/team/runtime.json +4 -4
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/environment/team/runtime.tar.gz +2 -2
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/environment/team/task.json +18 -18
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/tests/runtime.json +4 -4
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/tests/runtime.tar.gz +2 -2
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/environment/Dockerfile +1 -0
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/environment/agent/Dockerfile +1 -0
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/environment/model-compat/compatibility.json +1 -1
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/environment/model-compat/google_compat.py +120 -10
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/environment/team/runtime.json +4 -4
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/environment/team/runtime.tar.gz +2 -2
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/environment/team/task.json +18 -18
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/tests/runtime.json +4 -4
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/tests/runtime.tar.gz +2 -2
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/environment/Dockerfile +1 -0
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/environment/agent/Dockerfile +1 -0
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/environment/model-compat/compatibility.json +1 -1
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/environment/model-compat/google_compat.py +120 -10
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/environment/team/runtime.json +4 -4
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/environment/team/runtime.tar.gz +2 -2
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/environment/team/task.json +18 -18
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/tests/runtime.json +4 -4
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/tests/runtime.tar.gz +2 -2
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s2/environment/Dockerfile +1 -0
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s2/environment/agent/Dockerfile +1 -0
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s2/environment/model-compat/compatibility.json +1 -1
- tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s2/environment/model-compat/google_compat.py +120 -10
README.md
CHANGED
|
@@ -8,7 +8,7 @@ language: [en]
|
|
| 8 |
size_categories: [n<1K]
|
| 9 |
---
|
| 10 |
|
| 11 |
-
# Collaborative Intelligence on Pi and Harbor (release v3.
|
| 12 |
|
| 13 |
Harbor tasks for four dimensions of Stanford's Collaborative Intelligence benchmark
|
| 14 |
(arXiv 2611.02633, source pinned at `f704b963`), run by a Pi agent launched with Flock.
|
|
@@ -26,6 +26,21 @@ and a fresh verifier re-runs Stanford's checker.
|
|
| 26 |
A scenario's test runs count only if the model passed it alone (solo gate); the score is
|
| 27 |
the mean over three test seeds, aggregated with Stanford's own code.
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
## What changed in v3
|
| 30 |
|
| 31 |
- **No internet for the agent.** During the agent phase `main` can reach only `team` and
|
|
|
|
| 8 |
size_categories: [n<1K]
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# Collaborative Intelligence on Pi and Harbor (release v3.3)
|
| 12 |
|
| 13 |
Harbor tasks for four dimensions of Stanford's Collaborative Intelligence benchmark
|
| 14 |
(arXiv 2611.02633, source pinned at `f704b963`), run by a Pi agent launched with Flock.
|
|
|
|
| 26 |
A scenario's test runs count only if the model passed it alone (solo gate); the score is
|
| 27 |
the mean over three test seeds, aggregated with Stanford's own code.
|
| 28 |
|
| 29 |
+
## What changed in v3.3
|
| 30 |
+
|
| 31 |
+
- **Slow model replies are no longer cut at 15 s.** Harbor's agent egress guard (a gost proxy)
|
| 32 |
+
waits at most 15 s for a response's headers. In v3.1/v3.2 any model call that took longer to
|
| 33 |
+
start answering failed with "Connection error" and Pi retried it, so slow replies were
|
| 34 |
+
replaced by new samples. `model-compat` now answers a slow streamed request at once and sends
|
| 35 |
+
SSE keepalive comments until the provider responds; the provider's stream is relayed
|
| 36 |
+
unchanged, and a late provider error arrives as the API's stream error event. If the caller
|
| 37 |
+
disconnects, the provider request is closed.
|
| 38 |
+
- **The agent's shell commands default to a 120 s limit** when the model sets none
|
| 39 |
+
(`CI_PI_BASH_TIMEOUT_SEC=120`, the same default as Claude Code). In v3.2 four runs hung for
|
| 40 |
+
an hour on a `grep -r /` the model started; no finished run had a command above 74 s. The
|
| 41 |
+
model gets "Command timed out after 120 seconds" and continues.
|
| 42 |
+
- Scores from v3.1/v3.2 are affected by the 15 s cut and are provisional.
|
| 43 |
+
|
| 44 |
## What changed in v3
|
| 45 |
|
| 46 |
- **No internet for the agent.** During the agent phase `main` can reach only `team` and
|
adapter/README.md
CHANGED
|
@@ -111,8 +111,11 @@ nftables rules inside the run, which needs the host kernel modules `nft_fib_inet
|
|
| 111 |
`nft_redir` and `nft_chain_nat` to be loaded. Rootless Podman cannot load them; on a
|
| 112 |
node where they are not loaded, Harbor refuses to start the agent ("cannot change
|
| 113 |
network policy after start"), so runs fail closed and are held, never scored. Check
|
| 114 |
-
`grep -E "^(nft_fib_inet|nft_redir|nft_chain_nat) " /proc/modules` before launching
|
| 115 |
-
|
|
|
|
|
|
|
|
|
|
| 116 |
loads them automatically. Private Hub tasks also need `git-lfs` (runtime archives are
|
| 117 |
LFS files) and git credentials for huggingface.co (e.g. `GIT_ASKPASS`), because Harbor
|
| 118 |
fetches tasks with `git`.
|
|
|
|
| 111 |
`nft_redir` and `nft_chain_nat` to be loaded. Rootless Podman cannot load them; on a
|
| 112 |
node where they are not loaded, Harbor refuses to start the agent ("cannot change
|
| 113 |
network policy after start"), so runs fail closed and are held, never scored. Check
|
| 114 |
+
`grep -E "^(nft_fib_inet|nft_redir|nft_chain_nat) " /proc/modules` before launching. No root is
|
| 115 |
+
needed to fix it: creating one such rule in a throwaway rootless namespace makes the kernel
|
| 116 |
+
autoload them, e.g. `printf 'table inet w { chain o { type nat hook output priority -100; fib daddr
|
| 117 |
+
type local tcp dport 1 redirect to :12345; } }' | unshare -rn nft -f -` (`scripts/podman-env.sh`
|
| 118 |
+
does this). Docker with root
|
| 119 |
loads them automatically. Private Hub tasks also need `git-lfs` (runtime archives are
|
| 120 |
LFS files) and git credentials for huggingface.co (e.g. `GIT_ASKPASS`), because Harbor
|
| 121 |
fetches tasks with `git`.
|
adapter/adapter-release.json
CHANGED
|
@@ -15,8 +15,8 @@
|
|
| 15 |
"src/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 16 |
"src/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 17 |
"src/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 18 |
-
"src/collab_harbor/generate.py": "
|
| 19 |
-
"src/collab_harbor/google_compat.py": "
|
| 20 |
"src/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 21 |
"src/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 22 |
"src/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -35,7 +35,7 @@
|
|
| 35 |
"src/collab_harbor/runtime-files.json": "10c24f661a853a048205464d2be2f50527f59495dbdef26fd85b885291d238d1",
|
| 36 |
"src/collab_harbor/runtime-requirements.lock": "dee41783bcc20ef627c1f64df7e1320de9765e67df948079697d206962628fa2",
|
| 37 |
"src/collab_harbor/scoring.py": "546eb7a81656b6c4b8f6271e1a9260d13a348233daeb4006c3ee918876fffc3d",
|
| 38 |
-
"src/collab_harbor/sweep.py": "
|
| 39 |
"src/collab_harbor/service.py": "4f041675c8e48258054cf810de93bb5302732c2d78fe0de3c9937d1e4e494e67",
|
| 40 |
"src/collab_harbor/sources.py": "eb24a9c8271ce298bcd583ecc2bdf54c96df94fea7450d537c208754a5082315",
|
| 41 |
"src/collab_harbor/stock_execution.py": "8e691e15d4e974be01c583f81618d2775fcecec0570985744c26e04a2789953e",
|
|
|
|
| 15 |
"src/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 16 |
"src/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 17 |
"src/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 18 |
+
"src/collab_harbor/generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 19 |
+
"src/collab_harbor/google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 20 |
"src/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 21 |
"src/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 22 |
"src/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 35 |
"src/collab_harbor/runtime-files.json": "10c24f661a853a048205464d2be2f50527f59495dbdef26fd85b885291d238d1",
|
| 36 |
"src/collab_harbor/runtime-requirements.lock": "dee41783bcc20ef627c1f64df7e1320de9765e67df948079697d206962628fa2",
|
| 37 |
"src/collab_harbor/scoring.py": "546eb7a81656b6c4b8f6271e1a9260d13a348233daeb4006c3ee918876fffc3d",
|
| 38 |
+
"src/collab_harbor/sweep.py": "51e4847b896f73f95a6839b5839e60d5a550bb1a7da2f44961706e1f7eef670b",
|
| 39 |
"src/collab_harbor/service.py": "4f041675c8e48258054cf810de93bb5302732c2d78fe0de3c9937d1e4e494e67",
|
| 40 |
"src/collab_harbor/sources.py": "eb24a9c8271ce298bcd583ecc2bdf54c96df94fea7450d537c208754a5082315",
|
| 41 |
"src/collab_harbor/stock_execution.py": "8e691e15d4e974be01c583f81618d2775fcecec0570985744c26e04a2789953e",
|
adapter/src/collab_harbor/generate.py
CHANGED
|
@@ -22,6 +22,9 @@ from .vendor import PINNED_REVISION, copy_upstream
|
|
| 22 |
|
| 23 |
DIMENSION = "sharing_and_seeking_information"
|
| 24 |
PROTOCOL = "ci-harbor-v1"
|
|
|
|
|
|
|
|
|
|
| 25 |
BASE_IMAGE = "python:3.13-slim-bookworm@sha256:281d39ff02e3b389401586134ff9e6572954687822a58055ec07a60ded4e0b7f"
|
| 26 |
RUNTIME_REQUIREMENTS = Path(__file__).with_name("runtime-requirements.lock").read_text()
|
| 27 |
RUNTIME_LOCK_SHA256 = hashlib.sha256(RUNTIME_REQUIREMENTS.encode()).hexdigest()
|
|
@@ -31,7 +34,7 @@ COPY collab_harbor /app/collab_harbor
|
|
| 31 |
COPY team /usr/local/bin/team
|
| 32 |
COPY collab_harbor/pi-google.js /tmp/harbor-pi-agent/extensions/collab-google.js
|
| 33 |
{docker_capture_lines()}
|
| 34 |
-
{docker_bash_timeout_lines()}
|
| 35 |
RUN chmod 755 /usr/local/bin/team
|
| 36 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
| 37 |
WORKDIR /workspace
|
|
|
|
| 22 |
|
| 23 |
DIMENSION = "sharing_and_seeking_information"
|
| 24 |
PROTOCOL = "ci-harbor-v1"
|
| 25 |
+
# v3.3: Pi bash calls that set no timeout get 120 s (Claude Code's default). Measured on the v3.2
|
| 26 |
+
# sweep: no finished run had a command above 74 s; the only longer ones were hung full-disk greps.
|
| 27 |
+
LOCAL_BASH_TIMEOUT_SEC = 120
|
| 28 |
BASE_IMAGE = "python:3.13-slim-bookworm@sha256:281d39ff02e3b389401586134ff9e6572954687822a58055ec07a60ded4e0b7f"
|
| 29 |
RUNTIME_REQUIREMENTS = Path(__file__).with_name("runtime-requirements.lock").read_text()
|
| 30 |
RUNTIME_LOCK_SHA256 = hashlib.sha256(RUNTIME_REQUIREMENTS.encode()).hexdigest()
|
|
|
|
| 34 |
COPY team /usr/local/bin/team
|
| 35 |
COPY collab_harbor/pi-google.js /tmp/harbor-pi-agent/extensions/collab-google.js
|
| 36 |
{docker_capture_lines()}
|
| 37 |
+
{docker_bash_timeout_lines(LOCAL_BASH_TIMEOUT_SEC)}
|
| 38 |
RUN chmod 755 /usr/local/bin/team
|
| 39 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
| 40 |
WORKDIR /workspace
|
adapter/src/collab_harbor/google_compat.py
CHANGED
|
@@ -25,6 +25,10 @@ unchanged except as noted, to one configured upstream:
|
|
| 25 |
not send; only ``anthropic-workspace-id``, ``openai-organization`` and
|
| 26 |
``openai-project`` are accepted (an unscoped Anthropic key needs the first).
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
No credentials are owned or stored (the caller's auth headers pass through), no
|
| 29 |
content is logged, and nothing is retried: an ambiguous upstream attempt stays
|
| 30 |
ambiguous. The file keeps its historical name; it is no longer Google-specific.
|
|
@@ -37,7 +41,10 @@ import http.client
|
|
| 37 |
import ipaddress
|
| 38 |
import json
|
| 39 |
import os
|
|
|
|
|
|
|
| 40 |
import threading
|
|
|
|
| 41 |
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
| 42 |
from urllib.parse import urlsplit
|
| 43 |
|
|
@@ -77,6 +84,40 @@ def remote_reference(value):
|
|
| 77 |
return False
|
| 78 |
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
HOP_BY_HOP = {
|
| 81 |
"host", "content-length", "connection", "transfer-encoding", "keep-alive",
|
| 82 |
"proxy-authorization", "proxy-connection", "upgrade", "te", "trailer",
|
|
@@ -183,24 +224,93 @@ def server(upstream=GOOGLE, *, host="0.0.0.0", port=8003, fixture=False, audit=N
|
|
| 183 |
sent = {key.lower() for key in headers}
|
| 184 |
headers.update({key: value for key, value in extra_headers.items() if key not in sent})
|
| 185 |
headers.update({"Content-Length": str(len(payload)), "Content-Type": "application/json"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
try:
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
if
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
while data := response.read1(65536):
|
| 196 |
self.wfile.write(data)
|
| 197 |
self.wfile.flush()
|
| 198 |
self.close_connection = True
|
| 199 |
except (OSError, http.client.HTTPException):
|
| 200 |
-
# No retry: an ambiguous upstream attempt stays ambiguous.
|
| 201 |
self.close_connection = True
|
| 202 |
finally:
|
| 203 |
-
|
| 204 |
|
| 205 |
return ThreadingHTTPServer((host, port), Handler)
|
| 206 |
|
|
|
|
| 25 |
not send; only ``anthropic-workspace-id``, ``openai-organization`` and
|
| 26 |
``openai-project`` are accepted (an unscoped Anthropic key needs the first).
|
| 27 |
|
| 28 |
+
* A streamed request whose provider is slow (more than 3 s) is answered with a 200 event
|
| 29 |
+
stream and keepalive comments until the provider responds (see ``STREAM_KEEPALIVE``):
|
| 30 |
+
Harbor's agent egress proxy otherwise drops it after ~15 s of silence.
|
| 31 |
+
|
| 32 |
No credentials are owned or stored (the caller's auth headers pass through), no
|
| 33 |
content is logged, and nothing is retried: an ambiguous upstream attempt stays
|
| 34 |
ambiguous. The file keeps its historical name; it is no longer Google-specific.
|
|
|
|
| 41 |
import ipaddress
|
| 42 |
import json
|
| 43 |
import os
|
| 44 |
+
import select
|
| 45 |
+
import socket
|
| 46 |
import threading
|
| 47 |
+
import time
|
| 48 |
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
| 49 |
from urllib.parse import urlsplit
|
| 50 |
|
|
|
|
| 84 |
return False
|
| 85 |
|
| 86 |
|
| 87 |
+
# Harbor's agent-phase egress proxy (gost, HTTP sniffing) drops a proxied connection that stays
|
| 88 |
+
# silent for ~15 s. A streamed request whose provider has not answered after STREAM_COMMIT_AFTER
|
| 89 |
+
# seconds gets a 200 event stream at once, then SSE comment lines every STREAM_KEEPALIVE seconds
|
| 90 |
+
# until the provider answers; the provider's stream is then relayed unchanged. A late provider
|
| 91 |
+
# error becomes the stream error event of that API. Fast answers (and all errors that arrive
|
| 92 |
+
# within STREAM_COMMIT_AFTER) are relayed exactly as before, status code included.
|
| 93 |
+
STREAM_COMMIT_AFTER = 3.0
|
| 94 |
+
STREAM_KEEPALIVE = 5.0
|
| 95 |
+
CLIENT_POLL = 0.5 # how often a waiting request checks that its caller is still connected
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def client_gone(sock):
|
| 99 |
+
"""True once the caller closed its connection (readable with EOF) while we wait for the provider."""
|
| 100 |
+
try:
|
| 101 |
+
readable, _, _ = select.select([sock], [], [], 0)
|
| 102 |
+
return bool(readable) and sock.recv(1, socket.MSG_PEEK) == b""
|
| 103 |
+
except OSError:
|
| 104 |
+
return True
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def stream_error(path, message, status=None):
|
| 108 |
+
"""One SSE error event in the format the API's official SDK raises on."""
|
| 109 |
+
if path == "/v1/messages":
|
| 110 |
+
body = {"type": "error", "error": {"type": "api_error", "message": message}}
|
| 111 |
+
return b"event: error\ndata: " + json.dumps(body).encode() + b"\n\n"
|
| 112 |
+
if path == "/v1/responses":
|
| 113 |
+
# Official ResponseErrorEvent fields, plus an "error" object: the Python SDK raises only on that key.
|
| 114 |
+
body = {"type": "error", "code": str(status or "upstream_error"), "message": message, "param": None,
|
| 115 |
+
"error": {"type": "upstream_error", "code": str(status or "upstream_error"), "message": message}}
|
| 116 |
+
return b"event: error\ndata: " + json.dumps(body).encode() + b"\n\n"
|
| 117 |
+
body = {"error": {"message": message, "type": "upstream_error", "code": status}}
|
| 118 |
+
return b"data: " + json.dumps(body).encode() + b"\n\n"
|
| 119 |
+
|
| 120 |
+
|
| 121 |
HOP_BY_HOP = {
|
| 122 |
"host", "content-length", "connection", "transfer-encoding", "keep-alive",
|
| 123 |
"proxy-authorization", "proxy-connection", "upgrade", "te", "trailer",
|
|
|
|
| 224 |
sent = {key.lower() for key in headers}
|
| 225 |
headers.update({key: value for key, value in extra_headers.items() if key not in sent})
|
| 226 |
headers.update({"Content-Length": str(len(payload)), "Content-Type": "application/json"})
|
| 227 |
+
# The upstream call runs in a worker so a slow streamed answer can be kept alive (see
|
| 228 |
+
# STREAM_KEEPALIVE): Harbor's agent egress proxy drops a connection that stays silent ~15 s.
|
| 229 |
+
result = {}
|
| 230 |
+
done = threading.Event()
|
| 231 |
+
|
| 232 |
+
def call():
|
| 233 |
+
try:
|
| 234 |
+
connection.request("POST", base_path + target, payload, headers)
|
| 235 |
+
result["response"] = connection.getresponse()
|
| 236 |
+
except (OSError, http.client.HTTPException) as error:
|
| 237 |
+
result["error"] = error
|
| 238 |
+
finally:
|
| 239 |
+
done.set()
|
| 240 |
+
|
| 241 |
+
def abort_upstream():
|
| 242 |
+
# Shut the socket down (not just close it) so a read blocked in the worker returns and the
|
| 243 |
+
# provider sees the disconnect and can stop a generation nobody will read.
|
| 244 |
+
sock = connection.sock
|
| 245 |
+
if sock is not None:
|
| 246 |
+
try:
|
| 247 |
+
sock.shutdown(socket.SHUT_RDWR)
|
| 248 |
+
except OSError:
|
| 249 |
+
pass
|
| 250 |
+
connection.close()
|
| 251 |
+
|
| 252 |
+
def wait_upstream(seconds=None):
|
| 253 |
+
"""Wait for the provider; False if the caller hung up first (the upstream is then aborted)."""
|
| 254 |
+
deadline = None if seconds is None else time.monotonic() + seconds
|
| 255 |
+
while not done.is_set():
|
| 256 |
+
step = CLIENT_POLL if deadline is None else min(CLIENT_POLL, deadline - time.monotonic())
|
| 257 |
+
if step <= 0:
|
| 258 |
+
return True
|
| 259 |
+
if done.wait(step):
|
| 260 |
+
break
|
| 261 |
+
if client_gone(self.connection):
|
| 262 |
+
raise ConnectionAbortedError("caller disconnected")
|
| 263 |
+
return True
|
| 264 |
+
|
| 265 |
+
threading.Thread(target=call, daemon=True).start()
|
| 266 |
try:
|
| 267 |
+
streamed = incoming.get("stream") is True
|
| 268 |
+
wait_upstream(STREAM_COMMIT_AFTER if streamed else None)
|
| 269 |
+
if done.is_set() or not streamed:
|
| 270 |
+
wait_upstream()
|
| 271 |
+
if "error" in result:
|
| 272 |
+
# No retry: an ambiguous upstream attempt stays ambiguous.
|
| 273 |
+
self.close_connection = True
|
| 274 |
+
return
|
| 275 |
+
response = result["response"]
|
| 276 |
+
self.send_response(response.status, response.reason)
|
| 277 |
+
for key, value in response.getheaders():
|
| 278 |
+
if key.lower() not in {"transfer-encoding", "connection", "keep-alive", "content-length"}:
|
| 279 |
+
self.send_header(key, value)
|
| 280 |
+
self.send_header("Connection", "close")
|
| 281 |
+
self.end_headers()
|
| 282 |
+
else:
|
| 283 |
+
# Slow streamed answer: commit an event stream now and send SSE comments (ignored
|
| 284 |
+
# by every SSE client) until the provider answers.
|
| 285 |
+
self.send_response(200)
|
| 286 |
+
self.send_header("Content-Type", "text/event-stream")
|
| 287 |
+
self.send_header("Cache-Control", "no-cache")
|
| 288 |
+
self.send_header("Connection", "close")
|
| 289 |
+
self.end_headers()
|
| 290 |
+
self.wfile.flush()
|
| 291 |
+
while not done.is_set():
|
| 292 |
+
wait_upstream(STREAM_KEEPALIVE)
|
| 293 |
+
if not done.is_set():
|
| 294 |
+
self.wfile.write(b": keepalive\n\n")
|
| 295 |
+
self.wfile.flush()
|
| 296 |
+
response = result.get("response")
|
| 297 |
+
if response is None or response.status != 200:
|
| 298 |
+
status = getattr(response, "status", None)
|
| 299 |
+
detail = response.read(4096).decode("utf-8", "replace") if response is not None else ""
|
| 300 |
+
message = (f"Upstream HTTP {status}: {detail}" if response is not None
|
| 301 |
+
else f"Upstream connection error: {type(result.get('error')).__name__}")
|
| 302 |
+
self.wfile.write(stream_error(self.path, message, status))
|
| 303 |
+
self.wfile.flush()
|
| 304 |
+
self.close_connection = True
|
| 305 |
+
return
|
| 306 |
while data := response.read1(65536):
|
| 307 |
self.wfile.write(data)
|
| 308 |
self.wfile.flush()
|
| 309 |
self.close_connection = True
|
| 310 |
except (OSError, http.client.HTTPException):
|
|
|
|
| 311 |
self.close_connection = True
|
| 312 |
finally:
|
| 313 |
+
abort_upstream()
|
| 314 |
|
| 315 |
return ThreadingHTTPServer((host, port), Handler)
|
| 316 |
|
adapter/src/collab_harbor/sweep.py
CHANGED
|
@@ -46,13 +46,15 @@ def save(path, value):
|
|
| 46 |
# Held attempts are retried only when saved evidence shows an infrastructure cause.
|
| 47 |
# Grader/evidence disagreements, missing rewards, unknown errors and run-guard
|
| 48 |
# timeouts stay held: retrying them would resample exactly the runs a check flagged.
|
| 49 |
-
RETRYABLE_REASONS = {"agent_never_reached_team", "user_interrupted"}
|
| 50 |
RETRYABLE_ERROR_SIGNATURES = (
|
| 51 |
"'git', 'clone'", "'git', 'checkout'", "'git', 'fetch'", "'git', 'ls-remote'", # task acquisition
|
| 52 |
"toomanyrequests", "error pulling image", "initializing source docker://", # registry
|
| 53 |
"cannot change network policy after start", # node lacks nft modules
|
| 54 |
"Agent install failed", # Pi install (network)
|
| 55 |
"No space left on device",
|
|
|
|
|
|
|
| 56 |
)
|
| 57 |
NON_RETRYABLE_ERROR_SIGNATURES = ("disagrees with the read candidate", "No reward file found", "EvidenceError")
|
| 58 |
|
|
@@ -334,9 +336,16 @@ class Sweep:
|
|
| 334 |
attempt["status"] in {"running", "held"}
|
| 335 |
and self.executor == self.execute
|
| 336 |
):
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
if self.retry_held:
|
| 341 |
self._retire_held()
|
| 342 |
save(state_path, self.state)
|
|
|
|
| 46 |
# Held attempts are retried only when saved evidence shows an infrastructure cause.
|
| 47 |
# Grader/evidence disagreements, missing rewards, unknown errors and run-guard
|
| 48 |
# timeouts stay held: retrying them would resample exactly the runs a check flagged.
|
| 49 |
+
RETRYABLE_REASONS = {"agent_never_reached_team", "user_interrupted", "interrupted_before_completion"}
|
| 50 |
RETRYABLE_ERROR_SIGNATURES = (
|
| 51 |
"'git', 'clone'", "'git', 'checkout'", "'git', 'fetch'", "'git', 'ls-remote'", # task acquisition
|
| 52 |
"toomanyrequests", "error pulling image", "initializing source docker://", # registry
|
| 53 |
"cannot change network policy after start", # node lacks nft modules
|
| 54 |
"Agent install failed", # Pi install (network)
|
| 55 |
"No space left on device",
|
| 56 |
+
"RuntimeError: Connection error.", # provider connection drop
|
| 57 |
+
"Failed to download verifier directory", # Harbor artifact copy
|
| 58 |
)
|
| 59 |
NON_RETRYABLE_ERROR_SIGNATURES = ("disagrees with the read candidate", "No reward file found", "EvidenceError")
|
| 60 |
|
|
|
|
| 336 |
attempt["status"] in {"running", "held"}
|
| 337 |
and self.executor == self.execute
|
| 338 |
):
|
| 339 |
+
current = self.collect(case) # Read-only recovery; never generate again.
|
| 340 |
+
if (attempt["status"] == "running"
|
| 341 |
+
or attempt.get("reason") == "interrupted_before_completion") and (
|
| 342 |
+
current.get("status") == "held"
|
| 343 |
+
and current.get("reason") == "missing_trusted_host_or_verifier"):
|
| 344 |
+
# The sweep process died while this run was in flight (e.g. a spot
|
| 345 |
+
# node was preempted): no result exists, an infrastructure cause. A later
|
| 346 |
+
# re-collect keeps that reason instead of the generic one.
|
| 347 |
+
current = {**current, "reason": "interrupted_before_completion"}
|
| 348 |
+
self.state["attempts"][case] = current
|
| 349 |
if self.retry_held:
|
| 350 |
self._retire_held()
|
| 351 |
save(state_path, self.state)
|
inventory.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/environment/Dockerfile
CHANGED
|
@@ -8,6 +8,7 @@ ENV CI_PI_PROVIDER_PRIVATE_AUDIT=/logs/agent/pi/provider-private.jsonl
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
|
|
|
| 11 |
|
| 12 |
RUN chmod 755 /usr/local/bin/team
|
| 13 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
|
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
| 11 |
+
ENV CI_PI_BASH_TIMEOUT_SEC=120
|
| 12 |
|
| 13 |
RUN chmod 755 /usr/local/bin/team
|
| 14 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/environment/agent/Dockerfile
CHANGED
|
@@ -8,6 +8,7 @@ ENV CI_PI_PROVIDER_PRIVATE_AUDIT=/logs/agent/pi/provider-private.jsonl
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
|
|
|
| 11 |
|
| 12 |
RUN chmod 755 /usr/local/bin/team
|
| 13 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
|
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
| 11 |
+
ENV CI_PI_BASH_TIMEOUT_SEC=120
|
| 12 |
|
| 13 |
RUN chmod 755 /usr/local/bin/team
|
| 14 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/environment/model-compat/compatibility.json
CHANGED
|
@@ -17,5 +17,5 @@
|
|
| 17 |
"model-compat"
|
| 18 |
],
|
| 19 |
"agent_main_explicit_networks": false,
|
| 20 |
-
"source_sha256": "
|
| 21 |
}
|
|
|
|
| 17 |
"model-compat"
|
| 18 |
],
|
| 19 |
"agent_main_explicit_networks": false,
|
| 20 |
+
"source_sha256": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa"
|
| 21 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/environment/model-compat/google_compat.py
CHANGED
|
@@ -25,6 +25,10 @@ unchanged except as noted, to one configured upstream:
|
|
| 25 |
not send; only ``anthropic-workspace-id``, ``openai-organization`` and
|
| 26 |
``openai-project`` are accepted (an unscoped Anthropic key needs the first).
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
No credentials are owned or stored (the caller's auth headers pass through), no
|
| 29 |
content is logged, and nothing is retried: an ambiguous upstream attempt stays
|
| 30 |
ambiguous. The file keeps its historical name; it is no longer Google-specific.
|
|
@@ -37,7 +41,10 @@ import http.client
|
|
| 37 |
import ipaddress
|
| 38 |
import json
|
| 39 |
import os
|
|
|
|
|
|
|
| 40 |
import threading
|
|
|
|
| 41 |
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
| 42 |
from urllib.parse import urlsplit
|
| 43 |
|
|
@@ -77,6 +84,40 @@ def remote_reference(value):
|
|
| 77 |
return False
|
| 78 |
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
HOP_BY_HOP = {
|
| 81 |
"host", "content-length", "connection", "transfer-encoding", "keep-alive",
|
| 82 |
"proxy-authorization", "proxy-connection", "upgrade", "te", "trailer",
|
|
@@ -183,24 +224,93 @@ def server(upstream=GOOGLE, *, host="0.0.0.0", port=8003, fixture=False, audit=N
|
|
| 183 |
sent = {key.lower() for key in headers}
|
| 184 |
headers.update({key: value for key, value in extra_headers.items() if key not in sent})
|
| 185 |
headers.update({"Content-Length": str(len(payload)), "Content-Type": "application/json"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
try:
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
if
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
while data := response.read1(65536):
|
| 196 |
self.wfile.write(data)
|
| 197 |
self.wfile.flush()
|
| 198 |
self.close_connection = True
|
| 199 |
except (OSError, http.client.HTTPException):
|
| 200 |
-
# No retry: an ambiguous upstream attempt stays ambiguous.
|
| 201 |
self.close_connection = True
|
| 202 |
finally:
|
| 203 |
-
|
| 204 |
|
| 205 |
return ThreadingHTTPServer((host, port), Handler)
|
| 206 |
|
|
|
|
| 25 |
not send; only ``anthropic-workspace-id``, ``openai-organization`` and
|
| 26 |
``openai-project`` are accepted (an unscoped Anthropic key needs the first).
|
| 27 |
|
| 28 |
+
* A streamed request whose provider is slow (more than 3 s) is answered with a 200 event
|
| 29 |
+
stream and keepalive comments until the provider responds (see ``STREAM_KEEPALIVE``):
|
| 30 |
+
Harbor's agent egress proxy otherwise drops it after ~15 s of silence.
|
| 31 |
+
|
| 32 |
No credentials are owned or stored (the caller's auth headers pass through), no
|
| 33 |
content is logged, and nothing is retried: an ambiguous upstream attempt stays
|
| 34 |
ambiguous. The file keeps its historical name; it is no longer Google-specific.
|
|
|
|
| 41 |
import ipaddress
|
| 42 |
import json
|
| 43 |
import os
|
| 44 |
+
import select
|
| 45 |
+
import socket
|
| 46 |
import threading
|
| 47 |
+
import time
|
| 48 |
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
| 49 |
from urllib.parse import urlsplit
|
| 50 |
|
|
|
|
| 84 |
return False
|
| 85 |
|
| 86 |
|
| 87 |
+
# Harbor's agent-phase egress proxy (gost, HTTP sniffing) drops a proxied connection that stays
|
| 88 |
+
# silent for ~15 s. A streamed request whose provider has not answered after STREAM_COMMIT_AFTER
|
| 89 |
+
# seconds gets a 200 event stream at once, then SSE comment lines every STREAM_KEEPALIVE seconds
|
| 90 |
+
# until the provider answers; the provider's stream is then relayed unchanged. A late provider
|
| 91 |
+
# error becomes the stream error event of that API. Fast answers (and all errors that arrive
|
| 92 |
+
# within STREAM_COMMIT_AFTER) are relayed exactly as before, status code included.
|
| 93 |
+
STREAM_COMMIT_AFTER = 3.0
|
| 94 |
+
STREAM_KEEPALIVE = 5.0
|
| 95 |
+
CLIENT_POLL = 0.5 # how often a waiting request checks that its caller is still connected
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def client_gone(sock):
|
| 99 |
+
"""True once the caller closed its connection (readable with EOF) while we wait for the provider."""
|
| 100 |
+
try:
|
| 101 |
+
readable, _, _ = select.select([sock], [], [], 0)
|
| 102 |
+
return bool(readable) and sock.recv(1, socket.MSG_PEEK) == b""
|
| 103 |
+
except OSError:
|
| 104 |
+
return True
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def stream_error(path, message, status=None):
|
| 108 |
+
"""One SSE error event in the format the API's official SDK raises on."""
|
| 109 |
+
if path == "/v1/messages":
|
| 110 |
+
body = {"type": "error", "error": {"type": "api_error", "message": message}}
|
| 111 |
+
return b"event: error\ndata: " + json.dumps(body).encode() + b"\n\n"
|
| 112 |
+
if path == "/v1/responses":
|
| 113 |
+
# Official ResponseErrorEvent fields, plus an "error" object: the Python SDK raises only on that key.
|
| 114 |
+
body = {"type": "error", "code": str(status or "upstream_error"), "message": message, "param": None,
|
| 115 |
+
"error": {"type": "upstream_error", "code": str(status or "upstream_error"), "message": message}}
|
| 116 |
+
return b"event: error\ndata: " + json.dumps(body).encode() + b"\n\n"
|
| 117 |
+
body = {"error": {"message": message, "type": "upstream_error", "code": status}}
|
| 118 |
+
return b"data: " + json.dumps(body).encode() + b"\n\n"
|
| 119 |
+
|
| 120 |
+
|
| 121 |
HOP_BY_HOP = {
|
| 122 |
"host", "content-length", "connection", "transfer-encoding", "keep-alive",
|
| 123 |
"proxy-authorization", "proxy-connection", "upgrade", "te", "trailer",
|
|
|
|
| 224 |
sent = {key.lower() for key in headers}
|
| 225 |
headers.update({key: value for key, value in extra_headers.items() if key not in sent})
|
| 226 |
headers.update({"Content-Length": str(len(payload)), "Content-Type": "application/json"})
|
| 227 |
+
# The upstream call runs in a worker so a slow streamed answer can be kept alive (see
|
| 228 |
+
# STREAM_KEEPALIVE): Harbor's agent egress proxy drops a connection that stays silent ~15 s.
|
| 229 |
+
result = {}
|
| 230 |
+
done = threading.Event()
|
| 231 |
+
|
| 232 |
+
def call():
|
| 233 |
+
try:
|
| 234 |
+
connection.request("POST", base_path + target, payload, headers)
|
| 235 |
+
result["response"] = connection.getresponse()
|
| 236 |
+
except (OSError, http.client.HTTPException) as error:
|
| 237 |
+
result["error"] = error
|
| 238 |
+
finally:
|
| 239 |
+
done.set()
|
| 240 |
+
|
| 241 |
+
def abort_upstream():
|
| 242 |
+
# Shut the socket down (not just close it) so a read blocked in the worker returns and the
|
| 243 |
+
# provider sees the disconnect and can stop a generation nobody will read.
|
| 244 |
+
sock = connection.sock
|
| 245 |
+
if sock is not None:
|
| 246 |
+
try:
|
| 247 |
+
sock.shutdown(socket.SHUT_RDWR)
|
| 248 |
+
except OSError:
|
| 249 |
+
pass
|
| 250 |
+
connection.close()
|
| 251 |
+
|
| 252 |
+
def wait_upstream(seconds=None):
|
| 253 |
+
"""Wait for the provider; False if the caller hung up first (the upstream is then aborted)."""
|
| 254 |
+
deadline = None if seconds is None else time.monotonic() + seconds
|
| 255 |
+
while not done.is_set():
|
| 256 |
+
step = CLIENT_POLL if deadline is None else min(CLIENT_POLL, deadline - time.monotonic())
|
| 257 |
+
if step <= 0:
|
| 258 |
+
return True
|
| 259 |
+
if done.wait(step):
|
| 260 |
+
break
|
| 261 |
+
if client_gone(self.connection):
|
| 262 |
+
raise ConnectionAbortedError("caller disconnected")
|
| 263 |
+
return True
|
| 264 |
+
|
| 265 |
+
threading.Thread(target=call, daemon=True).start()
|
| 266 |
try:
|
| 267 |
+
streamed = incoming.get("stream") is True
|
| 268 |
+
wait_upstream(STREAM_COMMIT_AFTER if streamed else None)
|
| 269 |
+
if done.is_set() or not streamed:
|
| 270 |
+
wait_upstream()
|
| 271 |
+
if "error" in result:
|
| 272 |
+
# No retry: an ambiguous upstream attempt stays ambiguous.
|
| 273 |
+
self.close_connection = True
|
| 274 |
+
return
|
| 275 |
+
response = result["response"]
|
| 276 |
+
self.send_response(response.status, response.reason)
|
| 277 |
+
for key, value in response.getheaders():
|
| 278 |
+
if key.lower() not in {"transfer-encoding", "connection", "keep-alive", "content-length"}:
|
| 279 |
+
self.send_header(key, value)
|
| 280 |
+
self.send_header("Connection", "close")
|
| 281 |
+
self.end_headers()
|
| 282 |
+
else:
|
| 283 |
+
# Slow streamed answer: commit an event stream now and send SSE comments (ignored
|
| 284 |
+
# by every SSE client) until the provider answers.
|
| 285 |
+
self.send_response(200)
|
| 286 |
+
self.send_header("Content-Type", "text/event-stream")
|
| 287 |
+
self.send_header("Cache-Control", "no-cache")
|
| 288 |
+
self.send_header("Connection", "close")
|
| 289 |
+
self.end_headers()
|
| 290 |
+
self.wfile.flush()
|
| 291 |
+
while not done.is_set():
|
| 292 |
+
wait_upstream(STREAM_KEEPALIVE)
|
| 293 |
+
if not done.is_set():
|
| 294 |
+
self.wfile.write(b": keepalive\n\n")
|
| 295 |
+
self.wfile.flush()
|
| 296 |
+
response = result.get("response")
|
| 297 |
+
if response is None or response.status != 200:
|
| 298 |
+
status = getattr(response, "status", None)
|
| 299 |
+
detail = response.read(4096).decode("utf-8", "replace") if response is not None else ""
|
| 300 |
+
message = (f"Upstream HTTP {status}: {detail}" if response is not None
|
| 301 |
+
else f"Upstream connection error: {type(result.get('error')).__name__}")
|
| 302 |
+
self.wfile.write(stream_error(self.path, message, status))
|
| 303 |
+
self.wfile.flush()
|
| 304 |
+
self.close_connection = True
|
| 305 |
+
return
|
| 306 |
while data := response.read1(65536):
|
| 307 |
self.wfile.write(data)
|
| 308 |
self.wfile.flush()
|
| 309 |
self.close_connection = True
|
| 310 |
except (OSError, http.client.HTTPException):
|
|
|
|
| 311 |
self.close_connection = True
|
| 312 |
finally:
|
| 313 |
+
abort_upstream()
|
| 314 |
|
| 315 |
return ThreadingHTTPServer((host, port), Handler)
|
| 316 |
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/environment/team/runtime.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"archive_sha256": "
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
@@ -12,8 +12,8 @@
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
-
"adapter/collab_harbor/generate.py": "
|
| 16 |
-
"adapter/collab_harbor/google_compat.py": "
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -100,6 +100,6 @@
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
-
"uncompressed_bytes":
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"archive_sha256": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c",
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
+
"adapter/collab_harbor/generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 16 |
+
"adapter/collab_harbor/google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
+
"uncompressed_bytes": 1475066,
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/environment/team/runtime.tar.gz
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c
|
| 3 |
+
size 393802
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/environment/team/task.json
CHANGED
|
@@ -36,7 +36,7 @@
|
|
| 36 |
"agent": {
|
| 37 |
"schema_version": 1,
|
| 38 |
"files": {
|
| 39 |
-
"Dockerfile": "
|
| 40 |
"collab_harbor/__init__.py": "7df1d3de24dc22f6cf6ca1eb14111edc949558bbca98d01a6e29a093313e073b",
|
| 41 |
"collab_harbor/cli.py": "a3ed01306b021e4784b24782e48903eb1b33edca19b8268a53fda47d75c4ce7e",
|
| 42 |
"collab_harbor/pi-bash-timeout.js": "aeba75d3703c9f1e5be548a7153c3a472cc1210931aa98ddc914310901ba689a",
|
|
@@ -45,7 +45,7 @@
|
|
| 45 |
"collab_harbor/relay.py": "70491ff1be0a428e2cfd02e70f8ee4f6ed3245a1cdb9b2d20e2b43a0684b0097",
|
| 46 |
"team": "7526f8ccae4b1f3632b960cf0d63aab7e7a81f0726bcfb62c559743898575a4a"
|
| 47 |
},
|
| 48 |
-
"sha256": "
|
| 49 |
},
|
| 50 |
"team_adapter": {
|
| 51 |
"schema_version": 1,
|
|
@@ -60,8 +60,8 @@
|
|
| 60 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 61 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 62 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 63 |
-
"generate.py": "
|
| 64 |
-
"google_compat.py": "
|
| 65 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 66 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 67 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -85,7 +85,7 @@
|
|
| 85 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 86 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 87 |
},
|
| 88 |
-
"sha256": "
|
| 89 |
},
|
| 90 |
"verifier_adapter": {
|
| 91 |
"schema_version": 1,
|
|
@@ -100,8 +100,8 @@
|
|
| 100 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 101 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 102 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 103 |
-
"generate.py": "
|
| 104 |
-
"google_compat.py": "
|
| 105 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 106 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 107 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -125,7 +125,7 @@
|
|
| 125 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 126 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 127 |
},
|
| 128 |
-
"sha256": "
|
| 129 |
},
|
| 130 |
"team_upstream": {
|
| 131 |
"schema_version": 1,
|
|
@@ -251,26 +251,26 @@
|
|
| 251 |
"schema_version": 1,
|
| 252 |
"files": {
|
| 253 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 254 |
-
"runtime.json": "
|
| 255 |
-
"runtime.tar.gz": "
|
| 256 |
},
|
| 257 |
-
"sha256": "
|
| 258 |
},
|
| 259 |
"verifier_runtime_distribution": {
|
| 260 |
"schema_version": 1,
|
| 261 |
"files": {
|
| 262 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 263 |
-
"runtime.json": "
|
| 264 |
-
"runtime.tar.gz": "
|
| 265 |
},
|
| 266 |
-
"sha256": "
|
| 267 |
},
|
| 268 |
"runtime_distribution": {
|
| 269 |
"schema_version": 1,
|
| 270 |
"files": {
|
| 271 |
-
"runtime-distribution.json": "
|
| 272 |
},
|
| 273 |
-
"sha256": "
|
| 274 |
},
|
| 275 |
"environment_policy": {
|
| 276 |
"schema_version": 1,
|
|
@@ -316,10 +316,10 @@
|
|
| 316 |
"sha256": "33b10cc4a7d760c70a490b186618d63dd730389503da1396eec47afc8b436d60"
|
| 317 |
}
|
| 318 |
},
|
| 319 |
-
"sha256": "
|
| 320 |
},
|
| 321 |
"runtime_distribution": {
|
| 322 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 323 |
-
"archive_sha256": "
|
| 324 |
}
|
| 325 |
}
|
|
|
|
| 36 |
"agent": {
|
| 37 |
"schema_version": 1,
|
| 38 |
"files": {
|
| 39 |
+
"Dockerfile": "304c4346b6339d0fdacfe2b27d19d5546028b4e5626e68bd114ad2f7fdb2d62b",
|
| 40 |
"collab_harbor/__init__.py": "7df1d3de24dc22f6cf6ca1eb14111edc949558bbca98d01a6e29a093313e073b",
|
| 41 |
"collab_harbor/cli.py": "a3ed01306b021e4784b24782e48903eb1b33edca19b8268a53fda47d75c4ce7e",
|
| 42 |
"collab_harbor/pi-bash-timeout.js": "aeba75d3703c9f1e5be548a7153c3a472cc1210931aa98ddc914310901ba689a",
|
|
|
|
| 45 |
"collab_harbor/relay.py": "70491ff1be0a428e2cfd02e70f8ee4f6ed3245a1cdb9b2d20e2b43a0684b0097",
|
| 46 |
"team": "7526f8ccae4b1f3632b960cf0d63aab7e7a81f0726bcfb62c559743898575a4a"
|
| 47 |
},
|
| 48 |
+
"sha256": "8e2fe7bbd527086c488b171ca41691b7104cd69f136a99b619cd89b73acc1f9f"
|
| 49 |
},
|
| 50 |
"team_adapter": {
|
| 51 |
"schema_version": 1,
|
|
|
|
| 60 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 61 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 62 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 63 |
+
"generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 64 |
+
"google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 65 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 66 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 67 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 85 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 86 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 87 |
},
|
| 88 |
+
"sha256": "8d1ce359662da6b61c83d91dddb6e465507db4884dc57815125d9446d280bb30"
|
| 89 |
},
|
| 90 |
"verifier_adapter": {
|
| 91 |
"schema_version": 1,
|
|
|
|
| 100 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 101 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 102 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 103 |
+
"generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 104 |
+
"google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 105 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 106 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 107 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 125 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 126 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 127 |
},
|
| 128 |
+
"sha256": "8d1ce359662da6b61c83d91dddb6e465507db4884dc57815125d9446d280bb30"
|
| 129 |
},
|
| 130 |
"team_upstream": {
|
| 131 |
"schema_version": 1,
|
|
|
|
| 251 |
"schema_version": 1,
|
| 252 |
"files": {
|
| 253 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 254 |
+
"runtime.json": "e251e5f2de6505f9bdcdabd148c2be096cd8a9bd24a49fb6e7dd602baf0cdeb5",
|
| 255 |
+
"runtime.tar.gz": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c"
|
| 256 |
},
|
| 257 |
+
"sha256": "afd411b152dee0b7a83eeb4e5440d3a541834b555047f1e5591083550888517b"
|
| 258 |
},
|
| 259 |
"verifier_runtime_distribution": {
|
| 260 |
"schema_version": 1,
|
| 261 |
"files": {
|
| 262 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 263 |
+
"runtime.json": "e251e5f2de6505f9bdcdabd148c2be096cd8a9bd24a49fb6e7dd602baf0cdeb5",
|
| 264 |
+
"runtime.tar.gz": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c"
|
| 265 |
},
|
| 266 |
+
"sha256": "afd411b152dee0b7a83eeb4e5440d3a541834b555047f1e5591083550888517b"
|
| 267 |
},
|
| 268 |
"runtime_distribution": {
|
| 269 |
"schema_version": 1,
|
| 270 |
"files": {
|
| 271 |
+
"runtime-distribution.json": "188133f05f8cfb3648ef334187adb4b5290d9902c2ae8d9d337c9ccd8b822494"
|
| 272 |
},
|
| 273 |
+
"sha256": "b1997306709c2737610eb9d9b0e9a9a01a106dcc84e98cc353fcb3da08f7ad5c"
|
| 274 |
},
|
| 275 |
"environment_policy": {
|
| 276 |
"schema_version": 1,
|
|
|
|
| 316 |
"sha256": "33b10cc4a7d760c70a490b186618d63dd730389503da1396eec47afc8b436d60"
|
| 317 |
}
|
| 318 |
},
|
| 319 |
+
"sha256": "a5b78845b49b5471f4ddfaf55bcd36a74d5e5ac161631572e14bc753a66b5026"
|
| 320 |
},
|
| 321 |
"runtime_distribution": {
|
| 322 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 323 |
+
"archive_sha256": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c"
|
| 324 |
}
|
| 325 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/tests/runtime.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"archive_sha256": "
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
@@ -12,8 +12,8 @@
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
-
"adapter/collab_harbor/generate.py": "
|
| 16 |
-
"adapter/collab_harbor/google_compat.py": "
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -100,6 +100,6 @@
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
-
"uncompressed_bytes":
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"archive_sha256": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c",
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
+
"adapter/collab_harbor/generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 16 |
+
"adapter/collab_harbor/google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
+
"uncompressed_bytes": 1475066,
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-baseline-s0/tests/runtime.tar.gz
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c
|
| 3 |
+
size 393802
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/environment/Dockerfile
CHANGED
|
@@ -8,6 +8,7 @@ ENV CI_PI_PROVIDER_PRIVATE_AUDIT=/logs/agent/pi/provider-private.jsonl
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
|
|
|
| 11 |
|
| 12 |
RUN chmod 755 /usr/local/bin/team
|
| 13 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
|
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
| 11 |
+
ENV CI_PI_BASH_TIMEOUT_SEC=120
|
| 12 |
|
| 13 |
RUN chmod 755 /usr/local/bin/team
|
| 14 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/environment/agent/Dockerfile
CHANGED
|
@@ -8,6 +8,7 @@ ENV CI_PI_PROVIDER_PRIVATE_AUDIT=/logs/agent/pi/provider-private.jsonl
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
|
|
|
| 11 |
|
| 12 |
RUN chmod 755 /usr/local/bin/team
|
| 13 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
|
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
| 11 |
+
ENV CI_PI_BASH_TIMEOUT_SEC=120
|
| 12 |
|
| 13 |
RUN chmod 755 /usr/local/bin/team
|
| 14 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/environment/model-compat/compatibility.json
CHANGED
|
@@ -17,5 +17,5 @@
|
|
| 17 |
"model-compat"
|
| 18 |
],
|
| 19 |
"agent_main_explicit_networks": false,
|
| 20 |
-
"source_sha256": "
|
| 21 |
}
|
|
|
|
| 17 |
"model-compat"
|
| 18 |
],
|
| 19 |
"agent_main_explicit_networks": false,
|
| 20 |
+
"source_sha256": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa"
|
| 21 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/environment/model-compat/google_compat.py
CHANGED
|
@@ -25,6 +25,10 @@ unchanged except as noted, to one configured upstream:
|
|
| 25 |
not send; only ``anthropic-workspace-id``, ``openai-organization`` and
|
| 26 |
``openai-project`` are accepted (an unscoped Anthropic key needs the first).
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
No credentials are owned or stored (the caller's auth headers pass through), no
|
| 29 |
content is logged, and nothing is retried: an ambiguous upstream attempt stays
|
| 30 |
ambiguous. The file keeps its historical name; it is no longer Google-specific.
|
|
@@ -37,7 +41,10 @@ import http.client
|
|
| 37 |
import ipaddress
|
| 38 |
import json
|
| 39 |
import os
|
|
|
|
|
|
|
| 40 |
import threading
|
|
|
|
| 41 |
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
| 42 |
from urllib.parse import urlsplit
|
| 43 |
|
|
@@ -77,6 +84,40 @@ def remote_reference(value):
|
|
| 77 |
return False
|
| 78 |
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
HOP_BY_HOP = {
|
| 81 |
"host", "content-length", "connection", "transfer-encoding", "keep-alive",
|
| 82 |
"proxy-authorization", "proxy-connection", "upgrade", "te", "trailer",
|
|
@@ -183,24 +224,93 @@ def server(upstream=GOOGLE, *, host="0.0.0.0", port=8003, fixture=False, audit=N
|
|
| 183 |
sent = {key.lower() for key in headers}
|
| 184 |
headers.update({key: value for key, value in extra_headers.items() if key not in sent})
|
| 185 |
headers.update({"Content-Length": str(len(payload)), "Content-Type": "application/json"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
try:
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
if
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
while data := response.read1(65536):
|
| 196 |
self.wfile.write(data)
|
| 197 |
self.wfile.flush()
|
| 198 |
self.close_connection = True
|
| 199 |
except (OSError, http.client.HTTPException):
|
| 200 |
-
# No retry: an ambiguous upstream attempt stays ambiguous.
|
| 201 |
self.close_connection = True
|
| 202 |
finally:
|
| 203 |
-
|
| 204 |
|
| 205 |
return ThreadingHTTPServer((host, port), Handler)
|
| 206 |
|
|
|
|
| 25 |
not send; only ``anthropic-workspace-id``, ``openai-organization`` and
|
| 26 |
``openai-project`` are accepted (an unscoped Anthropic key needs the first).
|
| 27 |
|
| 28 |
+
* A streamed request whose provider is slow (more than 3 s) is answered with a 200 event
|
| 29 |
+
stream and keepalive comments until the provider responds (see ``STREAM_KEEPALIVE``):
|
| 30 |
+
Harbor's agent egress proxy otherwise drops it after ~15 s of silence.
|
| 31 |
+
|
| 32 |
No credentials are owned or stored (the caller's auth headers pass through), no
|
| 33 |
content is logged, and nothing is retried: an ambiguous upstream attempt stays
|
| 34 |
ambiguous. The file keeps its historical name; it is no longer Google-specific.
|
|
|
|
| 41 |
import ipaddress
|
| 42 |
import json
|
| 43 |
import os
|
| 44 |
+
import select
|
| 45 |
+
import socket
|
| 46 |
import threading
|
| 47 |
+
import time
|
| 48 |
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
| 49 |
from urllib.parse import urlsplit
|
| 50 |
|
|
|
|
| 84 |
return False
|
| 85 |
|
| 86 |
|
| 87 |
+
# Harbor's agent-phase egress proxy (gost, HTTP sniffing) drops a proxied connection that stays
|
| 88 |
+
# silent for ~15 s. A streamed request whose provider has not answered after STREAM_COMMIT_AFTER
|
| 89 |
+
# seconds gets a 200 event stream at once, then SSE comment lines every STREAM_KEEPALIVE seconds
|
| 90 |
+
# until the provider answers; the provider's stream is then relayed unchanged. A late provider
|
| 91 |
+
# error becomes the stream error event of that API. Fast answers (and all errors that arrive
|
| 92 |
+
# within STREAM_COMMIT_AFTER) are relayed exactly as before, status code included.
|
| 93 |
+
STREAM_COMMIT_AFTER = 3.0
|
| 94 |
+
STREAM_KEEPALIVE = 5.0
|
| 95 |
+
CLIENT_POLL = 0.5 # how often a waiting request checks that its caller is still connected
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def client_gone(sock):
|
| 99 |
+
"""True once the caller closed its connection (readable with EOF) while we wait for the provider."""
|
| 100 |
+
try:
|
| 101 |
+
readable, _, _ = select.select([sock], [], [], 0)
|
| 102 |
+
return bool(readable) and sock.recv(1, socket.MSG_PEEK) == b""
|
| 103 |
+
except OSError:
|
| 104 |
+
return True
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def stream_error(path, message, status=None):
|
| 108 |
+
"""One SSE error event in the format the API's official SDK raises on."""
|
| 109 |
+
if path == "/v1/messages":
|
| 110 |
+
body = {"type": "error", "error": {"type": "api_error", "message": message}}
|
| 111 |
+
return b"event: error\ndata: " + json.dumps(body).encode() + b"\n\n"
|
| 112 |
+
if path == "/v1/responses":
|
| 113 |
+
# Official ResponseErrorEvent fields, plus an "error" object: the Python SDK raises only on that key.
|
| 114 |
+
body = {"type": "error", "code": str(status or "upstream_error"), "message": message, "param": None,
|
| 115 |
+
"error": {"type": "upstream_error", "code": str(status or "upstream_error"), "message": message}}
|
| 116 |
+
return b"event: error\ndata: " + json.dumps(body).encode() + b"\n\n"
|
| 117 |
+
body = {"error": {"message": message, "type": "upstream_error", "code": status}}
|
| 118 |
+
return b"data: " + json.dumps(body).encode() + b"\n\n"
|
| 119 |
+
|
| 120 |
+
|
| 121 |
HOP_BY_HOP = {
|
| 122 |
"host", "content-length", "connection", "transfer-encoding", "keep-alive",
|
| 123 |
"proxy-authorization", "proxy-connection", "upgrade", "te", "trailer",
|
|
|
|
| 224 |
sent = {key.lower() for key in headers}
|
| 225 |
headers.update({key: value for key, value in extra_headers.items() if key not in sent})
|
| 226 |
headers.update({"Content-Length": str(len(payload)), "Content-Type": "application/json"})
|
| 227 |
+
# The upstream call runs in a worker so a slow streamed answer can be kept alive (see
|
| 228 |
+
# STREAM_KEEPALIVE): Harbor's agent egress proxy drops a connection that stays silent ~15 s.
|
| 229 |
+
result = {}
|
| 230 |
+
done = threading.Event()
|
| 231 |
+
|
| 232 |
+
def call():
|
| 233 |
+
try:
|
| 234 |
+
connection.request("POST", base_path + target, payload, headers)
|
| 235 |
+
result["response"] = connection.getresponse()
|
| 236 |
+
except (OSError, http.client.HTTPException) as error:
|
| 237 |
+
result["error"] = error
|
| 238 |
+
finally:
|
| 239 |
+
done.set()
|
| 240 |
+
|
| 241 |
+
def abort_upstream():
|
| 242 |
+
# Shut the socket down (not just close it) so a read blocked in the worker returns and the
|
| 243 |
+
# provider sees the disconnect and can stop a generation nobody will read.
|
| 244 |
+
sock = connection.sock
|
| 245 |
+
if sock is not None:
|
| 246 |
+
try:
|
| 247 |
+
sock.shutdown(socket.SHUT_RDWR)
|
| 248 |
+
except OSError:
|
| 249 |
+
pass
|
| 250 |
+
connection.close()
|
| 251 |
+
|
| 252 |
+
def wait_upstream(seconds=None):
|
| 253 |
+
"""Wait for the provider; False if the caller hung up first (the upstream is then aborted)."""
|
| 254 |
+
deadline = None if seconds is None else time.monotonic() + seconds
|
| 255 |
+
while not done.is_set():
|
| 256 |
+
step = CLIENT_POLL if deadline is None else min(CLIENT_POLL, deadline - time.monotonic())
|
| 257 |
+
if step <= 0:
|
| 258 |
+
return True
|
| 259 |
+
if done.wait(step):
|
| 260 |
+
break
|
| 261 |
+
if client_gone(self.connection):
|
| 262 |
+
raise ConnectionAbortedError("caller disconnected")
|
| 263 |
+
return True
|
| 264 |
+
|
| 265 |
+
threading.Thread(target=call, daemon=True).start()
|
| 266 |
try:
|
| 267 |
+
streamed = incoming.get("stream") is True
|
| 268 |
+
wait_upstream(STREAM_COMMIT_AFTER if streamed else None)
|
| 269 |
+
if done.is_set() or not streamed:
|
| 270 |
+
wait_upstream()
|
| 271 |
+
if "error" in result:
|
| 272 |
+
# No retry: an ambiguous upstream attempt stays ambiguous.
|
| 273 |
+
self.close_connection = True
|
| 274 |
+
return
|
| 275 |
+
response = result["response"]
|
| 276 |
+
self.send_response(response.status, response.reason)
|
| 277 |
+
for key, value in response.getheaders():
|
| 278 |
+
if key.lower() not in {"transfer-encoding", "connection", "keep-alive", "content-length"}:
|
| 279 |
+
self.send_header(key, value)
|
| 280 |
+
self.send_header("Connection", "close")
|
| 281 |
+
self.end_headers()
|
| 282 |
+
else:
|
| 283 |
+
# Slow streamed answer: commit an event stream now and send SSE comments (ignored
|
| 284 |
+
# by every SSE client) until the provider answers.
|
| 285 |
+
self.send_response(200)
|
| 286 |
+
self.send_header("Content-Type", "text/event-stream")
|
| 287 |
+
self.send_header("Cache-Control", "no-cache")
|
| 288 |
+
self.send_header("Connection", "close")
|
| 289 |
+
self.end_headers()
|
| 290 |
+
self.wfile.flush()
|
| 291 |
+
while not done.is_set():
|
| 292 |
+
wait_upstream(STREAM_KEEPALIVE)
|
| 293 |
+
if not done.is_set():
|
| 294 |
+
self.wfile.write(b": keepalive\n\n")
|
| 295 |
+
self.wfile.flush()
|
| 296 |
+
response = result.get("response")
|
| 297 |
+
if response is None or response.status != 200:
|
| 298 |
+
status = getattr(response, "status", None)
|
| 299 |
+
detail = response.read(4096).decode("utf-8", "replace") if response is not None else ""
|
| 300 |
+
message = (f"Upstream HTTP {status}: {detail}" if response is not None
|
| 301 |
+
else f"Upstream connection error: {type(result.get('error')).__name__}")
|
| 302 |
+
self.wfile.write(stream_error(self.path, message, status))
|
| 303 |
+
self.wfile.flush()
|
| 304 |
+
self.close_connection = True
|
| 305 |
+
return
|
| 306 |
while data := response.read1(65536):
|
| 307 |
self.wfile.write(data)
|
| 308 |
self.wfile.flush()
|
| 309 |
self.close_connection = True
|
| 310 |
except (OSError, http.client.HTTPException):
|
|
|
|
| 311 |
self.close_connection = True
|
| 312 |
finally:
|
| 313 |
+
abort_upstream()
|
| 314 |
|
| 315 |
return ThreadingHTTPServer((host, port), Handler)
|
| 316 |
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/environment/team/runtime.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"archive_sha256": "
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
@@ -12,8 +12,8 @@
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
-
"adapter/collab_harbor/generate.py": "
|
| 16 |
-
"adapter/collab_harbor/google_compat.py": "
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -100,6 +100,6 @@
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
-
"uncompressed_bytes":
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"archive_sha256": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c",
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
+
"adapter/collab_harbor/generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 16 |
+
"adapter/collab_harbor/google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
+
"uncompressed_bytes": 1475066,
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/environment/team/runtime.tar.gz
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c
|
| 3 |
+
size 393802
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/environment/team/task.json
CHANGED
|
@@ -36,7 +36,7 @@
|
|
| 36 |
"agent": {
|
| 37 |
"schema_version": 1,
|
| 38 |
"files": {
|
| 39 |
-
"Dockerfile": "
|
| 40 |
"collab_harbor/__init__.py": "7df1d3de24dc22f6cf6ca1eb14111edc949558bbca98d01a6e29a093313e073b",
|
| 41 |
"collab_harbor/cli.py": "a3ed01306b021e4784b24782e48903eb1b33edca19b8268a53fda47d75c4ce7e",
|
| 42 |
"collab_harbor/pi-bash-timeout.js": "aeba75d3703c9f1e5be548a7153c3a472cc1210931aa98ddc914310901ba689a",
|
|
@@ -45,7 +45,7 @@
|
|
| 45 |
"collab_harbor/relay.py": "70491ff1be0a428e2cfd02e70f8ee4f6ed3245a1cdb9b2d20e2b43a0684b0097",
|
| 46 |
"team": "7526f8ccae4b1f3632b960cf0d63aab7e7a81f0726bcfb62c559743898575a4a"
|
| 47 |
},
|
| 48 |
-
"sha256": "
|
| 49 |
},
|
| 50 |
"team_adapter": {
|
| 51 |
"schema_version": 1,
|
|
@@ -60,8 +60,8 @@
|
|
| 60 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 61 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 62 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 63 |
-
"generate.py": "
|
| 64 |
-
"google_compat.py": "
|
| 65 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 66 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 67 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -85,7 +85,7 @@
|
|
| 85 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 86 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 87 |
},
|
| 88 |
-
"sha256": "
|
| 89 |
},
|
| 90 |
"verifier_adapter": {
|
| 91 |
"schema_version": 1,
|
|
@@ -100,8 +100,8 @@
|
|
| 100 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 101 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 102 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 103 |
-
"generate.py": "
|
| 104 |
-
"google_compat.py": "
|
| 105 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 106 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 107 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -125,7 +125,7 @@
|
|
| 125 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 126 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 127 |
},
|
| 128 |
-
"sha256": "
|
| 129 |
},
|
| 130 |
"team_upstream": {
|
| 131 |
"schema_version": 1,
|
|
@@ -251,26 +251,26 @@
|
|
| 251 |
"schema_version": 1,
|
| 252 |
"files": {
|
| 253 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 254 |
-
"runtime.json": "
|
| 255 |
-
"runtime.tar.gz": "
|
| 256 |
},
|
| 257 |
-
"sha256": "
|
| 258 |
},
|
| 259 |
"verifier_runtime_distribution": {
|
| 260 |
"schema_version": 1,
|
| 261 |
"files": {
|
| 262 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 263 |
-
"runtime.json": "
|
| 264 |
-
"runtime.tar.gz": "
|
| 265 |
},
|
| 266 |
-
"sha256": "
|
| 267 |
},
|
| 268 |
"runtime_distribution": {
|
| 269 |
"schema_version": 1,
|
| 270 |
"files": {
|
| 271 |
-
"runtime-distribution.json": "
|
| 272 |
},
|
| 273 |
-
"sha256": "
|
| 274 |
},
|
| 275 |
"environment_policy": {
|
| 276 |
"schema_version": 1,
|
|
@@ -316,10 +316,10 @@
|
|
| 316 |
"sha256": "33b10cc4a7d760c70a490b186618d63dd730389503da1396eec47afc8b436d60"
|
| 317 |
}
|
| 318 |
},
|
| 319 |
-
"sha256": "
|
| 320 |
},
|
| 321 |
"runtime_distribution": {
|
| 322 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 323 |
-
"archive_sha256": "
|
| 324 |
}
|
| 325 |
}
|
|
|
|
| 36 |
"agent": {
|
| 37 |
"schema_version": 1,
|
| 38 |
"files": {
|
| 39 |
+
"Dockerfile": "304c4346b6339d0fdacfe2b27d19d5546028b4e5626e68bd114ad2f7fdb2d62b",
|
| 40 |
"collab_harbor/__init__.py": "7df1d3de24dc22f6cf6ca1eb14111edc949558bbca98d01a6e29a093313e073b",
|
| 41 |
"collab_harbor/cli.py": "a3ed01306b021e4784b24782e48903eb1b33edca19b8268a53fda47d75c4ce7e",
|
| 42 |
"collab_harbor/pi-bash-timeout.js": "aeba75d3703c9f1e5be548a7153c3a472cc1210931aa98ddc914310901ba689a",
|
|
|
|
| 45 |
"collab_harbor/relay.py": "70491ff1be0a428e2cfd02e70f8ee4f6ed3245a1cdb9b2d20e2b43a0684b0097",
|
| 46 |
"team": "7526f8ccae4b1f3632b960cf0d63aab7e7a81f0726bcfb62c559743898575a4a"
|
| 47 |
},
|
| 48 |
+
"sha256": "8e2fe7bbd527086c488b171ca41691b7104cd69f136a99b619cd89b73acc1f9f"
|
| 49 |
},
|
| 50 |
"team_adapter": {
|
| 51 |
"schema_version": 1,
|
|
|
|
| 60 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 61 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 62 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 63 |
+
"generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 64 |
+
"google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 65 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 66 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 67 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 85 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 86 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 87 |
},
|
| 88 |
+
"sha256": "8d1ce359662da6b61c83d91dddb6e465507db4884dc57815125d9446d280bb30"
|
| 89 |
},
|
| 90 |
"verifier_adapter": {
|
| 91 |
"schema_version": 1,
|
|
|
|
| 100 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 101 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 102 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 103 |
+
"generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 104 |
+
"google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 105 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 106 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 107 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 125 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 126 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 127 |
},
|
| 128 |
+
"sha256": "8d1ce359662da6b61c83d91dddb6e465507db4884dc57815125d9446d280bb30"
|
| 129 |
},
|
| 130 |
"team_upstream": {
|
| 131 |
"schema_version": 1,
|
|
|
|
| 251 |
"schema_version": 1,
|
| 252 |
"files": {
|
| 253 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 254 |
+
"runtime.json": "e251e5f2de6505f9bdcdabd148c2be096cd8a9bd24a49fb6e7dd602baf0cdeb5",
|
| 255 |
+
"runtime.tar.gz": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c"
|
| 256 |
},
|
| 257 |
+
"sha256": "afd411b152dee0b7a83eeb4e5440d3a541834b555047f1e5591083550888517b"
|
| 258 |
},
|
| 259 |
"verifier_runtime_distribution": {
|
| 260 |
"schema_version": 1,
|
| 261 |
"files": {
|
| 262 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 263 |
+
"runtime.json": "e251e5f2de6505f9bdcdabd148c2be096cd8a9bd24a49fb6e7dd602baf0cdeb5",
|
| 264 |
+
"runtime.tar.gz": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c"
|
| 265 |
},
|
| 266 |
+
"sha256": "afd411b152dee0b7a83eeb4e5440d3a541834b555047f1e5591083550888517b"
|
| 267 |
},
|
| 268 |
"runtime_distribution": {
|
| 269 |
"schema_version": 1,
|
| 270 |
"files": {
|
| 271 |
+
"runtime-distribution.json": "188133f05f8cfb3648ef334187adb4b5290d9902c2ae8d9d337c9ccd8b822494"
|
| 272 |
},
|
| 273 |
+
"sha256": "b1997306709c2737610eb9d9b0e9a9a01a106dcc84e98cc353fcb3da08f7ad5c"
|
| 274 |
},
|
| 275 |
"environment_policy": {
|
| 276 |
"schema_version": 1,
|
|
|
|
| 316 |
"sha256": "33b10cc4a7d760c70a490b186618d63dd730389503da1396eec47afc8b436d60"
|
| 317 |
}
|
| 318 |
},
|
| 319 |
+
"sha256": "8228565c323a7c5e95a4d0ce12aadf218329d7bae063ed4a3cbb9d7465ff611d"
|
| 320 |
},
|
| 321 |
"runtime_distribution": {
|
| 322 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 323 |
+
"archive_sha256": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c"
|
| 324 |
}
|
| 325 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/tests/runtime.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"archive_sha256": "
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
@@ -12,8 +12,8 @@
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
-
"adapter/collab_harbor/generate.py": "
|
| 16 |
-
"adapter/collab_harbor/google_compat.py": "
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -100,6 +100,6 @@
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
-
"uncompressed_bytes":
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"archive_sha256": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c",
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
+
"adapter/collab_harbor/generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 16 |
+
"adapter/collab_harbor/google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
+
"uncompressed_bytes": 1475066,
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-solo-s0/tests/runtime.tar.gz
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c
|
| 3 |
+
size 393802
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/environment/Dockerfile
CHANGED
|
@@ -8,6 +8,7 @@ ENV CI_PI_PROVIDER_PRIVATE_AUDIT=/logs/agent/pi/provider-private.jsonl
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
|
|
|
| 11 |
|
| 12 |
RUN chmod 755 /usr/local/bin/team
|
| 13 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
|
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
| 11 |
+
ENV CI_PI_BASH_TIMEOUT_SEC=120
|
| 12 |
|
| 13 |
RUN chmod 755 /usr/local/bin/team
|
| 14 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/environment/agent/Dockerfile
CHANGED
|
@@ -8,6 +8,7 @@ ENV CI_PI_PROVIDER_PRIVATE_AUDIT=/logs/agent/pi/provider-private.jsonl
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
|
|
|
| 11 |
|
| 12 |
RUN chmod 755 /usr/local/bin/team
|
| 13 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
|
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
| 11 |
+
ENV CI_PI_BASH_TIMEOUT_SEC=120
|
| 12 |
|
| 13 |
RUN chmod 755 /usr/local/bin/team
|
| 14 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/environment/model-compat/compatibility.json
CHANGED
|
@@ -17,5 +17,5 @@
|
|
| 17 |
"model-compat"
|
| 18 |
],
|
| 19 |
"agent_main_explicit_networks": false,
|
| 20 |
-
"source_sha256": "
|
| 21 |
}
|
|
|
|
| 17 |
"model-compat"
|
| 18 |
],
|
| 19 |
"agent_main_explicit_networks": false,
|
| 20 |
+
"source_sha256": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa"
|
| 21 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/environment/model-compat/google_compat.py
CHANGED
|
@@ -25,6 +25,10 @@ unchanged except as noted, to one configured upstream:
|
|
| 25 |
not send; only ``anthropic-workspace-id``, ``openai-organization`` and
|
| 26 |
``openai-project`` are accepted (an unscoped Anthropic key needs the first).
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
No credentials are owned or stored (the caller's auth headers pass through), no
|
| 29 |
content is logged, and nothing is retried: an ambiguous upstream attempt stays
|
| 30 |
ambiguous. The file keeps its historical name; it is no longer Google-specific.
|
|
@@ -37,7 +41,10 @@ import http.client
|
|
| 37 |
import ipaddress
|
| 38 |
import json
|
| 39 |
import os
|
|
|
|
|
|
|
| 40 |
import threading
|
|
|
|
| 41 |
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
| 42 |
from urllib.parse import urlsplit
|
| 43 |
|
|
@@ -77,6 +84,40 @@ def remote_reference(value):
|
|
| 77 |
return False
|
| 78 |
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
HOP_BY_HOP = {
|
| 81 |
"host", "content-length", "connection", "transfer-encoding", "keep-alive",
|
| 82 |
"proxy-authorization", "proxy-connection", "upgrade", "te", "trailer",
|
|
@@ -183,24 +224,93 @@ def server(upstream=GOOGLE, *, host="0.0.0.0", port=8003, fixture=False, audit=N
|
|
| 183 |
sent = {key.lower() for key in headers}
|
| 184 |
headers.update({key: value for key, value in extra_headers.items() if key not in sent})
|
| 185 |
headers.update({"Content-Length": str(len(payload)), "Content-Type": "application/json"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
try:
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
if
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
while data := response.read1(65536):
|
| 196 |
self.wfile.write(data)
|
| 197 |
self.wfile.flush()
|
| 198 |
self.close_connection = True
|
| 199 |
except (OSError, http.client.HTTPException):
|
| 200 |
-
# No retry: an ambiguous upstream attempt stays ambiguous.
|
| 201 |
self.close_connection = True
|
| 202 |
finally:
|
| 203 |
-
|
| 204 |
|
| 205 |
return ThreadingHTTPServer((host, port), Handler)
|
| 206 |
|
|
|
|
| 25 |
not send; only ``anthropic-workspace-id``, ``openai-organization`` and
|
| 26 |
``openai-project`` are accepted (an unscoped Anthropic key needs the first).
|
| 27 |
|
| 28 |
+
* A streamed request whose provider is slow (more than 3 s) is answered with a 200 event
|
| 29 |
+
stream and keepalive comments until the provider responds (see ``STREAM_KEEPALIVE``):
|
| 30 |
+
Harbor's agent egress proxy otherwise drops it after ~15 s of silence.
|
| 31 |
+
|
| 32 |
No credentials are owned or stored (the caller's auth headers pass through), no
|
| 33 |
content is logged, and nothing is retried: an ambiguous upstream attempt stays
|
| 34 |
ambiguous. The file keeps its historical name; it is no longer Google-specific.
|
|
|
|
| 41 |
import ipaddress
|
| 42 |
import json
|
| 43 |
import os
|
| 44 |
+
import select
|
| 45 |
+
import socket
|
| 46 |
import threading
|
| 47 |
+
import time
|
| 48 |
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
| 49 |
from urllib.parse import urlsplit
|
| 50 |
|
|
|
|
| 84 |
return False
|
| 85 |
|
| 86 |
|
| 87 |
+
# Harbor's agent-phase egress proxy (gost, HTTP sniffing) drops a proxied connection that stays
|
| 88 |
+
# silent for ~15 s. A streamed request whose provider has not answered after STREAM_COMMIT_AFTER
|
| 89 |
+
# seconds gets a 200 event stream at once, then SSE comment lines every STREAM_KEEPALIVE seconds
|
| 90 |
+
# until the provider answers; the provider's stream is then relayed unchanged. A late provider
|
| 91 |
+
# error becomes the stream error event of that API. Fast answers (and all errors that arrive
|
| 92 |
+
# within STREAM_COMMIT_AFTER) are relayed exactly as before, status code included.
|
| 93 |
+
STREAM_COMMIT_AFTER = 3.0
|
| 94 |
+
STREAM_KEEPALIVE = 5.0
|
| 95 |
+
CLIENT_POLL = 0.5 # how often a waiting request checks that its caller is still connected
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def client_gone(sock):
|
| 99 |
+
"""True once the caller closed its connection (readable with EOF) while we wait for the provider."""
|
| 100 |
+
try:
|
| 101 |
+
readable, _, _ = select.select([sock], [], [], 0)
|
| 102 |
+
return bool(readable) and sock.recv(1, socket.MSG_PEEK) == b""
|
| 103 |
+
except OSError:
|
| 104 |
+
return True
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def stream_error(path, message, status=None):
|
| 108 |
+
"""One SSE error event in the format the API's official SDK raises on."""
|
| 109 |
+
if path == "/v1/messages":
|
| 110 |
+
body = {"type": "error", "error": {"type": "api_error", "message": message}}
|
| 111 |
+
return b"event: error\ndata: " + json.dumps(body).encode() + b"\n\n"
|
| 112 |
+
if path == "/v1/responses":
|
| 113 |
+
# Official ResponseErrorEvent fields, plus an "error" object: the Python SDK raises only on that key.
|
| 114 |
+
body = {"type": "error", "code": str(status or "upstream_error"), "message": message, "param": None,
|
| 115 |
+
"error": {"type": "upstream_error", "code": str(status or "upstream_error"), "message": message}}
|
| 116 |
+
return b"event: error\ndata: " + json.dumps(body).encode() + b"\n\n"
|
| 117 |
+
body = {"error": {"message": message, "type": "upstream_error", "code": status}}
|
| 118 |
+
return b"data: " + json.dumps(body).encode() + b"\n\n"
|
| 119 |
+
|
| 120 |
+
|
| 121 |
HOP_BY_HOP = {
|
| 122 |
"host", "content-length", "connection", "transfer-encoding", "keep-alive",
|
| 123 |
"proxy-authorization", "proxy-connection", "upgrade", "te", "trailer",
|
|
|
|
| 224 |
sent = {key.lower() for key in headers}
|
| 225 |
headers.update({key: value for key, value in extra_headers.items() if key not in sent})
|
| 226 |
headers.update({"Content-Length": str(len(payload)), "Content-Type": "application/json"})
|
| 227 |
+
# The upstream call runs in a worker so a slow streamed answer can be kept alive (see
|
| 228 |
+
# STREAM_KEEPALIVE): Harbor's agent egress proxy drops a connection that stays silent ~15 s.
|
| 229 |
+
result = {}
|
| 230 |
+
done = threading.Event()
|
| 231 |
+
|
| 232 |
+
def call():
|
| 233 |
+
try:
|
| 234 |
+
connection.request("POST", base_path + target, payload, headers)
|
| 235 |
+
result["response"] = connection.getresponse()
|
| 236 |
+
except (OSError, http.client.HTTPException) as error:
|
| 237 |
+
result["error"] = error
|
| 238 |
+
finally:
|
| 239 |
+
done.set()
|
| 240 |
+
|
| 241 |
+
def abort_upstream():
|
| 242 |
+
# Shut the socket down (not just close it) so a read blocked in the worker returns and the
|
| 243 |
+
# provider sees the disconnect and can stop a generation nobody will read.
|
| 244 |
+
sock = connection.sock
|
| 245 |
+
if sock is not None:
|
| 246 |
+
try:
|
| 247 |
+
sock.shutdown(socket.SHUT_RDWR)
|
| 248 |
+
except OSError:
|
| 249 |
+
pass
|
| 250 |
+
connection.close()
|
| 251 |
+
|
| 252 |
+
def wait_upstream(seconds=None):
|
| 253 |
+
"""Wait for the provider; False if the caller hung up first (the upstream is then aborted)."""
|
| 254 |
+
deadline = None if seconds is None else time.monotonic() + seconds
|
| 255 |
+
while not done.is_set():
|
| 256 |
+
step = CLIENT_POLL if deadline is None else min(CLIENT_POLL, deadline - time.monotonic())
|
| 257 |
+
if step <= 0:
|
| 258 |
+
return True
|
| 259 |
+
if done.wait(step):
|
| 260 |
+
break
|
| 261 |
+
if client_gone(self.connection):
|
| 262 |
+
raise ConnectionAbortedError("caller disconnected")
|
| 263 |
+
return True
|
| 264 |
+
|
| 265 |
+
threading.Thread(target=call, daemon=True).start()
|
| 266 |
try:
|
| 267 |
+
streamed = incoming.get("stream") is True
|
| 268 |
+
wait_upstream(STREAM_COMMIT_AFTER if streamed else None)
|
| 269 |
+
if done.is_set() or not streamed:
|
| 270 |
+
wait_upstream()
|
| 271 |
+
if "error" in result:
|
| 272 |
+
# No retry: an ambiguous upstream attempt stays ambiguous.
|
| 273 |
+
self.close_connection = True
|
| 274 |
+
return
|
| 275 |
+
response = result["response"]
|
| 276 |
+
self.send_response(response.status, response.reason)
|
| 277 |
+
for key, value in response.getheaders():
|
| 278 |
+
if key.lower() not in {"transfer-encoding", "connection", "keep-alive", "content-length"}:
|
| 279 |
+
self.send_header(key, value)
|
| 280 |
+
self.send_header("Connection", "close")
|
| 281 |
+
self.end_headers()
|
| 282 |
+
else:
|
| 283 |
+
# Slow streamed answer: commit an event stream now and send SSE comments (ignored
|
| 284 |
+
# by every SSE client) until the provider answers.
|
| 285 |
+
self.send_response(200)
|
| 286 |
+
self.send_header("Content-Type", "text/event-stream")
|
| 287 |
+
self.send_header("Cache-Control", "no-cache")
|
| 288 |
+
self.send_header("Connection", "close")
|
| 289 |
+
self.end_headers()
|
| 290 |
+
self.wfile.flush()
|
| 291 |
+
while not done.is_set():
|
| 292 |
+
wait_upstream(STREAM_KEEPALIVE)
|
| 293 |
+
if not done.is_set():
|
| 294 |
+
self.wfile.write(b": keepalive\n\n")
|
| 295 |
+
self.wfile.flush()
|
| 296 |
+
response = result.get("response")
|
| 297 |
+
if response is None or response.status != 200:
|
| 298 |
+
status = getattr(response, "status", None)
|
| 299 |
+
detail = response.read(4096).decode("utf-8", "replace") if response is not None else ""
|
| 300 |
+
message = (f"Upstream HTTP {status}: {detail}" if response is not None
|
| 301 |
+
else f"Upstream connection error: {type(result.get('error')).__name__}")
|
| 302 |
+
self.wfile.write(stream_error(self.path, message, status))
|
| 303 |
+
self.wfile.flush()
|
| 304 |
+
self.close_connection = True
|
| 305 |
+
return
|
| 306 |
while data := response.read1(65536):
|
| 307 |
self.wfile.write(data)
|
| 308 |
self.wfile.flush()
|
| 309 |
self.close_connection = True
|
| 310 |
except (OSError, http.client.HTTPException):
|
|
|
|
| 311 |
self.close_connection = True
|
| 312 |
finally:
|
| 313 |
+
abort_upstream()
|
| 314 |
|
| 315 |
return ThreadingHTTPServer((host, port), Handler)
|
| 316 |
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/environment/team/runtime.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"archive_sha256": "
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
@@ -12,8 +12,8 @@
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
-
"adapter/collab_harbor/generate.py": "
|
| 16 |
-
"adapter/collab_harbor/google_compat.py": "
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -100,6 +100,6 @@
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
-
"uncompressed_bytes":
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"archive_sha256": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c",
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
+
"adapter/collab_harbor/generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 16 |
+
"adapter/collab_harbor/google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
+
"uncompressed_bytes": 1475066,
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/environment/team/runtime.tar.gz
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c
|
| 3 |
+
size 393802
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/environment/team/task.json
CHANGED
|
@@ -36,7 +36,7 @@
|
|
| 36 |
"agent": {
|
| 37 |
"schema_version": 1,
|
| 38 |
"files": {
|
| 39 |
-
"Dockerfile": "
|
| 40 |
"collab_harbor/__init__.py": "7df1d3de24dc22f6cf6ca1eb14111edc949558bbca98d01a6e29a093313e073b",
|
| 41 |
"collab_harbor/cli.py": "a3ed01306b021e4784b24782e48903eb1b33edca19b8268a53fda47d75c4ce7e",
|
| 42 |
"collab_harbor/pi-bash-timeout.js": "aeba75d3703c9f1e5be548a7153c3a472cc1210931aa98ddc914310901ba689a",
|
|
@@ -45,7 +45,7 @@
|
|
| 45 |
"collab_harbor/relay.py": "70491ff1be0a428e2cfd02e70f8ee4f6ed3245a1cdb9b2d20e2b43a0684b0097",
|
| 46 |
"team": "7526f8ccae4b1f3632b960cf0d63aab7e7a81f0726bcfb62c559743898575a4a"
|
| 47 |
},
|
| 48 |
-
"sha256": "
|
| 49 |
},
|
| 50 |
"team_adapter": {
|
| 51 |
"schema_version": 1,
|
|
@@ -60,8 +60,8 @@
|
|
| 60 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 61 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 62 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 63 |
-
"generate.py": "
|
| 64 |
-
"google_compat.py": "
|
| 65 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 66 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 67 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -85,7 +85,7 @@
|
|
| 85 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 86 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 87 |
},
|
| 88 |
-
"sha256": "
|
| 89 |
},
|
| 90 |
"verifier_adapter": {
|
| 91 |
"schema_version": 1,
|
|
@@ -100,8 +100,8 @@
|
|
| 100 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 101 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 102 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 103 |
-
"generate.py": "
|
| 104 |
-
"google_compat.py": "
|
| 105 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 106 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 107 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -125,7 +125,7 @@
|
|
| 125 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 126 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 127 |
},
|
| 128 |
-
"sha256": "
|
| 129 |
},
|
| 130 |
"team_upstream": {
|
| 131 |
"schema_version": 1,
|
|
@@ -251,26 +251,26 @@
|
|
| 251 |
"schema_version": 1,
|
| 252 |
"files": {
|
| 253 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 254 |
-
"runtime.json": "
|
| 255 |
-
"runtime.tar.gz": "
|
| 256 |
},
|
| 257 |
-
"sha256": "
|
| 258 |
},
|
| 259 |
"verifier_runtime_distribution": {
|
| 260 |
"schema_version": 1,
|
| 261 |
"files": {
|
| 262 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 263 |
-
"runtime.json": "
|
| 264 |
-
"runtime.tar.gz": "
|
| 265 |
},
|
| 266 |
-
"sha256": "
|
| 267 |
},
|
| 268 |
"runtime_distribution": {
|
| 269 |
"schema_version": 1,
|
| 270 |
"files": {
|
| 271 |
-
"runtime-distribution.json": "
|
| 272 |
},
|
| 273 |
-
"sha256": "
|
| 274 |
},
|
| 275 |
"environment_policy": {
|
| 276 |
"schema_version": 1,
|
|
@@ -316,10 +316,10 @@
|
|
| 316 |
"sha256": "33b10cc4a7d760c70a490b186618d63dd730389503da1396eec47afc8b436d60"
|
| 317 |
}
|
| 318 |
},
|
| 319 |
-
"sha256": "
|
| 320 |
},
|
| 321 |
"runtime_distribution": {
|
| 322 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 323 |
-
"archive_sha256": "
|
| 324 |
}
|
| 325 |
}
|
|
|
|
| 36 |
"agent": {
|
| 37 |
"schema_version": 1,
|
| 38 |
"files": {
|
| 39 |
+
"Dockerfile": "304c4346b6339d0fdacfe2b27d19d5546028b4e5626e68bd114ad2f7fdb2d62b",
|
| 40 |
"collab_harbor/__init__.py": "7df1d3de24dc22f6cf6ca1eb14111edc949558bbca98d01a6e29a093313e073b",
|
| 41 |
"collab_harbor/cli.py": "a3ed01306b021e4784b24782e48903eb1b33edca19b8268a53fda47d75c4ce7e",
|
| 42 |
"collab_harbor/pi-bash-timeout.js": "aeba75d3703c9f1e5be548a7153c3a472cc1210931aa98ddc914310901ba689a",
|
|
|
|
| 45 |
"collab_harbor/relay.py": "70491ff1be0a428e2cfd02e70f8ee4f6ed3245a1cdb9b2d20e2b43a0684b0097",
|
| 46 |
"team": "7526f8ccae4b1f3632b960cf0d63aab7e7a81f0726bcfb62c559743898575a4a"
|
| 47 |
},
|
| 48 |
+
"sha256": "8e2fe7bbd527086c488b171ca41691b7104cd69f136a99b619cd89b73acc1f9f"
|
| 49 |
},
|
| 50 |
"team_adapter": {
|
| 51 |
"schema_version": 1,
|
|
|
|
| 60 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 61 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 62 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 63 |
+
"generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 64 |
+
"google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 65 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 66 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 67 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 85 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 86 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 87 |
},
|
| 88 |
+
"sha256": "8d1ce359662da6b61c83d91dddb6e465507db4884dc57815125d9446d280bb30"
|
| 89 |
},
|
| 90 |
"verifier_adapter": {
|
| 91 |
"schema_version": 1,
|
|
|
|
| 100 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 101 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 102 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 103 |
+
"generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 104 |
+
"google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 105 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 106 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 107 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 125 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 126 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 127 |
},
|
| 128 |
+
"sha256": "8d1ce359662da6b61c83d91dddb6e465507db4884dc57815125d9446d280bb30"
|
| 129 |
},
|
| 130 |
"team_upstream": {
|
| 131 |
"schema_version": 1,
|
|
|
|
| 251 |
"schema_version": 1,
|
| 252 |
"files": {
|
| 253 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 254 |
+
"runtime.json": "e251e5f2de6505f9bdcdabd148c2be096cd8a9bd24a49fb6e7dd602baf0cdeb5",
|
| 255 |
+
"runtime.tar.gz": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c"
|
| 256 |
},
|
| 257 |
+
"sha256": "afd411b152dee0b7a83eeb4e5440d3a541834b555047f1e5591083550888517b"
|
| 258 |
},
|
| 259 |
"verifier_runtime_distribution": {
|
| 260 |
"schema_version": 1,
|
| 261 |
"files": {
|
| 262 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 263 |
+
"runtime.json": "e251e5f2de6505f9bdcdabd148c2be096cd8a9bd24a49fb6e7dd602baf0cdeb5",
|
| 264 |
+
"runtime.tar.gz": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c"
|
| 265 |
},
|
| 266 |
+
"sha256": "afd411b152dee0b7a83eeb4e5440d3a541834b555047f1e5591083550888517b"
|
| 267 |
},
|
| 268 |
"runtime_distribution": {
|
| 269 |
"schema_version": 1,
|
| 270 |
"files": {
|
| 271 |
+
"runtime-distribution.json": "188133f05f8cfb3648ef334187adb4b5290d9902c2ae8d9d337c9ccd8b822494"
|
| 272 |
},
|
| 273 |
+
"sha256": "b1997306709c2737610eb9d9b0e9a9a01a106dcc84e98cc353fcb3da08f7ad5c"
|
| 274 |
},
|
| 275 |
"environment_policy": {
|
| 276 |
"schema_version": 1,
|
|
|
|
| 316 |
"sha256": "33b10cc4a7d760c70a490b186618d63dd730389503da1396eec47afc8b436d60"
|
| 317 |
}
|
| 318 |
},
|
| 319 |
+
"sha256": "4a68ca4136a53db26f628af129967048c4ab8749649c61a31ef781e15ed00188"
|
| 320 |
},
|
| 321 |
"runtime_distribution": {
|
| 322 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 323 |
+
"archive_sha256": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c"
|
| 324 |
}
|
| 325 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/tests/runtime.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"archive_sha256": "
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
@@ -12,8 +12,8 @@
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
-
"adapter/collab_harbor/generate.py": "
|
| 16 |
-
"adapter/collab_harbor/google_compat.py": "
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -100,6 +100,6 @@
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
-
"uncompressed_bytes":
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"archive_sha256": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c",
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
+
"adapter/collab_harbor/generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 16 |
+
"adapter/collab_harbor/google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
+
"uncompressed_bytes": 1475066,
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s0/tests/runtime.tar.gz
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c
|
| 3 |
+
size 393802
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/environment/Dockerfile
CHANGED
|
@@ -8,6 +8,7 @@ ENV CI_PI_PROVIDER_PRIVATE_AUDIT=/logs/agent/pi/provider-private.jsonl
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
|
|
|
| 11 |
|
| 12 |
RUN chmod 755 /usr/local/bin/team
|
| 13 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
|
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
| 11 |
+
ENV CI_PI_BASH_TIMEOUT_SEC=120
|
| 12 |
|
| 13 |
RUN chmod 755 /usr/local/bin/team
|
| 14 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/environment/agent/Dockerfile
CHANGED
|
@@ -8,6 +8,7 @@ ENV CI_PI_PROVIDER_PRIVATE_AUDIT=/logs/agent/pi/provider-private.jsonl
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
|
|
|
| 11 |
|
| 12 |
RUN chmod 755 /usr/local/bin/team
|
| 13 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
|
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
| 11 |
+
ENV CI_PI_BASH_TIMEOUT_SEC=120
|
| 12 |
|
| 13 |
RUN chmod 755 /usr/local/bin/team
|
| 14 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/environment/model-compat/compatibility.json
CHANGED
|
@@ -17,5 +17,5 @@
|
|
| 17 |
"model-compat"
|
| 18 |
],
|
| 19 |
"agent_main_explicit_networks": false,
|
| 20 |
-
"source_sha256": "
|
| 21 |
}
|
|
|
|
| 17 |
"model-compat"
|
| 18 |
],
|
| 19 |
"agent_main_explicit_networks": false,
|
| 20 |
+
"source_sha256": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa"
|
| 21 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/environment/model-compat/google_compat.py
CHANGED
|
@@ -25,6 +25,10 @@ unchanged except as noted, to one configured upstream:
|
|
| 25 |
not send; only ``anthropic-workspace-id``, ``openai-organization`` and
|
| 26 |
``openai-project`` are accepted (an unscoped Anthropic key needs the first).
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
No credentials are owned or stored (the caller's auth headers pass through), no
|
| 29 |
content is logged, and nothing is retried: an ambiguous upstream attempt stays
|
| 30 |
ambiguous. The file keeps its historical name; it is no longer Google-specific.
|
|
@@ -37,7 +41,10 @@ import http.client
|
|
| 37 |
import ipaddress
|
| 38 |
import json
|
| 39 |
import os
|
|
|
|
|
|
|
| 40 |
import threading
|
|
|
|
| 41 |
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
| 42 |
from urllib.parse import urlsplit
|
| 43 |
|
|
@@ -77,6 +84,40 @@ def remote_reference(value):
|
|
| 77 |
return False
|
| 78 |
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
HOP_BY_HOP = {
|
| 81 |
"host", "content-length", "connection", "transfer-encoding", "keep-alive",
|
| 82 |
"proxy-authorization", "proxy-connection", "upgrade", "te", "trailer",
|
|
@@ -183,24 +224,93 @@ def server(upstream=GOOGLE, *, host="0.0.0.0", port=8003, fixture=False, audit=N
|
|
| 183 |
sent = {key.lower() for key in headers}
|
| 184 |
headers.update({key: value for key, value in extra_headers.items() if key not in sent})
|
| 185 |
headers.update({"Content-Length": str(len(payload)), "Content-Type": "application/json"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
try:
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
if
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
while data := response.read1(65536):
|
| 196 |
self.wfile.write(data)
|
| 197 |
self.wfile.flush()
|
| 198 |
self.close_connection = True
|
| 199 |
except (OSError, http.client.HTTPException):
|
| 200 |
-
# No retry: an ambiguous upstream attempt stays ambiguous.
|
| 201 |
self.close_connection = True
|
| 202 |
finally:
|
| 203 |
-
|
| 204 |
|
| 205 |
return ThreadingHTTPServer((host, port), Handler)
|
| 206 |
|
|
|
|
| 25 |
not send; only ``anthropic-workspace-id``, ``openai-organization`` and
|
| 26 |
``openai-project`` are accepted (an unscoped Anthropic key needs the first).
|
| 27 |
|
| 28 |
+
* A streamed request whose provider is slow (more than 3 s) is answered with a 200 event
|
| 29 |
+
stream and keepalive comments until the provider responds (see ``STREAM_KEEPALIVE``):
|
| 30 |
+
Harbor's agent egress proxy otherwise drops it after ~15 s of silence.
|
| 31 |
+
|
| 32 |
No credentials are owned or stored (the caller's auth headers pass through), no
|
| 33 |
content is logged, and nothing is retried: an ambiguous upstream attempt stays
|
| 34 |
ambiguous. The file keeps its historical name; it is no longer Google-specific.
|
|
|
|
| 41 |
import ipaddress
|
| 42 |
import json
|
| 43 |
import os
|
| 44 |
+
import select
|
| 45 |
+
import socket
|
| 46 |
import threading
|
| 47 |
+
import time
|
| 48 |
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
| 49 |
from urllib.parse import urlsplit
|
| 50 |
|
|
|
|
| 84 |
return False
|
| 85 |
|
| 86 |
|
| 87 |
+
# Harbor's agent-phase egress proxy (gost, HTTP sniffing) drops a proxied connection that stays
|
| 88 |
+
# silent for ~15 s. A streamed request whose provider has not answered after STREAM_COMMIT_AFTER
|
| 89 |
+
# seconds gets a 200 event stream at once, then SSE comment lines every STREAM_KEEPALIVE seconds
|
| 90 |
+
# until the provider answers; the provider's stream is then relayed unchanged. A late provider
|
| 91 |
+
# error becomes the stream error event of that API. Fast answers (and all errors that arrive
|
| 92 |
+
# within STREAM_COMMIT_AFTER) are relayed exactly as before, status code included.
|
| 93 |
+
STREAM_COMMIT_AFTER = 3.0
|
| 94 |
+
STREAM_KEEPALIVE = 5.0
|
| 95 |
+
CLIENT_POLL = 0.5 # how often a waiting request checks that its caller is still connected
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def client_gone(sock):
|
| 99 |
+
"""True once the caller closed its connection (readable with EOF) while we wait for the provider."""
|
| 100 |
+
try:
|
| 101 |
+
readable, _, _ = select.select([sock], [], [], 0)
|
| 102 |
+
return bool(readable) and sock.recv(1, socket.MSG_PEEK) == b""
|
| 103 |
+
except OSError:
|
| 104 |
+
return True
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def stream_error(path, message, status=None):
|
| 108 |
+
"""One SSE error event in the format the API's official SDK raises on."""
|
| 109 |
+
if path == "/v1/messages":
|
| 110 |
+
body = {"type": "error", "error": {"type": "api_error", "message": message}}
|
| 111 |
+
return b"event: error\ndata: " + json.dumps(body).encode() + b"\n\n"
|
| 112 |
+
if path == "/v1/responses":
|
| 113 |
+
# Official ResponseErrorEvent fields, plus an "error" object: the Python SDK raises only on that key.
|
| 114 |
+
body = {"type": "error", "code": str(status or "upstream_error"), "message": message, "param": None,
|
| 115 |
+
"error": {"type": "upstream_error", "code": str(status or "upstream_error"), "message": message}}
|
| 116 |
+
return b"event: error\ndata: " + json.dumps(body).encode() + b"\n\n"
|
| 117 |
+
body = {"error": {"message": message, "type": "upstream_error", "code": status}}
|
| 118 |
+
return b"data: " + json.dumps(body).encode() + b"\n\n"
|
| 119 |
+
|
| 120 |
+
|
| 121 |
HOP_BY_HOP = {
|
| 122 |
"host", "content-length", "connection", "transfer-encoding", "keep-alive",
|
| 123 |
"proxy-authorization", "proxy-connection", "upgrade", "te", "trailer",
|
|
|
|
| 224 |
sent = {key.lower() for key in headers}
|
| 225 |
headers.update({key: value for key, value in extra_headers.items() if key not in sent})
|
| 226 |
headers.update({"Content-Length": str(len(payload)), "Content-Type": "application/json"})
|
| 227 |
+
# The upstream call runs in a worker so a slow streamed answer can be kept alive (see
|
| 228 |
+
# STREAM_KEEPALIVE): Harbor's agent egress proxy drops a connection that stays silent ~15 s.
|
| 229 |
+
result = {}
|
| 230 |
+
done = threading.Event()
|
| 231 |
+
|
| 232 |
+
def call():
|
| 233 |
+
try:
|
| 234 |
+
connection.request("POST", base_path + target, payload, headers)
|
| 235 |
+
result["response"] = connection.getresponse()
|
| 236 |
+
except (OSError, http.client.HTTPException) as error:
|
| 237 |
+
result["error"] = error
|
| 238 |
+
finally:
|
| 239 |
+
done.set()
|
| 240 |
+
|
| 241 |
+
def abort_upstream():
|
| 242 |
+
# Shut the socket down (not just close it) so a read blocked in the worker returns and the
|
| 243 |
+
# provider sees the disconnect and can stop a generation nobody will read.
|
| 244 |
+
sock = connection.sock
|
| 245 |
+
if sock is not None:
|
| 246 |
+
try:
|
| 247 |
+
sock.shutdown(socket.SHUT_RDWR)
|
| 248 |
+
except OSError:
|
| 249 |
+
pass
|
| 250 |
+
connection.close()
|
| 251 |
+
|
| 252 |
+
def wait_upstream(seconds=None):
|
| 253 |
+
"""Wait for the provider; False if the caller hung up first (the upstream is then aborted)."""
|
| 254 |
+
deadline = None if seconds is None else time.monotonic() + seconds
|
| 255 |
+
while not done.is_set():
|
| 256 |
+
step = CLIENT_POLL if deadline is None else min(CLIENT_POLL, deadline - time.monotonic())
|
| 257 |
+
if step <= 0:
|
| 258 |
+
return True
|
| 259 |
+
if done.wait(step):
|
| 260 |
+
break
|
| 261 |
+
if client_gone(self.connection):
|
| 262 |
+
raise ConnectionAbortedError("caller disconnected")
|
| 263 |
+
return True
|
| 264 |
+
|
| 265 |
+
threading.Thread(target=call, daemon=True).start()
|
| 266 |
try:
|
| 267 |
+
streamed = incoming.get("stream") is True
|
| 268 |
+
wait_upstream(STREAM_COMMIT_AFTER if streamed else None)
|
| 269 |
+
if done.is_set() or not streamed:
|
| 270 |
+
wait_upstream()
|
| 271 |
+
if "error" in result:
|
| 272 |
+
# No retry: an ambiguous upstream attempt stays ambiguous.
|
| 273 |
+
self.close_connection = True
|
| 274 |
+
return
|
| 275 |
+
response = result["response"]
|
| 276 |
+
self.send_response(response.status, response.reason)
|
| 277 |
+
for key, value in response.getheaders():
|
| 278 |
+
if key.lower() not in {"transfer-encoding", "connection", "keep-alive", "content-length"}:
|
| 279 |
+
self.send_header(key, value)
|
| 280 |
+
self.send_header("Connection", "close")
|
| 281 |
+
self.end_headers()
|
| 282 |
+
else:
|
| 283 |
+
# Slow streamed answer: commit an event stream now and send SSE comments (ignored
|
| 284 |
+
# by every SSE client) until the provider answers.
|
| 285 |
+
self.send_response(200)
|
| 286 |
+
self.send_header("Content-Type", "text/event-stream")
|
| 287 |
+
self.send_header("Cache-Control", "no-cache")
|
| 288 |
+
self.send_header("Connection", "close")
|
| 289 |
+
self.end_headers()
|
| 290 |
+
self.wfile.flush()
|
| 291 |
+
while not done.is_set():
|
| 292 |
+
wait_upstream(STREAM_KEEPALIVE)
|
| 293 |
+
if not done.is_set():
|
| 294 |
+
self.wfile.write(b": keepalive\n\n")
|
| 295 |
+
self.wfile.flush()
|
| 296 |
+
response = result.get("response")
|
| 297 |
+
if response is None or response.status != 200:
|
| 298 |
+
status = getattr(response, "status", None)
|
| 299 |
+
detail = response.read(4096).decode("utf-8", "replace") if response is not None else ""
|
| 300 |
+
message = (f"Upstream HTTP {status}: {detail}" if response is not None
|
| 301 |
+
else f"Upstream connection error: {type(result.get('error')).__name__}")
|
| 302 |
+
self.wfile.write(stream_error(self.path, message, status))
|
| 303 |
+
self.wfile.flush()
|
| 304 |
+
self.close_connection = True
|
| 305 |
+
return
|
| 306 |
while data := response.read1(65536):
|
| 307 |
self.wfile.write(data)
|
| 308 |
self.wfile.flush()
|
| 309 |
self.close_connection = True
|
| 310 |
except (OSError, http.client.HTTPException):
|
|
|
|
| 311 |
self.close_connection = True
|
| 312 |
finally:
|
| 313 |
+
abort_upstream()
|
| 314 |
|
| 315 |
return ThreadingHTTPServer((host, port), Handler)
|
| 316 |
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/environment/team/runtime.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"archive_sha256": "
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
@@ -12,8 +12,8 @@
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
-
"adapter/collab_harbor/generate.py": "
|
| 16 |
-
"adapter/collab_harbor/google_compat.py": "
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -100,6 +100,6 @@
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
-
"uncompressed_bytes":
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"archive_sha256": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c",
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
+
"adapter/collab_harbor/generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 16 |
+
"adapter/collab_harbor/google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
+
"uncompressed_bytes": 1475066,
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/environment/team/runtime.tar.gz
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c
|
| 3 |
+
size 393802
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/environment/team/task.json
CHANGED
|
@@ -36,7 +36,7 @@
|
|
| 36 |
"agent": {
|
| 37 |
"schema_version": 1,
|
| 38 |
"files": {
|
| 39 |
-
"Dockerfile": "
|
| 40 |
"collab_harbor/__init__.py": "7df1d3de24dc22f6cf6ca1eb14111edc949558bbca98d01a6e29a093313e073b",
|
| 41 |
"collab_harbor/cli.py": "a3ed01306b021e4784b24782e48903eb1b33edca19b8268a53fda47d75c4ce7e",
|
| 42 |
"collab_harbor/pi-bash-timeout.js": "aeba75d3703c9f1e5be548a7153c3a472cc1210931aa98ddc914310901ba689a",
|
|
@@ -45,7 +45,7 @@
|
|
| 45 |
"collab_harbor/relay.py": "70491ff1be0a428e2cfd02e70f8ee4f6ed3245a1cdb9b2d20e2b43a0684b0097",
|
| 46 |
"team": "7526f8ccae4b1f3632b960cf0d63aab7e7a81f0726bcfb62c559743898575a4a"
|
| 47 |
},
|
| 48 |
-
"sha256": "
|
| 49 |
},
|
| 50 |
"team_adapter": {
|
| 51 |
"schema_version": 1,
|
|
@@ -60,8 +60,8 @@
|
|
| 60 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 61 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 62 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 63 |
-
"generate.py": "
|
| 64 |
-
"google_compat.py": "
|
| 65 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 66 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 67 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -85,7 +85,7 @@
|
|
| 85 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 86 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 87 |
},
|
| 88 |
-
"sha256": "
|
| 89 |
},
|
| 90 |
"verifier_adapter": {
|
| 91 |
"schema_version": 1,
|
|
@@ -100,8 +100,8 @@
|
|
| 100 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 101 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 102 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 103 |
-
"generate.py": "
|
| 104 |
-
"google_compat.py": "
|
| 105 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 106 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 107 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -125,7 +125,7 @@
|
|
| 125 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 126 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 127 |
},
|
| 128 |
-
"sha256": "
|
| 129 |
},
|
| 130 |
"team_upstream": {
|
| 131 |
"schema_version": 1,
|
|
@@ -251,26 +251,26 @@
|
|
| 251 |
"schema_version": 1,
|
| 252 |
"files": {
|
| 253 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 254 |
-
"runtime.json": "
|
| 255 |
-
"runtime.tar.gz": "
|
| 256 |
},
|
| 257 |
-
"sha256": "
|
| 258 |
},
|
| 259 |
"verifier_runtime_distribution": {
|
| 260 |
"schema_version": 1,
|
| 261 |
"files": {
|
| 262 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 263 |
-
"runtime.json": "
|
| 264 |
-
"runtime.tar.gz": "
|
| 265 |
},
|
| 266 |
-
"sha256": "
|
| 267 |
},
|
| 268 |
"runtime_distribution": {
|
| 269 |
"schema_version": 1,
|
| 270 |
"files": {
|
| 271 |
-
"runtime-distribution.json": "
|
| 272 |
},
|
| 273 |
-
"sha256": "
|
| 274 |
},
|
| 275 |
"environment_policy": {
|
| 276 |
"schema_version": 1,
|
|
@@ -316,10 +316,10 @@
|
|
| 316 |
"sha256": "33b10cc4a7d760c70a490b186618d63dd730389503da1396eec47afc8b436d60"
|
| 317 |
}
|
| 318 |
},
|
| 319 |
-
"sha256": "
|
| 320 |
},
|
| 321 |
"runtime_distribution": {
|
| 322 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 323 |
-
"archive_sha256": "
|
| 324 |
}
|
| 325 |
}
|
|
|
|
| 36 |
"agent": {
|
| 37 |
"schema_version": 1,
|
| 38 |
"files": {
|
| 39 |
+
"Dockerfile": "304c4346b6339d0fdacfe2b27d19d5546028b4e5626e68bd114ad2f7fdb2d62b",
|
| 40 |
"collab_harbor/__init__.py": "7df1d3de24dc22f6cf6ca1eb14111edc949558bbca98d01a6e29a093313e073b",
|
| 41 |
"collab_harbor/cli.py": "a3ed01306b021e4784b24782e48903eb1b33edca19b8268a53fda47d75c4ce7e",
|
| 42 |
"collab_harbor/pi-bash-timeout.js": "aeba75d3703c9f1e5be548a7153c3a472cc1210931aa98ddc914310901ba689a",
|
|
|
|
| 45 |
"collab_harbor/relay.py": "70491ff1be0a428e2cfd02e70f8ee4f6ed3245a1cdb9b2d20e2b43a0684b0097",
|
| 46 |
"team": "7526f8ccae4b1f3632b960cf0d63aab7e7a81f0726bcfb62c559743898575a4a"
|
| 47 |
},
|
| 48 |
+
"sha256": "8e2fe7bbd527086c488b171ca41691b7104cd69f136a99b619cd89b73acc1f9f"
|
| 49 |
},
|
| 50 |
"team_adapter": {
|
| 51 |
"schema_version": 1,
|
|
|
|
| 60 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 61 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 62 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 63 |
+
"generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 64 |
+
"google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 65 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 66 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 67 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 85 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 86 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 87 |
},
|
| 88 |
+
"sha256": "8d1ce359662da6b61c83d91dddb6e465507db4884dc57815125d9446d280bb30"
|
| 89 |
},
|
| 90 |
"verifier_adapter": {
|
| 91 |
"schema_version": 1,
|
|
|
|
| 100 |
"dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 101 |
"export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 102 |
"file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 103 |
+
"generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 104 |
+
"google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 105 |
"google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 106 |
"grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 107 |
"live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 125 |
"vendor.py": "ae5ac88b824bb4775c0ce278f4003f3a036def9d5049caf27290ff0d52b71e51",
|
| 126 |
"workspace_evidence.py": "b1abf1b142440c9e213668c8feb690b89446777de8de12d51fb7e9479e3ee8d8"
|
| 127 |
},
|
| 128 |
+
"sha256": "8d1ce359662da6b61c83d91dddb6e465507db4884dc57815125d9446d280bb30"
|
| 129 |
},
|
| 130 |
"team_upstream": {
|
| 131 |
"schema_version": 1,
|
|
|
|
| 251 |
"schema_version": 1,
|
| 252 |
"files": {
|
| 253 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 254 |
+
"runtime.json": "e251e5f2de6505f9bdcdabd148c2be096cd8a9bd24a49fb6e7dd602baf0cdeb5",
|
| 255 |
+
"runtime.tar.gz": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c"
|
| 256 |
},
|
| 257 |
+
"sha256": "afd411b152dee0b7a83eeb4e5440d3a541834b555047f1e5591083550888517b"
|
| 258 |
},
|
| 259 |
"verifier_runtime_distribution": {
|
| 260 |
"schema_version": 1,
|
| 261 |
"files": {
|
| 262 |
"runtime-unpack.py": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0",
|
| 263 |
+
"runtime.json": "e251e5f2de6505f9bdcdabd148c2be096cd8a9bd24a49fb6e7dd602baf0cdeb5",
|
| 264 |
+
"runtime.tar.gz": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c"
|
| 265 |
},
|
| 266 |
+
"sha256": "afd411b152dee0b7a83eeb4e5440d3a541834b555047f1e5591083550888517b"
|
| 267 |
},
|
| 268 |
"runtime_distribution": {
|
| 269 |
"schema_version": 1,
|
| 270 |
"files": {
|
| 271 |
+
"runtime-distribution.json": "188133f05f8cfb3648ef334187adb4b5290d9902c2ae8d9d337c9ccd8b822494"
|
| 272 |
},
|
| 273 |
+
"sha256": "b1997306709c2737610eb9d9b0e9a9a01a106dcc84e98cc353fcb3da08f7ad5c"
|
| 274 |
},
|
| 275 |
"environment_policy": {
|
| 276 |
"schema_version": 1,
|
|
|
|
| 316 |
"sha256": "33b10cc4a7d760c70a490b186618d63dd730389503da1396eec47afc8b436d60"
|
| 317 |
}
|
| 318 |
},
|
| 319 |
+
"sha256": "8b9a930a36d60e9ddfe11e3356c2598abef0d6072003879334b76245f8337283"
|
| 320 |
},
|
| 321 |
"runtime_distribution": {
|
| 322 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 323 |
+
"archive_sha256": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c"
|
| 324 |
}
|
| 325 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/tests/runtime.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"archive_sha256": "
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
@@ -12,8 +12,8 @@
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
-
"adapter/collab_harbor/generate.py": "
|
| 16 |
-
"adapter/collab_harbor/google_compat.py": "
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
@@ -100,6 +100,6 @@
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
-
"uncompressed_bytes":
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"archive_sha256": "97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c",
|
| 3 |
"files": {
|
| 4 |
"adapter/collab_harbor/LICENSE.adapter": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4",
|
| 5 |
"adapter/collab_harbor/__init__.py": "3b4ee476f940b1d71ce30ea8024133a316db9def990e4050c258c994a34b968e",
|
|
|
|
| 12 |
"adapter/collab_harbor/dimension_generate.py": "12623dea26c05f797a6bff71637a448054f9eceec15f13a85ba73ea3c739e6d1",
|
| 13 |
"adapter/collab_harbor/export.py": "a8c9feb1a8e66d473fd871edc83753a779d1951f7dd3525a2bce9550f4739726",
|
| 14 |
"adapter/collab_harbor/file_integrity.py": "2d3d87971c12dce95ecc1747cd365dccdda37331d19296a0e6d011b0f51cf4e0",
|
| 15 |
+
"adapter/collab_harbor/generate.py": "ed398645eea4ac258c4ba1cf470d918eb9e460196ba2bd082ab0f449fe4dde7d",
|
| 16 |
+
"adapter/collab_harbor/google_compat.py": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa",
|
| 17 |
"adapter/collab_harbor/google_compat_task.py": "8b48e61b1eafd878e41b57f63c04735381b375fdd9e532a15f5e9e395ac6884c",
|
| 18 |
"adapter/collab_harbor/grade.py": "e9852a96db808d41c0d1ab16ac98d54c5c5e17cd75c94ba8c53c81ba76eaf9f2",
|
| 19 |
"adapter/collab_harbor/live_reader_gate.py": "7c7daf586ed0735d18a724886bd450e42cf3f619afcd88dc69189ba9298145c7",
|
|
|
|
| 100 |
},
|
| 101 |
"format": "ci-private-runtime-tar-gzip-v1",
|
| 102 |
"schema_version": 1,
|
| 103 |
+
"uncompressed_bytes": 1475066,
|
| 104 |
"unpacker_sha256": "55afb6f2af4a81089f57643fc8eb46ba355925a73abaedc91c7670010094ada0"
|
| 105 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s1/tests/runtime.tar.gz
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:97572dbafa572d3cac3799bb47f6cf2e6beccc1460608063794ec0b3b4f1ad9c
|
| 3 |
+
size 393802
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s2/environment/Dockerfile
CHANGED
|
@@ -8,6 +8,7 @@ ENV CI_PI_PROVIDER_PRIVATE_AUDIT=/logs/agent/pi/provider-private.jsonl
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
|
|
|
| 11 |
|
| 12 |
RUN chmod 755 /usr/local/bin/team
|
| 13 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
|
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
| 11 |
+
ENV CI_PI_BASH_TIMEOUT_SEC=120
|
| 12 |
|
| 13 |
RUN chmod 755 /usr/local/bin/team
|
| 14 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s2/environment/agent/Dockerfile
CHANGED
|
@@ -8,6 +8,7 @@ ENV CI_PI_PROVIDER_PRIVATE_AUDIT=/logs/agent/pi/provider-private.jsonl
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
|
|
|
| 11 |
|
| 12 |
RUN chmod 755 /usr/local/bin/team
|
| 13 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
|
|
|
| 8 |
ENV CI_PI_RESTORED_COMPLETED_TURNS=0
|
| 9 |
|
| 10 |
COPY collab_harbor/pi-bash-timeout.js /tmp/harbor-pi-agent/extensions/z-local-bash-timeout.js
|
| 11 |
+
ENV CI_PI_BASH_TIMEOUT_SEC=120
|
| 12 |
|
| 13 |
RUN chmod 755 /usr/local/bin/team
|
| 14 |
ENV PYTHONPATH=/app TEAM_URL=http://team:8000
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s2/environment/model-compat/compatibility.json
CHANGED
|
@@ -17,5 +17,5 @@
|
|
| 17 |
"model-compat"
|
| 18 |
],
|
| 19 |
"agent_main_explicit_networks": false,
|
| 20 |
-
"source_sha256": "
|
| 21 |
}
|
|
|
|
| 17 |
"model-compat"
|
| 18 |
],
|
| 19 |
"agent_main_explicit_networks": false,
|
| 20 |
+
"source_sha256": "1a7c8a54d504236a447ad12050aa7f753e8dbf26f8515ba72684c63c8d46eafa"
|
| 21 |
}
|
tasks/ci-keeping-the-team-on-track-h-l-db-restore-source-test-s2/environment/model-compat/google_compat.py
CHANGED
|
@@ -25,6 +25,10 @@ unchanged except as noted, to one configured upstream:
|
|
| 25 |
not send; only ``anthropic-workspace-id``, ``openai-organization`` and
|
| 26 |
``openai-project`` are accepted (an unscoped Anthropic key needs the first).
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
No credentials are owned or stored (the caller's auth headers pass through), no
|
| 29 |
content is logged, and nothing is retried: an ambiguous upstream attempt stays
|
| 30 |
ambiguous. The file keeps its historical name; it is no longer Google-specific.
|
|
@@ -37,7 +41,10 @@ import http.client
|
|
| 37 |
import ipaddress
|
| 38 |
import json
|
| 39 |
import os
|
|
|
|
|
|
|
| 40 |
import threading
|
|
|
|
| 41 |
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
| 42 |
from urllib.parse import urlsplit
|
| 43 |
|
|
@@ -77,6 +84,40 @@ def remote_reference(value):
|
|
| 77 |
return False
|
| 78 |
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
HOP_BY_HOP = {
|
| 81 |
"host", "content-length", "connection", "transfer-encoding", "keep-alive",
|
| 82 |
"proxy-authorization", "proxy-connection", "upgrade", "te", "trailer",
|
|
@@ -183,24 +224,93 @@ def server(upstream=GOOGLE, *, host="0.0.0.0", port=8003, fixture=False, audit=N
|
|
| 183 |
sent = {key.lower() for key in headers}
|
| 184 |
headers.update({key: value for key, value in extra_headers.items() if key not in sent})
|
| 185 |
headers.update({"Content-Length": str(len(payload)), "Content-Type": "application/json"})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
try:
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
if
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
while data := response.read1(65536):
|
| 196 |
self.wfile.write(data)
|
| 197 |
self.wfile.flush()
|
| 198 |
self.close_connection = True
|
| 199 |
except (OSError, http.client.HTTPException):
|
| 200 |
-
# No retry: an ambiguous upstream attempt stays ambiguous.
|
| 201 |
self.close_connection = True
|
| 202 |
finally:
|
| 203 |
-
|
| 204 |
|
| 205 |
return ThreadingHTTPServer((host, port), Handler)
|
| 206 |
|
|
|
|
| 25 |
not send; only ``anthropic-workspace-id``, ``openai-organization`` and
|
| 26 |
``openai-project`` are accepted (an unscoped Anthropic key needs the first).
|
| 27 |
|
| 28 |
+
* A streamed request whose provider is slow (more than 3 s) is answered with a 200 event
|
| 29 |
+
stream and keepalive comments until the provider responds (see ``STREAM_KEEPALIVE``):
|
| 30 |
+
Harbor's agent egress proxy otherwise drops it after ~15 s of silence.
|
| 31 |
+
|
| 32 |
No credentials are owned or stored (the caller's auth headers pass through), no
|
| 33 |
content is logged, and nothing is retried: an ambiguous upstream attempt stays
|
| 34 |
ambiguous. The file keeps its historical name; it is no longer Google-specific.
|
|
|
|
| 41 |
import ipaddress
|
| 42 |
import json
|
| 43 |
import os
|
| 44 |
+
import select
|
| 45 |
+
import socket
|
| 46 |
import threading
|
| 47 |
+
import time
|
| 48 |
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
| 49 |
from urllib.parse import urlsplit
|
| 50 |
|
|
|
|
| 84 |
return False
|
| 85 |
|
| 86 |
|
| 87 |
+
# Harbor's agent-phase egress proxy (gost, HTTP sniffing) drops a proxied connection that stays
|
| 88 |
+
# silent for ~15 s. A streamed request whose provider has not answered after STREAM_COMMIT_AFTER
|
| 89 |
+
# seconds gets a 200 event stream at once, then SSE comment lines every STREAM_KEEPALIVE seconds
|
| 90 |
+
# until the provider answers; the provider's stream is then relayed unchanged. A late provider
|
| 91 |
+
# error becomes the stream error event of that API. Fast answers (and all errors that arrive
|
| 92 |
+
# within STREAM_COMMIT_AFTER) are relayed exactly as before, status code included.
|
| 93 |
+
STREAM_COMMIT_AFTER = 3.0
|
| 94 |
+
STREAM_KEEPALIVE = 5.0
|
| 95 |
+
CLIENT_POLL = 0.5 # how often a waiting request checks that its caller is still connected
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def client_gone(sock):
|
| 99 |
+
"""True once the caller closed its connection (readable with EOF) while we wait for the provider."""
|
| 100 |
+
try:
|
| 101 |
+
readable, _, _ = select.select([sock], [], [], 0)
|
| 102 |
+
return bool(readable) and sock.recv(1, socket.MSG_PEEK) == b""
|
| 103 |
+
except OSError:
|
| 104 |
+
return True
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def stream_error(path, message, status=None):
|
| 108 |
+
"""One SSE error event in the format the API's official SDK raises on."""
|
| 109 |
+
if path == "/v1/messages":
|
| 110 |
+
body = {"type": "error", "error": {"type": "api_error", "message": message}}
|
| 111 |
+
return b"event: error\ndata: " + json.dumps(body).encode() + b"\n\n"
|
| 112 |
+
if path == "/v1/responses":
|
| 113 |
+
# Official ResponseErrorEvent fields, plus an "error" object: the Python SDK raises only on that key.
|
| 114 |
+
body = {"type": "error", "code": str(status or "upstream_error"), "message": message, "param": None,
|
| 115 |
+
"error": {"type": "upstream_error", "code": str(status or "upstream_error"), "message": message}}
|
| 116 |
+
return b"event: error\ndata: " + json.dumps(body).encode() + b"\n\n"
|
| 117 |
+
body = {"error": {"message": message, "type": "upstream_error", "code": status}}
|
| 118 |
+
return b"data: " + json.dumps(body).encode() + b"\n\n"
|
| 119 |
+
|
| 120 |
+
|
| 121 |
HOP_BY_HOP = {
|
| 122 |
"host", "content-length", "connection", "transfer-encoding", "keep-alive",
|
| 123 |
"proxy-authorization", "proxy-connection", "upgrade", "te", "trailer",
|
|
|
|
| 224 |
sent = {key.lower() for key in headers}
|
| 225 |
headers.update({key: value for key, value in extra_headers.items() if key not in sent})
|
| 226 |
headers.update({"Content-Length": str(len(payload)), "Content-Type": "application/json"})
|
| 227 |
+
# The upstream call runs in a worker so a slow streamed answer can be kept alive (see
|
| 228 |
+
# STREAM_KEEPALIVE): Harbor's agent egress proxy drops a connection that stays silent ~15 s.
|
| 229 |
+
result = {}
|
| 230 |
+
done = threading.Event()
|
| 231 |
+
|
| 232 |
+
def call():
|
| 233 |
+
try:
|
| 234 |
+
connection.request("POST", base_path + target, payload, headers)
|
| 235 |
+
result["response"] = connection.getresponse()
|
| 236 |
+
except (OSError, http.client.HTTPException) as error:
|
| 237 |
+
result["error"] = error
|
| 238 |
+
finally:
|
| 239 |
+
done.set()
|
| 240 |
+
|
| 241 |
+
def abort_upstream():
|
| 242 |
+
# Shut the socket down (not just close it) so a read blocked in the worker returns and the
|
| 243 |
+
# provider sees the disconnect and can stop a generation nobody will read.
|
| 244 |
+
sock = connection.sock
|
| 245 |
+
if sock is not None:
|
| 246 |
+
try:
|
| 247 |
+
sock.shutdown(socket.SHUT_RDWR)
|
| 248 |
+
except OSError:
|
| 249 |
+
pass
|
| 250 |
+
connection.close()
|
| 251 |
+
|
| 252 |
+
def wait_upstream(seconds=None):
|
| 253 |
+
"""Wait for the provider; False if the caller hung up first (the upstream is then aborted)."""
|
| 254 |
+
deadline = None if seconds is None else time.monotonic() + seconds
|
| 255 |
+
while not done.is_set():
|
| 256 |
+
step = CLIENT_POLL if deadline is None else min(CLIENT_POLL, deadline - time.monotonic())
|
| 257 |
+
if step <= 0:
|
| 258 |
+
return True
|
| 259 |
+
if done.wait(step):
|
| 260 |
+
break
|
| 261 |
+
if client_gone(self.connection):
|
| 262 |
+
raise ConnectionAbortedError("caller disconnected")
|
| 263 |
+
return True
|
| 264 |
+
|
| 265 |
+
threading.Thread(target=call, daemon=True).start()
|
| 266 |
try:
|
| 267 |
+
streamed = incoming.get("stream") is True
|
| 268 |
+
wait_upstream(STREAM_COMMIT_AFTER if streamed else None)
|
| 269 |
+
if done.is_set() or not streamed:
|
| 270 |
+
wait_upstream()
|
| 271 |
+
if "error" in result:
|
| 272 |
+
# No retry: an ambiguous upstream attempt stays ambiguous.
|
| 273 |
+
self.close_connection = True
|
| 274 |
+
return
|
| 275 |
+
response = result["response"]
|
| 276 |
+
self.send_response(response.status, response.reason)
|
| 277 |
+
for key, value in response.getheaders():
|
| 278 |
+
if key.lower() not in {"transfer-encoding", "connection", "keep-alive", "content-length"}:
|
| 279 |
+
self.send_header(key, value)
|
| 280 |
+
self.send_header("Connection", "close")
|
| 281 |
+
self.end_headers()
|
| 282 |
+
else:
|
| 283 |
+
# Slow streamed answer: commit an event stream now and send SSE comments (ignored
|
| 284 |
+
# by every SSE client) until the provider answers.
|
| 285 |
+
self.send_response(200)
|
| 286 |
+
self.send_header("Content-Type", "text/event-stream")
|
| 287 |
+
self.send_header("Cache-Control", "no-cache")
|
| 288 |
+
self.send_header("Connection", "close")
|
| 289 |
+
self.end_headers()
|
| 290 |
+
self.wfile.flush()
|
| 291 |
+
while not done.is_set():
|
| 292 |
+
wait_upstream(STREAM_KEEPALIVE)
|
| 293 |
+
if not done.is_set():
|
| 294 |
+
self.wfile.write(b": keepalive\n\n")
|
| 295 |
+
self.wfile.flush()
|
| 296 |
+
response = result.get("response")
|
| 297 |
+
if response is None or response.status != 200:
|
| 298 |
+
status = getattr(response, "status", None)
|
| 299 |
+
detail = response.read(4096).decode("utf-8", "replace") if response is not None else ""
|
| 300 |
+
message = (f"Upstream HTTP {status}: {detail}" if response is not None
|
| 301 |
+
else f"Upstream connection error: {type(result.get('error')).__name__}")
|
| 302 |
+
self.wfile.write(stream_error(self.path, message, status))
|
| 303 |
+
self.wfile.flush()
|
| 304 |
+
self.close_connection = True
|
| 305 |
+
return
|
| 306 |
while data := response.read1(65536):
|
| 307 |
self.wfile.write(data)
|
| 308 |
self.wfile.flush()
|
| 309 |
self.close_connection = True
|
| 310 |
except (OSError, http.client.HTTPException):
|
|
|
|
| 311 |
self.close_connection = True
|
| 312 |
finally:
|
| 313 |
+
abort_upstream()
|
| 314 |
|
| 315 |
return ThreadingHTTPServer((host, port), Handler)
|
| 316 |
|