docs(handoff): oppdater HANDOFF.md — IAP auth fix for opax-mcp 2026-06-18
Updated the last modified date and author in the HANDOFF document. Revised critical rules and completed tasks, including IAP Auth fixes for opax-mcp.
This commit is contained in:
parent
9542106ecd
commit
dc9f6265be
168
docs/HANDOFF.md
168
docs/HANDOFF.md
|
|
@ -1,6 +1,6 @@
|
|||
# HANDOFF — Vauco OS
|
||||
|
||||
**Sist oppdatert:** 2026-06-15 19:46 CEST
|
||||
**Sist oppdatert:** 2026-06-18 14:00 CEST
|
||||
**Skrevet av:** Perplexity (Orchestrator)
|
||||
**Status:** Fase B — Gitea er primær Git. GitHub er fasa ut.
|
||||
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
## ⚠️ KRITISKE REGLER — les alltid først
|
||||
|
||||
- **Hovudapp:** `main.py` i rot — IKKJE `agents/core-logic/app.py`
|
||||
- **Hovedapp:** `main.py` i rot — IKKJE `agents/core-logic/app.py`
|
||||
- **Dockerfile:** `agents/core-logic/Dockerfile` — WORKDIR `/app`, CMD uvicorn main:app
|
||||
- **Region:** `us-central1` | **Service:** `osvauco-agent` | **Prosjekt:** `propane-will-491900-m5`
|
||||
- **Test via proxy:** `gcloud run services proxy osvauco-agent --region us-central1 --project propane-will-491900-m5 --port 8181`
|
||||
|
|
@ -21,7 +21,20 @@
|
|||
|
||||
---
|
||||
|
||||
## ✅ Fullført i dag (2026-06-15)
|
||||
## ✅ Fullført i dag (2026-06-18) — IAP Auth fix for opax-mcp
|
||||
|
||||
| Oppgave | Status |
|
||||
|---------|--------|
|
||||
| Identifisert rotårsak: feil IAP audience i identity token-kall | ✅ |
|
||||
| Lagt til `roles/iap.httpsResourceAccessor` for `jason-vauger` SA | ✅ |
|
||||
| Oppdatert `opax-mcp/server.py` — ny env var `OPAX_IAP_CLIENT_ID` som audience | ✅ |
|
||||
| Lagt til `OPAX_IAP_CLIENT_ID` env var i Cloud Run (revisjon 00019 — feil navn `IAP_CLIENT_ID`) | ⚠️ |
|
||||
| Rettet env var navn til `OPAX_IAP_CLIENT_ID` i Cloud Run — revisjon 00020 deployed | ✅ |
|
||||
| Revisjon `opax-mcp-00020-w6j` aktiv med 100% trafikk | ✅ |
|
||||
|
||||
---
|
||||
|
||||
## ✅ Fullført tidligere (2026-06-15)
|
||||
|
||||
| Oppgave | Status |
|
||||
|---------|--------|
|
||||
|
|
@ -30,7 +43,7 @@
|
|||
| Jason deployet til Vertex AI Agent Engine | ✅ |
|
||||
| Jason svarer på norsk og kallar tools automatisk | ✅ |
|
||||
| Gitea installert på VM (`34.59.131.162:3000`) | ✅ |
|
||||
| Gitea køyrer som systemd-teneste (overlever reboot) | ✅ |
|
||||
| Gitea kjøyrer som systemd-teneste (overlever reboot) | ✅ |
|
||||
| Mirror-repo sletta og erstatta med vanleg repo | ✅ |
|
||||
| **2867 commits pusha frå GitHub → Gitea** | ✅ |
|
||||
| Gitea API-tokens i Secret Manager | ✅ |
|
||||
|
|
@ -38,89 +51,116 @@
|
|||
|
||||
---
|
||||
|
||||
## 🏗 Systemstatus
|
||||
## 🖥 Systemstatus
|
||||
|
||||
| Komponent | URL / Referanse | Status |
|
||||
|-----------|-----------------|--------|
|
||||
| `osvauco-agent` Cloud Run | `us-central1` | ✅ Live |
|
||||
| `opax-mcp` Cloud Run | `https://opax-mcp-zjbqp3prqq-uc.a.run.app` | ✅ Live (25 tools) |
|
||||
| Jason Vertex AI Agent Engine | `reasoningEngines/237959055262351360` | ✅ Live |
|
||||
| **Gitea (primær Git)** | `http://34.59.131.162:3000/chris/OSVauco` | ✅ Live + systemd |
|
||||
| GitHub OSVauco | `https://github.com/vauco-saas/OSVauco` | ❌ Fasa ut |
|
||||
| `opax.vauco.no` | — | ✅ Live |
|
||||
| Emma (Gemma, lokal VM) | — | ⏳ Neste fase |
|
||||
| osvauco-agent (Cloud Run) | https://osvauco-agent-zjbgp3prqg-uc.a.run.app | ✅ Live |
|
||||
| opax-mcp (Cloud Run) | https://opax-mcp-357036551735.us-central1.run.app | ✅ Live (rev 00020) |
|
||||
| opax frontend (IAP LB) | https://opax.vauco.no | ✅ Live |
|
||||
| Jason (Vertex AI Agent) | Agent Engine, us-central1 | ✅ Live |
|
||||
| Gitea (self-hosted) | http://34.59.131.162:3000 | ✅ Live |
|
||||
| GitHub (legacy) | https://github.com/vauco-saas/OSVauco | ⚠️ Fasa ut |
|
||||
|
||||
---
|
||||
|
||||
## 🔑 Credentials
|
||||
|
||||
| System | Brukar | Verdi |
|
||||
|--------|--------|-------|
|
||||
| Gitea | `chris` | `OSVauco@Gitea2026!` |
|
||||
| Gitea API token (jason-token2) | — | Secret Manager: `gitea-api-token` (`278c0b41...`) |
|
||||
| Gitea API token (admin-token2) | — | `94527a0f5353c4b1db29a007b98f340b5fd1f385` |
|
||||
| opax-mcp MCP_SECRET | — | Secret Manager: `mcp-server-key` |
|
||||
| Jason Agent Engine | — | `reasoningEngines/237959055262351360` |
|
||||
- **Gitea login:** `chris` / se Secret Manager
|
||||
- **Gitea API-token:** Secret Manager → `gitea-api-token`
|
||||
- **MCP-Secret:** Secret Manager → `mcp-secret`
|
||||
- **Prosjekt:** `propane-will-491900-m5`
|
||||
- **IAP OAuth Client ID (opax backend):** `357036551735-kq8nt71d38hfqlcfb3n52ef7ala4meo.apps.googleusercontent.com`
|
||||
- **IAP Backend Service path:** `/projects/357036551735/global/backendServices/<navn>` (satt som `OPAX_IAP_CLIENT_ID` i Cloud Run)
|
||||
|
||||
---
|
||||
|
||||
## 🟠 Gjenstår (prioritert)
|
||||
## 🎯 Gjenstår (prioritert)
|
||||
|
||||
| # | Oppgave | Notat |
|
||||
|---|---------|-------|
|
||||
| 1 | Oppdater `opax_mcp_client.py` GitHub-tools → Gitea API | Byt `api.github.com` → `34.59.131.162:3000/api/v1` |
|
||||
| 2 | Cloud Build webhook → Gitea (ikkje GitHub) | Trigger på Gitea push |
|
||||
| 3 | DNS `git.vauco.no` → `34.59.131.162` | Domene for Gitea |
|
||||
| 4 | HTTPS/TLS for Gitea (Caddy) | Etter DNS |
|
||||
| 5 | Emma — Gemma lokal på ML-3a GPU VM | Eiga fase |
|
||||
| 6 | Sett manglande env-vars på `osvauco-agent` | `SENDGRID_API_KEY`, `TWILIO_*`, `NOTIFY_*` |
|
||||
1. **KRITISK — Verifiser IAP auth end-to-end** — kjør verifikasjonskommando under og bekreft `HTTP/2 200`
|
||||
2. Oppdater Gitea-klient-logikk i agenter (fra GitHub API → Gitea API)
|
||||
3. DNS/TLS for Gitea (`git.vauco.no`)
|
||||
4. GPU VM-arbeid (planlagt)
|
||||
5. Smoke-test pipeline for opax-mcp etter IAP-fix
|
||||
|
||||
---
|
||||
|
||||
## 📌 Neste sesjon — start her
|
||||
## 🚀 Neste sesjon — start her
|
||||
|
||||
### 1. Verifiser IAP auth fix (VIKTIGST)
|
||||
|
||||
Kjør fra `osvauco-dev-vm`:
|
||||
|
||||
```bash
|
||||
# 1. Verifiser Gitea
|
||||
curl -s http://34.59.131.162:3000/api/v1/repos/chris/OSVauco \
|
||||
-H "Authorization: token 94527a0f5353c4b1db29a007b98f340b5fd1f385" \
|
||||
| python3 -c "import sys,json; r=json.load(sys.stdin); print('mirror:', r['mirror'], '| commits OK')"
|
||||
# Hent identity token med korrekt IAP audience
|
||||
TOKEN=$(curl -s -H "Metadata-Flavor: Google" \
|
||||
"http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity?audience=357036551735-kq8nt71d38hfqlcfb3n52ef7ala4meo.apps.googleusercontent.com&format=full")
|
||||
|
||||
# 2. Verifiser Jason
|
||||
cd ~/OSVauco/agents/core-logic && source .venv/bin/activate
|
||||
python3 - <<'EOF'
|
||||
import vertexai
|
||||
from vertexai import agent_engines
|
||||
vertexai.init(project="propane-will-491900-m5", location="us-central1")
|
||||
agent = agent_engines.get("projects/357036551735/locations/us-central1/reasoningEngines/237959055262351360")
|
||||
session = agent.create_session(user_id="chris")
|
||||
for event in agent.stream_query(user_id="chris", session_id=session["id"], message="Status?"):
|
||||
if event.get("content"):
|
||||
print(event["content"]["parts"][0].get("text", ""), end="")
|
||||
EOF
|
||||
|
||||
# 3. Neste: oppdater opax_mcp_client.py til Gitea API
|
||||
# Test mot opax via IAP load balancer
|
||||
curl -si https://opax.vauco.no/opax/build-status \
|
||||
-H "Authorization: Bearer $TOKEN" | head -5
|
||||
```
|
||||
|
||||
Forventet: `HTTP/2 200` (tidligere: `HTTP/2 401`)
|
||||
|
||||
### 2. Sjekk Jason sin status
|
||||
|
||||
```bash
|
||||
curl -s https://osvauco-agent-zjbgp3prqg-uc.a.run.app/health \
|
||||
-H "Authorization: Bearer $(gcloud auth print-identity-token)"
|
||||
```
|
||||
|
||||
### 3. Hva som ble fikset i opax-mcp/server.py
|
||||
|
||||
**Fil:** `opax-mcp/server.py` — commit `9542106` ("OPAX_IAP_CLIENT_ID som IAP audience i identitytoken")
|
||||
|
||||
**Endring linje 17:**
|
||||
```python
|
||||
# FØR:
|
||||
OPAX_BASE_URL = os.environ.get("OPAX_BASE_URL", "https://opax.vauco.no")
|
||||
|
||||
# ETTER:
|
||||
OPAX_BASE_URL = os.environ.get("OPAX_BASE_URL", "https://opax.vauco.no")
|
||||
OPAX_IAP_CLIENT_ID = os.environ.get("OPAX_IAP_CLIENT_ID", "")
|
||||
```
|
||||
|
||||
**Endring linje 37 (`_opax_identity_token`):**
|
||||
```python
|
||||
# FØR:
|
||||
f"...identity?audience={OPAX_BASE_URL}&format=full"
|
||||
|
||||
# ETTER:
|
||||
f"...identity?audience={OPAX_IAP_CLIENT_ID or OPAX_BASE_URL}&format=full"
|
||||
```
|
||||
|
||||
**Cloud Run env vars på opax-mcp (aktive i rev 00020):**
|
||||
|
||||
| Navn | Verdi |
|
||||
|------|-------|
|
||||
| `OPAX_BASE_URL` | `https://opax.vauco.no` |
|
||||
| `OPAX_IAP_CLIENT_ID` | `/projects/357036551735/global/backendServices/...` |
|
||||
| `MCP_SECRET` | (fra Secret Manager) |
|
||||
| `GOOGLE_CLOUD_PROJECT` | `propane-will-491900-m5` |
|
||||
|
||||
---
|
||||
|
||||
## 🗺 Arkitektur
|
||||
## 🏗 Arkitektur
|
||||
|
||||
```
|
||||
Chris (naturleg språk)
|
||||
↓
|
||||
Jason Vauger (Vertex AI Agent Engine — Gemini 2.5 Flash)
|
||||
reasoningEngines/237959055262351360
|
||||
↓
|
||||
opax-mcp (Cloud Run — 25 tools)
|
||||
https://opax-mcp-zjbqp3prqq-uc.a.run.app
|
||||
↓
|
||||
┌─────────────────────────────────┐
|
||||
│ Gitea 34.59.131.162:3000 │ ← Eigen Git (PRIMÆR)
|
||||
│ GCP Cloud Build / Run │ ← CI/CD + hosting
|
||||
│ GitHub — FASA UT │ ← Ikkje i bruk lenger
|
||||
└─────────────────────────────────┘
|
||||
Bruker
|
||||
└─► Jason (Vertex AI Agent Engine, Gemini 2.5 Pro)
|
||||
└─► osvauco-agent (Cloud Run)
|
||||
└─► opax-mcp (Cloud Run)
|
||||
└─► [IAP] opax.vauco.no
|
||||
└─► OPAX backend (GCP)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
*Jason Vauger — han blir den du trenger han til å bli.*
|
||||
**Auth-flyt for opax-mcp → opax.vauco.no:**
|
||||
```
|
||||
opax-mcp container
|
||||
→ GCE Metadata Service
|
||||
→ identity token med audience = IAP_CLIENT_ID
|
||||
→ Authorization: Bearer <token>
|
||||
→ IAP validerer token
|
||||
→ Request videresendt til OPAX backend
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user