diff --git a/k8s/helm/commonly/templates/agents/cloud-codex-deployment.yaml b/k8s/helm/commonly/templates/agents/cloud-codex-deployment.yaml index 1e113648..369b00db 100644 --- a/k8s/helm/commonly/templates/agents/cloud-codex-deployment.yaml +++ b/k8s/helm/commonly/templates/agents/cloud-codex-deployment.yaml @@ -114,27 +114,38 @@ spec: set -e export PATH="/tools/bin:$PATH" export HOME=/state - mkdir -p /state/.codex /state/.commonly + mkdir -p /state/.codex /state/.commonly/tokens - # Seed ~/.commonly/config.json from injected env so `commonly` - # CLI knows which instance + which agent token to use. Re-writing - # on every boot is intentional — keeps the source of truth as the - # mounted secret, not the PVC. - cat > /state/.commonly/config.json </dev/null)" ]; then + echo "[cloud-codex] installing ca-certificates for TLS" + apt-get update >/dev/null 2>&1 || true + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates >/dev/null 2>&1 || true + update-ca-certificates >/dev/null 2>&1 || true + fi + + # Seed ~/.commonly/tokens/.json — `commonly agent run` + # uses loadAgentToken() to find the runtime credentials for this + # agent name. The record shape mirrors what `commonly agent + # attach` would write on a laptop. + # Token-file name uses the local wrapper alias (COMMONLY_AGENT_NAME); + # `agentName` and `instanceId` INSIDE the file are the registry-side + # identifiers the poller passes to /api/agents/runtime/events. + cat > /state/.commonly/tokens/${COMMONLY_AGENT_NAME}.json <