Docker default repo + keep stderr in worker error_text

Two live-test findings in one fix:
1. DockerExecutor has no repo fallback: when a project has no
repo_url, worker leaves task['repo'] unset and the container
host.py dispatch fails instantly with 'missing --repo' because
host-config-docker.json had no repo field either. Add the host
test-repo as the config default; projects with repo_url still
override it via worker's explicit --repo.
2. Worker discarded stderr from the final error_text, so every
container/host crash surfaced only as the generic 'host
execution failed' and was undebuggable from the task record.
When stdout is empty, error_text now keeps the stderr tail
(last 1000 chars, where the real error line lives).
This commit is contained in:
host committed 2026-10-26 05:45:51 +08:00
1 parent 3acf0d7b8c
commit 87a2ad0066
3 files changed
+34 -2

No files matched your search

+11 -1
View File
@@ -905,6 +905,13 @@ class Worker:
parsed = None
if isinstance(parsed, dict) and parsed.get("text"):
return str(parsed["text"])
# host.py 崩溃时 stdout 常为空、真正的报错在 stderr(例如
# “缺少 --repo”、Read-only file system);只用 stdout 时
# 最终错误会被写成通用的 host execution failed,排障无从
# 下手,所以 stdout 为空时取 stderr 尾部(实际报错行在尾)。
stderr = (result or {}).get("stderr", "") or ""
if not stdout.strip() and stderr.strip():
return stderr.strip()[-1000:]
if token is not None:
return "host_status=%s" % token
return stdout.strip() or "host execution failed"
@@ -1124,7 +1131,10 @@ class Worker:
fallback_model, second_error))
else:
if error is None:
error = stdout.strip() or "host execution failed"
stderr = (result or {}).get("stderr", "") or ""
error = stdout.strip() or \
(stderr.strip()[-1000:] if stderr.strip() else "") \
or "host execution failed"
if retry_count:
error = "[retries=%d] %s" % (retry_count, error)
# 未配 fallback_models 时的老行为:只记事件、不重试。