Skip to content

Latest commit

 

History

History
604 lines (474 loc) · 30.8 KB

File metadata and controls

604 lines (474 loc) · 30.8 KB

Operations、Quotas 和 Runbook

本文档覆盖当前 MVP 运维基线:health checks、可观测状态、quota policy 和常见恢复动作。

Health Checks

Public health:

curl -fsS "$AGENTICS_API_BASE_URL/healthz"

期望响应:

{
  "status": "ok",
  "service": "api-server",
  "environment": "production",
  "database": {
    "connected": true,
    "current_time": "2026-05-07T00:00:00Z"
  }
}

environment 会报告配置的 deployment stage:devtestrehearsalproduction

如果临时使用 curl,不要把 admin service token 放进 argv。先在当前 shell 中创建一个 0600 curl config file,检查结束后删除:

AGENTICS_ADMIN_CURL_CONFIG="$(mktemp)"
chmod 600 "$AGENTICS_ADMIN_CURL_CONFIG"
printf 'header = "Authorization: Bearer %s"\n' "$AGENTICS_ADMIN_SERVICE_TOKEN" > "$AGENTICS_ADMIN_CURL_CONFIG"

Admin capacity:

curl -fsS --config "$AGENTICS_ADMIN_CURL_CONFIG" \
  "$AGENTICS_API_BASE_URL/admin/capacity"

Worker heartbeat:

curl -fsS --config "$AGENTICS_ADMIN_CURL_CONFIG" \
  "$AGENTICS_API_BASE_URL/admin/service-heartbeats"

Worker heartbeat 是判断 worker loop 是否存活的主要信号。每个 worker process 都使用 UUID-backed instance id,并可选带上 host label 方便阅读,因此 heartbeat 和 job claim 不会在重启或跨机器时混淆。Idle worker 应刷新 status: "idle" heartbeat。Running worker 应显示 claimed job id 和 solution submission id。Heartbeat payload 也会包含已配置 accelerator capability list,例如 CPU-only worker 的 ["none"],或 DGX GPU worker 的 ["none", "gpu"]

Admin Access

Admin web console 位于 /admin。Human admins 通过 GitHub sign-in 登录。 Server-side admin calls 使用 admin service token,并放在 Authorization: Bearer ... header 中。

先通过配置的 GitHub user id bootstrap 第一个 admin,然后在 admin console 中创建 admin service tokens 给 non-browser automation 使用。活跃的 admin service token 标签在 每个签发它的 human admin 下必须唯一;如需复用同一标签,请先撤销旧 token。 Hosted MVP registration 应使用 AGENTICS_AGENT_REGISTRATION_MODE=pioneer_code;backend 会在 non-loopback bind 下拒绝 public registration mode。 GitHub sign-in 只使用 GitHub App client credentials: AGENTICS_GITHUB_APP_CLIENT_IDAGENTICS_GITHUB_APP_CLIENT_SECRETAGENTICS_GITHUB_APP_REDIRECT_URL。MVP login 不配置 GitHub App private key、 webhook、installation id、installation token 或 repository permissions。Production 保持 secure browser cookies enabled,并使用 HTTPS redirect URL。HTTP redirect URLs 只接受 loopback development 或 rehearsal callbacks,并搭配 AGENTICS_WEB_SESSION_COOKIE_SECURE=false

Startup config validation 会 fail fast。格式错误的 numeric port variables 不会被忽略; 当 AGENTICS_HOST_PROBE_MODE 不是 off 时,hosted worker probe mode 要求 AGENTICS_HOST_PROBE_COMMAND 非空。

Internal Rust Toolchain Image

Compose development 和 integration-test Rust services 默认使用内部 agentics-rust-toolchain:trixie-llvm22-local image。该 image 从 deploy/service-images/rust-toolchain/ 构建,并安装 Homebrew LLVM 22、Homebrew cargo-binstall 和 Wild 0.9.0。进入 image 后可检查 /opt/agentics/toolchain-info.json 确认实际 toolchain,并检查 /opt/cargo/config.toml 确认 Cargo linker settings。

手动 rebuild 和 smoke:

docker build --network host -t agentics-rust-toolchain:trixie-llvm22-local \
  deploy/service-images/rust-toolchain
docker run --rm --network none agentics-rust-toolchain:trixie-llvm22-local \
  /opt/agentics/smoke-rust-toolchain.sh

这是 internal build/test/deployment-builder image。Challenge specs 必须继续使用 docker/runner-images/ 下的 public runner images;如果要给这些 images 添加 LLVM/Wild,需要单独做 runner-image release。

Moltbook Community Links

Agentics 会展示以下配置指定的全局 Moltbook Submolt:

  • AGENTICS_MOLTBOOK_SUBMOLT_NAME,默认 agentics-platform
  • AGENTICS_MOLTBOOK_SUBMOLT_URL,默认 https://www.moltbook.com/m/agentics-platform

API 会验证 URL 必须是 https://www.moltbook.com/m/<name> 形式的 Submolt URL, 并且 URL 中的 name 与配置的 name 一致。Agentics 不存储 Moltbook API keys,也不向 Moltbook 自动发帖。

绑定手动创建的 challenge discussion post:

curl -fsS --config "$AGENTICS_ADMIN_CURL_CONFIG" \
  -H 'Content-Type: application/json' \
  -d '{"discussion_url":"https://www.moltbook.com/post/<post-id>"}' \
  "$AGENTICS_API_BASE_URL/admin/challenges/<challenge-name>/moltbook-discussion"

清除绑定:

curl -fsS -X DELETE --config "$AGENTICS_ADMIN_CURL_CONFIG" \
  "$AGENTICS_API_BASE_URL/admin/challenges/<challenge-name>/moltbook-discussion"
rm -f "$AGENTICS_ADMIN_CURL_CONFIG"

Public Demo Quota Policy

Backend 当前会强制执行:

Limit Config Enforced at
Active registered agents AGENTICS_MAX_ACTIVE_AGENTS Agent registration
每个 agent、challenge、target、24 小时内 validation runs AGENTICS_VALIDATION_RUNS_PER_AGENT_CHALLENGE_DAY Validation creation before artifact storage
每个 agent、challenge、target、24 小时内 official runs AGENTICS_OFFICIAL_RUNS_PER_AGENT_CHALLENGE_DAY Official submission before artifact storage
Active official jobs AGENTICS_MAX_ACTIVE_OFFICIAL_JOBS Official submission queueing
ZIP artifact JSON body router body limit API request boundary
ZIP archive bytes runner artifact limit Runner extraction
ZIP file count 和 expanded bytes runner extraction limits Runner extraction
Per-container logs phase log limit Docker log collection
每个 review record 的 private asset bytes AGENTICS_CHALLENGE_PRIVATE_ASSET_BYTES_PER_REVIEW_RECORD Private asset upload
每个 human creator 的 active challenge review records AGENTICS_MAX_ACTIVE_CHALLENGE_REVIEW_RECORDS_PER_HUMAN Review record creation
Review record validations per day AGENTICS_CHALLENGE_REVIEW_RECORD_VALIDATIONS_PER_DAY Admin review record validation
Active review record validation lease AGENTICS_CHALLENGE_REVIEW_RECORD_VALIDATION_TIMEOUT_MINUTES Review record validation 和 private asset upload admission
Pending private asset lease AGENTICS_CHALLENGE_PRIVATE_ASSET_PENDING_TIMEOUT_MINUTES Private asset upload retry admission
Review record publish lease AGENTICS_CHALLENGE_REVIEW_RECORD_PUBLISH_TIMEOUT_MINUTES Publish claim recovery
Review record TTL 和 unpublished asset grace AGENTICS_CHALLENGE_REVIEW_RECORD_TTL_DAYSAGENTICS_UNPUBLISHED_CHALLENGE_ASSET_GRACE_DAYS Review record cleanup

Hosted MVP registration 使用 AGENTICS_AGENT_REGISTRATION_MODE=pioneer_code。Backend 会拒绝 non-loopback bind 上的 AGENTICS_AGENT_REGISTRATION_MODE=public;Cloudflare rate limits 是 defense-in-depth edge control,不是主要 registration gate。 管理员在 Admin Web 创建 pioneer code 时只选择可选短标签以及最大使用次数、 过期时间等策略元数据。Agentics 始终生成随机 code 后缀;operator 不输入完整 code 值。 撤销 human pioneer code 会把关联的 humans 退回 setup_required,移除通过该 code 获得的 creator access,并删除其 active browser sessions,使 UI 立即刷新。 Human account deletion 可由用户在 account settings 页面自助完成。该操作要求 authenticated、CSRF-protected browser session;如果该用户是最后一个 active human admin,则会被拒绝。删除会把 human 标记为 deleted,去标识化已存储的 GitHub login, 撤销 active browser sessions 以及该 human 创建的 admin service tokens 和 creator API tokens,并保留 GitHub numeric id 作为最小 provenance,以防静默重新注册。Challenge ownership、review、private asset metadata、submission、evaluation、leaderboard 以及其他 public 或 provenance records 会为平台完整性继续可读,除非法律要求移除。 如果设置了 NEXT_PUBLIC_AGENTICS_GA_MEASUREMENT_ID,web app 中的 Google Analytics 仍受 consent gate 约束。拒绝或撤回 analytics consent 会保存 agentics_cookie_consent 选择,并尽力清除本网站可见的 _ga_ga_* cookies。

Stage env examples 中的 environment variables 必须同步到 startup policy code。Required variables 缺失、为空,或在 hosted stage 仍使用 placeholder 时会 fail fast;optional variables 缺失时会打印包含默认值的 startup warning;deprecated names 必须带 replacement name fail,或明确 warning 为 ignored。

推荐 local Compose MVP 数值:

export AGENTICS_MAX_ACTIVE_AGENTS=100
export AGENTICS_VALIDATION_RUNS_PER_AGENT_CHALLENGE_DAY=10
export AGENTICS_OFFICIAL_RUNS_PER_AGENT_CHALLENGE_DAY=3
export AGENTICS_MAX_ACTIVE_OFFICIAL_JOBS=2
export AGENTICS_MAX_ACTIVE_CHALLENGE_REVIEW_RECORDS_PER_HUMAN=3
export AGENTICS_CHALLENGE_PRIVATE_ASSET_BYTES_PER_REVIEW_RECORD=$((1024 * 1024 * 1024))
export AGENTICS_CHALLENGE_REVIEW_RECORD_VALIDATIONS_PER_DAY=10

DGX Spark 数值应在 benchmark calibration 后重新评估。

Official Baseline Submissions

Production baseline submissions 应使用已注册的 agentics-official agent 和可恢复的 ops submitter,不要使用临时 shell loops。Submitter 会发现已发布 challenges,从 challenge-repos/agentics-challenges/test-solutions 打包已提交的 solutions,默认跳过 baseline audit 仍标记为 deferred、或本地 README/manifest 仍写着 smoke/public-only 的 solutions,每次提交一个 challenge-target pair,等待 submission 到达 terminal state,把 JSONL 进度写到 target/ 下,然后等待 5 秒再继续。每次运行都必须显式传入至少一个 --target;不会再隐式默认使用 CPU target。

先运行 dry run:

just prod::submit-baselines --target linux-arm64-cpu --dry-run

大范围 CPU live pass 也必须显式传入 CPU target:

just prod::submit-baselines --target linux-arm64-cpu

小范围 live pass 可以只筛选一个 challenge 或加上 limit:

just prod::submit-baselines --target linux-arm64-cpu --challenge hello-world-rs
just prod::submit-baselines --target linux-arm64-cpu --limit 5

CUDA pass 应显式传入 CUDA target;必要时再配合 GPU challenge allowlist:

just prod::submit-baselines --target linux-arm64-cuda --allowlist-file target/agentics-gpu-baseline-allowlist.txt

Token source 是本地 agentics CLI 的正常 agent token、AGENTICS_TOKEN,或 --token-stdin。不要把 bearer tokens 放入 shell history、logs 或 state files。只有在明确要替换之前的 baseline submissions 时才使用 --resubmit。当 host GPU 被无关进程占用时,GPU targets 仍可能失败;在把这类失败当作 platform regression 前,请先检查 nvidia-smi 和 runner logs。

Hosted Storage Probe Policy

Hosted DGX profile 会在 public workers 接受 jobs 前添加 strict storage probes。 这是 DGX-hosted hardening,并与 local Compose runbook 分离。

使用明确的 Agentics flags AGENTICS_RUNNER_SECURITY_PROFILE=development|productionAGENTICS_HOST_PROBE_MODE=off|warn|require,不要从 CI=true 或 API bind host 推断 strictness。development 让 local 和 test workers 保持宽松;production 会 fail closed,除非 bounded runner storage、Docker writable-layer quota、required host probes 和 digest-pinned images 全部启用。在 warnrequire mode 下, worker startup 会运行 agentics-check-dgx-spark-profile;在 require mode 下,如果 script 失败或无法运行,worker 会 fail closed。该 probe 会验证 configured Docker daemon 上的 Docker writable-layer quota enforcement,并验证 runner-owned writable mounts 由有界的 per-phase XFS project-quota slots 支撑。DGX profile 应设置 AGENTICS_RUNNER_SECURITY_PROFILE=productionAGENTICS_RUNNER_WRITABLE_STORAGE_MODE=xfs-project-quota-slotsAGENTICS_RUNNER_RUNTIME_ROOT=/srv/agentics/runtimeAGENTICS_RUNNER_PHASE_MOUNT_ROOT=/srv/agentics/phase-mountsAGENTICS_RUNNER_WRITABLE_SLOT_CLASSES_MB=64,256,1024,4096,8192,12288,16384AGENTICS_RUNNER_DOCKER_LAYER_QUOTA=true。默认 platform-owned evaluator-visible output caps 是 AGENTICS_RUNNER_MAX_OUTPUT_FILES=8192AGENTICS_RUNNER_MAX_OUTPUT_DIRS=1024AGENTICS_RUNNER_MAX_OUTPUT_DEPTH=32。Result 和 log payload caps 是 AGENTICS_RUNNER_MAX_RUNS=100AGENTICS_RUNNER_MAX_RESULT_JSON_BYTES=4194304AGENTICS_RUNNER_MAX_PUBLIC_RESULTS=1024AGENTICS_RUNNER_MAX_RESULT_LOG_BYTES=262144piped_stdio interaction bytes 由 AGENTICS_RUNNER_MAX_INTERACTION_BYTES_PER_DIRECTION=268435456 限制每个方向, attached stream shutdown grace 是 AGENTICS_RUNNER_INTERACTION_SHUTDOWN_GRACE_SECS=2。持久化 runner logs 会按实际 run count 乘以 1 MiB 限制,因此默认最大值是 100 MiB。 AGENTICS_OFFICIAL_LOG_REDACTION=contract_based 只会在加载的 challenge contract 使用 public-only official material 时保留 official diagnostics。如果 hosted workers 的 operations policy 要求 blanket official-log redaction,请使用 AGENTICS_OFFICIAL_LOG_REDACTION=always

Worker scheduling 对 GPU jobs 采用 fail-closed 策略。默认 AGENTICS_WORKER_ACCELERATORS=none 只会领取无 accelerator jobs。在 DGX workers 上设置 AGENTICS_WORKER_ACCELERATORS=gpu 后,worker 可以同时领取 CPU 和 GPU jobs。GPU mode 要求设置 AGENTICS_WORKER_GPU_PROBE_IMAGE;如果 host 不是 Linux、Docker 不可达、Docker GPU device requests 不工作,或无法看到至少一个 GPU, startup 会失败。DGX probe baseline 应使用 digest-pinned cu130 Agentics CUDA image。

MVP runner containers 仍使用 image default user 和 writable root filesystem, 这样 setup/build/run scripts 可以使用普通 package managers 和 toolchains。这是 一个已接受的 MVP tradeoff,不等同于完整 isolation:Docker writable-layer quotas 约束写入 container layer 的内容,runtime root 会把 transient Docker bind sources 放在 Docker daemon 可见的 host path 下,XFS project-quota slots 约束 runner-owned bind mounts,例如 workspaces、/io/setup/output、home 和 temporary directories。DGX slots 还会设置 inode hard limit,默认每 MiB 256 个 inodes, 因此 dependency installs 会被约束,但不会把 evaluator-visible output file cap 应用到 setup/build workspaces。Retained build、setup 和 evaluator-visible run trees 会保持 由已租用的 runner slots 支撑,直到依赖它们的 phases 完成。未来 hardening 可以加入 non-root run phases 或 read-only root filesystems,但不能弱化当前 disk-boundary 要求。

Production runner paths 也必须是 host 上的私有目录。Worker 要求 AGENTICS_RUNNER_RUNTIME_ROOTAGENTICS_RUNNER_PHASE_MOUNT_ROOT 已存在、由 Compose runtime UID/GID 拥有,并且权限为 0700 或更严格。Worker 会用 0700 创建 transient agentics-eval-artifacts attempt directories,然后才为了 Docker bind compatibility 放宽子路径权限,因此 official private bundles 不会因为可遍历的 host scratch parent 暴露。 Permission-repair sidecars 使用与 runner containers 相同的 Docker hardening baseline,保持 network disabled,将 root filesystem 设为 read-only,并且只写入它们 要修复的 runner-owned bind mounts。

Migrated Private Bundle Backups

Migrated Frontier-CS private assets 会备份在专用 private-bundle RustFS store 中, 不放在 Agentics durable storage bucket 里。使用 just storage::backup-up 启动。 刷新当前 Frontier-CS private asset batch 时,先运行 just storage::refresh-frontier-cs-private-assets --dry-run,确认 report 后再用 just storage::refresh-frontier-cs-private-assets --confirm-overwrite 上传。该命令会 验证每个 generated ZIP overlay,并在 upload 后验证 object length 和 SHA-256。 Generated ZIPs 只保存在 target/ 下,绝不能 commit。

Disposable rehearsal storage 使用 just rehearsal::restore-private-bundles --overwrite 恢复 refreshed bundles。 --overwrite 只能在 disposable 或明确批准的 refresh environments 中使用。部分 migrated interactive official sessions 在 MVP 中会有意在 runtime 生成 hidden state, 以匹配原始 Frontier-CS interactor 行为;这些 challenges 的 public validation 仍是 deterministic。 Production 和 rehearsal startup seeding 会在 private-bundle-backups/<challenge-name>/<asset-name>.zip 读取这些已恢复对象。 App image 内置的 public catalog 会有意省略 private benchmark directories;API 会先把 恢复的 private ZIPs overlay 到临时 runtime bundle,再 validate、archive 并 publish 每个 challenge。

Operational Checks

运行:

agentics-check-local-mvp

该 binary 检查:

  • Docker daemon 是否可用。
  • API /healthz
  • Public challenge list。
  • 如果提供 credentials,则检查 admin capacity。
  • 如果提供 credentials,则检查 worker heartbeat。
  • 如果设置 AGENTICS_WEB_BASE_URL,则检查 frontend 是否可访问。

DGX Spark host inventory 使用带 Linux gate 的检查:

agentics-check-dgx-spark-host

仅在 operator account 能访问目标 Docker daemon 时,才设置 AGENTICS_DGX_RUN_DOCKER_SMOKE=true。Rust checker 直接使用 Docker API access, 因此请通过 DOCKER_HOST 这类 Docker socket environment 指向目标 daemon, 不要使用 Docker CLI wrapper。

DGX host profile 使用以下检查:

AGENTICS_DOCKER_HOST=unix:///srv/agentics/docker.sock \
AGENTICS_DOCKER_SOCKET_PATH=/srv/agentics/docker.sock \
AGENTICS_RUNNER_SECURITY_PROFILE=production \
  AGENTICS_HOST_PROBE_MODE=warn \
  agentics-check-dgx-spark-profile

完成 storage preparation 后,启动 dedicated runner Docker daemon。Ops wrapper 会配置默认 Docker bridge network,供 network-enabled setup phases 使用,并验证该 bridge 的 scoped host forwarding rules:

sudo just prod::runner-docker-up

配置好 runner Docker daemon 和 loopback XFS mounts 后,先把 probe image preload 到该 daemon,然后运行 strict check:

docker --host unix:///srv/agentics/docker.sock pull busybox:1.36
env \
  AGENTICS_DOCKER_HOST=unix:///srv/agentics/docker.sock \
  AGENTICS_DOCKER_SOCKET_PATH=/srv/agentics/docker.sock \
  AGENTICS_HOST_PROBE_MODE=require \
  AGENTICS_RUNNER_SECURITY_PROFILE=production \
  AGENTICS_RUNNER_WRITABLE_STORAGE_MODE=xfs-project-quota-slots \
  AGENTICS_RUNNER_RUNTIME_ROOT=/srv/agentics/runtime \
  AGENTICS_RUNNER_PHASE_MOUNT_ROOT=/srv/agentics/phase-mounts \
  AGENTICS_RUNNER_WRITABLE_SLOT_CLASSES_MB=64,256,1024,4096,8192,12288,16384 \
  AGENTICS_DGX_PHASE_SLOT_INODES_PER_MB=256 \
  AGENTICS_DGX_RUN_MUTATING_PROBES=true \
  AGENTICS_DGX_DOCKER_PULL_POLICY=never \
  agentics-check-dgx-spark-profile

Strict profile check 会验证默认 Docker bridge network、Docker writable-layer quota probe、per-phase mount writeability、root-prepared quota slot metadata、configured inode hard limits,以及使用 64 MiB slot class 的 per-phase bind-mount quota exhaustion probe。

在 Linux 上做本地验证时,使用由测试用户拥有的独立 test quota root:

sudo AGENTICS_DGX_TEST_CONFIRM=prepare-test-storage \
  agentics-prepare-dgx-spark-test-storage
sudo env AGENTICS_TEST_ROOT=/srv/agentics-test just test-env-up
just test-env-status-cpu
just test-all-cpu

在有 NVIDIA GPU support 的 Linux host 上,使用 just test-env-statusjust test-all 覆盖 ignored CUDA/GPU tests。Test harness 使用 /srv/agentics-test/docker.sock 上的专用 Docker daemon,启动 disposable Postgres 和 RustFS Compose services,并且只清理 test-scoped Compose projects 和 volumes。完成后用 sudo env AGENTICS_TEST_ROOT=/srv/agentics-test just test-env-down 停止专用 test daemon。

不要为了让本地测试通过而修改 /srv/agentics/phase-mounts ownership;这些 slots 属于 hosted worker service user。

Production Compose 下,请通过 wrapper 运行检查,这样 check 会使用和 deployed stack 相同的 env file 和 Compose project name:

just prod::check

just prod::check 也会验证 production Compose bridge forwarding guard、dedicated runner Docker bridge forwarding guard、expected worker services、从 API container 到 GitHub 的 TLS connection,以及从 runner container 到 PyPI 的 TLS connection。若 GitHub sign-in 在 callback 阶段返回 internal server error,请先运行这个 check,再排查 application credentials;否则即使 DNS 正常,Docker forwarding state 也可能让 API container 无法访问 GitHub。若 evaluator setup 在 fetching dependencies 时卡住或超时,runner-container PyPI probe 是第一个需要检查的项目。

Check service 会有意挂载 host Docker socket。API、web、Postgres 和 RustFS 不挂载它。

Production-like release rehearsals 使用 disposable agentics-rehearsal Compose environment,不要把 harness 指向真实 production:

cp deploy/compose/env/rehearsal.env.example deploy/compose/env/rehearsal.env
$EDITOR deploy/compose/env/rehearsal.env
sudo just rehearsal::prepare-storage
sudo just rehearsal::runner-docker-up
just rehearsal::build
just rehearsal::up
just rehearsal::check
just rehearsal::run

Rehearsal env file 必须保留 AGENTICS_DEPLOYMENT_STAGE=rehearsal、project agentics-rehearsal、bucket agentics-rehearsal、prefix rehearsal、runner namespace agentics-rehearsal,并且所有 mutable paths 都必须位于 /srv/agentics-rehearsal 下。Rehearsal Compose override 只暴露 loopback ports: API 13100、web 13001、Postgres 15432、RustFS 19000/19001。 因为 rehearsal web origin 是 HTTP loopback,env example 保持 AGENTICS_WEB_SESSION_COOKIE_SECURE=false

Rehearsal stack startup 会在 private bundle backups 已恢复到 rehearsal RustFS namespace 后,seed 与 production 相同的 real migrated challenge catalog。Rehearsal run harness 还会 seed 临时 fixture challenges,创建一次性 pioneer code,注册 rehearsal agent,覆盖三种 execution modes 的 validation 和 official submissions,验证 public projection/redaction surfaces,运行 hostile ZIP、network、private-data probes,并把 JSON/Markdown evidence 写入 rehearsals/<run-id>/。当 GPU worker evidence 不在本次范围内时,使用 just rehearsal::run-cpu。 当 COMPOSE_PROFILES=gpu 生效时,just prod::checkjust rehearsal::check 会在 worker-gpu 没有运行时失败。

先检查 destructive cleanup:

just rehearsal::purge-data --dry-run
sudo just rehearsal::purge-data --confirm-rehearsal-purge

Purge 命令会拒绝 production project,要求 rehearsal env marker,只删除 agentics-rehearsal Compose project 和 runner namespace,并拒绝任何位于 /srv/agentics-rehearsal 之外的 destructive path。 生成的 fixture challenges 默认使用已发布、带 digest pin 的 ARM64 CPU runner image;只有在受控 local staging 中才用 --cpu-image-source--cpu-image-reference 覆盖。

除非 operators 明确提供不同的 --run-id 并确认有足够 capacity headroom,否则同一个 staging database/storage namespace 一次只运行一个 production rehearsal。Rehearsal cleanup 会 archive 生成的 challenges 并 revoke 临时 pioneer code;submitted ZIPs、 runner logs 和 object-storage artifacts 仍按正常 retention cleanup 处理。

Logs

当前 service logs 是 Compose container stdout/stderr。Worker evaluation logs 会写入 durable object storage 的 eval-artifacts/<job-id>/attempt-<attempt>/runner.log;默认位于 配置的 RustFS/S3 bucket 和 prefix。如果显式选择 local mode,它会映射到 AGENTICS_STORAGE_ROOT。Source extraction、build workspaces、prepared data、solution run I/O 和 evaluator output 等 runner scratch trees 是 per-job temporary workspaces,不应持久化在 durable storage 中。

MVP rehearsal 最小日志保留策略:

  • API 和 worker 进程日志:7 天。
  • Worker runner logs:随 solution submission artifacts 保留,除非 admin 显式清理。
  • Reverse proxy access logs:7 天,并保留基于 IP 的 request counts 以便排查 abuse。

常见故障

API Health 失败

  1. 检查 local Compose services:

    just dev::ps
  2. 检查 migration 和 API logs:

    just dev::logs
  3. 检查 API logs 中的 config validation failures,尤其是 GitHub sign-in 设置缺失、non-loopback bind 使用不安全 session-cookie 设置,或缺少 first-admin bootstrap GitHub user ids。

  4. Production callback failure 如果在 logs 中显示 GitHub token request send error,运行 just prod::check。这个 check 会尽可能修复 Compose bridge egress guard,并验证 API-container 到 GitHub 的 HTTPS egress。

如果 logs 显示 SQLx migration version 或 checksum mismatch,说明该 database 来自旧的 pre-MVP migration history。请重建 disposable dev/test database,或从与当前 code revision 匹配的 snapshot 恢复 production rehearsal Postgres;不要手动编辑 _sqlx_migrations

Worker Heartbeat 缺失

  1. 启动或重启 worker。

  2. 验证 Docker access:

    docker info
  3. 如果 Docker socket auto-detection 失败,设置 AGENTICS_DOCKER_HOST

  4. 再次检查 /admin/service-heartbeats

Jobs 长时间停留在 Running

Docker 运行期间 workers 会刷新 claimed job leases。Lease refresh 会限定到精确的 worker_idattempt_count,因此旧 worker attempt 不能让已被新 claim 取代的 job 继续保持 running。如果 worker 死亡,stale jobs 会在 AGENTICS_WORKER_STALE_JOB_MINUTES 和 max-attempt logic 之后 requeue 或 fail。

Worker startup 和每个 worker cycle 还会把 hosted-worker scope 中带 Agentics labels 的 Docker containers 与 database job claims 对账。Cleanup scope 只包括带 agentics.runner_scope=hosted-worker label 以及配置的 agentics.runner_namespace 的 containers,因此同一个 Docker host 上的 CLI local validation containers 和其他 Agentics stacks 不会被 worker 触碰。Compose project name 不会隔离通过共享 Docker socket 创建的 runner containers;真正的隔离边界是 runner namespace label。只有当 hosted-worker running container 的 job_idworker_idattempt_count labels 匹配一个 fresh running job claim 时才保留。 缺失、格式错误、stale、已被新 claim 取代,以及已停止且 stale 的 runner containers 会在该 hosted namespace 中被 kill 或 remove,避免 crashed worker 长时间占用 CPU、 GPU、writable-mount 或 Docker-layer quota slots。

每个 runner container 退出后,一个短生命周期 permission-repair sidecar 会让 writable bind mounts 重新变得 host-cleanable。它没有 network,root filesystem 为 read-only, 只挂载 writable bind mounts,drop 所有 capabilities,但保留执行 chmod host-owned files 所需的最小 FOWNER capability,并使用同一个 Agentics hosted-worker label scope。

如果 bounded writable slots 暂时都在 busy 状态,或者某个 stale slot 因 interrupted repair 留下的 root-owned files 而无法清理,worker 会把它当作 platform capacity pressure。它会用短 backoff requeue 这个 running job,而不是把 evaluation 标记为 failed。Cleanup failures 会作为 operator-visible capacity degradation 记录到日志中, 方便修复受影响的 slot,同时不惩罚 participant submission。

Actions:

  1. 查看 /admin/solution-submissions
  2. 查看 /admin/service-heartbeats
  3. 重启 worker。
  4. 除非数据库是 disposable test database,否则不要手动编辑 evaluation rows。

Production Compose shutdown 中,runner handling 必须显式选择:

  • just prod::down --runner keep --dry-run 只报告会被停止的 Compose services, 不做任何修改。
  • just prod::down --runner keep 会停止 Compose services,并保留 runner containers。
  • just prod::down --runner clean --dry-run 会报告会受影响的 Compose services 和精确匹配的 production runner containers,不做任何修改。
  • just prod::down --runner clean 会先停止 worker services,只删除带 agentics.runner=zip_projectagentics.runner_scope=hosted-workeragentics.runner_namespace=agentics-prod labels 的 containers,然后停止剩余 stack。

agentics-compose-prod clean-runners 及对应 just recipe 使用同样的精确 label filters, 并在 production database 可达时报告 job id、worker id、attempt count、phase 和 DB claim status。该命令不修复 database state;stale job repair 仍由 worker reconciliation 和 stale-lease path 负责。

Disk Usage 增长

Local storage mode 下检查:

Durable storage 默认使用 RustFS/S3。用你的 S3 tooling 检查配置的 bucket 和 AGENTICS_S3_PREFIX。Agentics object keys 包括 solution-submissions/eval-artifacts/challenge-review-records/<review-record-id>/private-assets/challenge-bundles/challenge-public-bundles/challenge-statements/challenge-shortlists/

只有显式运行 AGENTICS_STORAGE_BACKEND=local 时,检查:

du -sh "$AGENTICS_STORAGE_ROOT"
du -sh "$AGENTICS_STORAGE_ROOT"/eval-artifacts 2>/dev/null || true
du -sh "$AGENTICS_STORAGE_ROOT"/solution-submissions 2>/dev/null || true

使用 challenge review record cleanup 清理 stale unpublished private assets 和 stale Agentics _tmp/ objects。Published private runtime bundle archives、published public-only bundle archives、statements 和 completed solution artifacts 是持久 MVP records。 AGENTICS_STORAGE_TMP_OBJECT_GRACE_HOURS 默认是 24 小时;S3 lifecycle cleanup 仍应作为 stale _tmp/ keys 的第二道防线。

Public Abuse Spike

  1. 收紧 Cloudflare unauthenticated route limits。
  2. 降低 AGENTICS_MAX_ACTIVE_AGENTS
  3. 降低 validation 和 official quotas。
  4. 降低 AGENTICS_MAX_ACTIVE_OFFICIAL_JOBS
  5. 如果 registration abuse 是当前 incident,撤销或停止发放 pioneer codes。

备份 Checklist

一起备份:

  • Postgres。
  • Durable object storage:S3 bucket/prefix。如果显式选择了 local mode,则改为备份 AGENTICS_STORAGE_ROOT
  • Deployed binary/build identifiers。
  • Published challenge repo commit SHAs 和 submodule revision。

恢复时停止 API 和 worker,从同一 snapshot 恢复 database 和 storage,然后依次启动 API、worker 和 web。Agentics 不维护 down migrations;schema rollback 依赖 snapshot。

Production 现在通过共享 Compose 路径运行 PostgreSQL 18,数据位于 postgres_data_pg18 named volume。请保留 timestamped logical backup 和旧 agentics-prod_postgres_data PG16 volume 的 cold archive,直到 rollback window 结束。不要对 production 运行 down -v;rollback 依赖 volume 和 backup,而不是 migration downgrade。