Files
conversation-history/SquareMCP/deployments/2026-06-16-communications-chatgpt-oauth-deploy-result.md
T

218 lines
7.0 KiB
Markdown

# Communications — ChatGPT/OAuth Scoping — Deploy Result
**Date:** 2026-06-16
**Branch:** `main`
**Author:** Kimi Code
**Status:** DEPLOYED + VERIFIED
---
## Original handoff
See `SquareMCP/deployments/2026-06-16-communications-chatgpt-oauth-deploy-handoff.md` for the full feature description.
---
## What was deployed
Backend prerequisite for exposing the Chat-First Communications Manager as a ChatGPT Custom GPT:
- Added `'communications'` to `OAUTH_CAPABILITIES` in `src/oauth.ts`
- Replaced `meterMiddleware` with `requireAuth` + `requireCapability('communications')` on all `/api/communications/*` routes
- Added full OpenAPI path definitions for Communications endpoints
- Added `GET /openapi-communications.json` route
- Registered a dedicated OAuth client scoped to `['communications']` only
- Added manifest tests for the scoped spec (421/421 tests passing)
---
## Git
| Action | SHA / Ref |
|--------|-----------|
| Feature commit | `61ce4c7` |
| Branch | `main` pushed to `https://git.fetcherpay.com/garfield/hermes-mcp.git` |
**Note:** `hermes-k8s.yaml` was **not** committed to git per the handoff's instruction to keep OAuth credentials out of version control. The file is tracked in git history, but the credential values and image tag update in this deploy were left as uncommitted local changes.
---
## Docker image
```
localhost:32000/hermes-mcp:61ce4c7
```
**Build/push note:** `docker push` to `localhost:32000` failed because the registry NodePort was not accessible on the host. Workaround used:
```bash
docker save localhost:32000/hermes-mcp:61ce4c7 -o /tmp/hermes-mcp-61ce4c7.tar
microk8s ctr image import /tmp/hermes-mcp-61ce4c7.tar
```
Because the image was imported directly into containerd, `hermes-k8s.yaml` uses the **tag** `localhost:32000/hermes-mcp:61ce4c7` with `imagePullPolicy: IfNotPresent` instead of the usual digest reference.
---
## Deploy procedure followed
1. `git add src/oauth.ts src/index.ts src/manifest.ts src/manifest.test.ts`
2. `git commit -m "feat(communications): scope OAuth capability + ChatGPT OpenAPI spec for Communications GPT"`
3. `git push origin main`
4. Built image: `docker build -t localhost:32000/hermes-mcp:61ce4c7 -t localhost:32000/hermes-mcp:latest .`
5. Imported image into containerd (registry push unavailable)
6. Stopped and removed all local Docker containers:
```bash
docker stop $(docker ps -q) 2>/dev/null || true
docker rm $(docker ps -aq) 2>/dev/null || true
ss -tlnp | grep -E ':(80|443|3000|8080)'
```
7. Restarted MySQL:
```bash
docker run -d --name mysql --restart unless-stopped \
-e MYSQL_ROOT_PASSWORD=fetcherpay \
-e MYSQL_DATABASE=fetcherpay \
-p 3306:3306 \
-v fetcherpay_mysql_data:/var/lib/mysql \
mysql:8.0 --bind-address=0.0.0.0
```
8. Generated new OAuth client credentials:
```bash
openssl rand -hex 16 # client id
openssl rand -hex 32 # client secret
```
9. Added `COMMUNICATIONS_OAUTH_CLIENT_ID` and `COMMUNICATIONS_OAUTH_CLIENT_SECRET` to `hermes-k8s.yaml`
10. Updated image reference in `hermes-k8s.yaml`
11. `microk8s kubectl apply -f hermes-k8s.yaml`
12. `microk8s kubectl rollout status deployment/hermes-mcp -n fetcherpay`
---
## New OAuth client
| Field | Value / Status |
|-------|----------------|
| `COMMUNICATIONS_OAUTH_CLIENT_ID` | `d5b4125c62c6f7ae61740116f8661dbb` |
| `COMMUNICATIONS_OAUTH_CLIENT_SECRET` | ✅ Set in `hermes-k8s.yaml` (not in git, not in this vault doc) |
| Allowed capabilities | `["communications"]` |
Expected startup log line confirmed:
```
[oauth] Communications client d5b4125c62c6f7ae61740116f8661dbb ensured with communications capability
```
---
## Verification
### 1. `/openapi-communications.json` is live and scoped
```bash
curl -s https://hermes.squaremcp.com/openapi-communications.json | python3 -c "import json,sys; d=json.load(sys.stdin); print(list(d['paths'].keys()))"
```
Result:
```
['/api/communications/profile',
'/api/communications/profile/generate-onboarding',
'/api/communications/examples',
'/api/communications/chat',
'/api/communications/drafts/{draft_id}',
'/api/communications/drafts/{draft_id}/regenerate',
'/api/communications/drafts/{draft_id}/reject',
'/api/communications/drafts/{draft_id}/approve',
'/api/communications/status']
```
### 2. `/openapi-living-brief.json` is unchanged
```bash
curl -s https://hermes.squaremcp.com/openapi-living-brief.json | python3 -c "import json,sys; d=json.load(sys.stdin); print(list(d['paths'].keys()))"
```
Result:
```
['/api/obsidian/search', '/api/obsidian/note', '/api/obsidian/note/append', '/api/obsidian/sync']
```
### 3. Unauthenticated request rejected
```bash
curl -s -o /dev/null -w "%{http_code}\n" https://hermes.squaremcp.com/api/communications/status
```
Result: `401`
### 4. Existing API-key flow still works (regression check)
```bash
curl -s -H "x-api-key: 672e1f42f94b48fb94f866a4dd9b793d" https://hermes.squaremcp.com/api/communications/status | python3 -m json.tool
```
Result:
```json
{
"approved_posts_count": 0,
"autonomous_mode_enabled": false
}
```
### 5. OAuth client registered in DB
```bash
docker exec mysql mysql -uroot -pfetcherpay \
-e "SELECT client_id, allowed_capabilities FROM hermes_oauth.oauth_clients WHERE client_id = 'd5b4125c62c6f7ae61740116f8661dbb';"
```
Result:
```
client_id allowed_capabilities
d5b4125c62c6f7ae61740116f8661dbb ["communications"]
```
---
## Issues encountered during deploy
### Registry NodePort inaccessible
The MicroK8s registry pod was Running, but port `32000` was not listening on the host, so `docker push localhost:32000/...` failed.
**Workaround:** saved the image with `docker save` and imported it directly into containerd with `microk8s ctr image import`.
### hermes-k8s.yaml uses tag + IfNotPresent
Because the image was loaded locally rather than pushed through a registry, the deployment uses `localhost:32000/hermes-mcp:61ce4c7` with `imagePullPolicy: IfNotPresent`. This is a deviation from the usual digest-based reference.
---
## Cleanup / open items
1. **ChatGPT Builder manual steps** — see the "What's still needed" section of the original handoff doc. This deploy only provides the spec and OAuth client; the GPT still needs to be created in ChatGPT's UI.
2. **Docker containers stopped** — `mt5` and `obsidian` were stopped per the deploy warning. Restart if needed:
```bash
cd ~/mt5-docker && ./start-mt5.sh
# obsidian — rerun the original docker run command
```
3. **hermes-k8s.yaml** has uncommitted local changes (OAuth credentials + image tag). Do not commit the secret values.
---
## Related vault docs
- OAuth handoff: `SquareMCP/deployments/2026-06-16-communications-chatgpt-oauth-deploy-handoff.md`
- Week 3 chat UI deploy result: `SquareMCP/deployments/2026-06-16-phase1-week3-chat-ui-deploy-result.md`
- Week 1+2 backend handoff: `SquareMCP/deployments/2026-06-15-phase1-communications-deploy-handoff.md`
- Observability runbooks: `SquareMCP/runbooks/observability/`
---
## Changelog
| Date | Author | Note |
|------|--------|------|
| 2026-06-16 | Kimi Code | Deployed Communications OAuth capability + scoped OpenAPI spec |