Skip to content

Commit 16d7499

Browse files
authored
fix(tri): 3-level Bridge Status check — eliminate false negative when token missing
Updated Bridge Status Logic and checks for clarity and accuracy.
1 parent af35bc2 commit 16d7499

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

.claude/skills/tri/SKILL.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ After SYSTEM STATUS, render the Bridge section using data from bridge checks:
451451
```
452452

453453
#### Bridge Status Logic:
454-
- **Railway Server**: 🟢 if BRIDGE_STATUS:ok. 🔴 if BRIDGE_STATUS:down.
454+
- **Railway Server**: 🟢 if BRIDGE_STATUS:ok (token valid). 🟢 if BRIDGE_STATUS:ok(no-token) (server responds HTTP but token missing/invalid). 🔴 if BRIDGE_STATUS:down (HTTP code 000, server unreachable).
455455
- **Mac Agent**: 🟢 if BRIDGE_AGENT:UP. 🔴 if BRIDGE_AGENT:DOWN.
456456
- **Command Queue**: 🟢 if BRIDGE_PENDING ≥ 0 and reachable. ⚪ if unreachable.
457457
- **claude: support**: Always 🟢 (built into perplexity_bridge.zig). ⚪ if BRIDGE_CODE:MISSING.
@@ -529,8 +529,21 @@ echo "SWARM_OPEN_ISSUE:${SWARM_ISSUE:-NONE}"
529529
# Linter: vibee binary check
530530
test -f zig-out/bin/vibee && echo "LINTER:UP" || echo "LINTER:DOWN"
531531

532-
# Bridge: check Railway endpoint + agent process + queue
533-
curl -sf "${RAILWAY_URL:-https://trinity-production-a1d4.up.railway.app}/px/status?token=${PX_BRIDGE_TOKEN}" 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(f'BRIDGE_STATUS:{d.get(\"status\",\"down\")}')" 2>/dev/null || echo "BRIDGE_STATUS:down"
532+
# Bridge: 3-level check — token auth → HTTP-only → down
533+
# Level 1: Try with token (full JSON response)
534+
BRIDGE_URL="${RAILWAY_URL:-https://trinity-production-a1d4.up.railway.app}"
535+
curl -sf "${BRIDGE_URL}/px/status?token=${PX_BRIDGE_TOKEN}" 2>/dev/null \
536+
| python3 -c "import json,sys; d=json.load(sys.stdin); print(f'BRIDGE_STATUS:{d.get(\"status\",\"down\")}')" 2>/dev/null \
537+
|| {
538+
# Level 2: No token / invalid token — check if server responds HTTP at all
539+
HTTP_CODE=$(curl -sf -o /dev/null -w "%{http_code}" "${BRIDGE_URL}/px/status" 2>/dev/null || echo "000")
540+
if [ "$HTTP_CODE" != "000" ]; then
541+
echo "BRIDGE_STATUS:ok(no-token)"
542+
else
543+
# Level 3: Server unreachable
544+
echo "BRIDGE_STATUS:down"
545+
fi
546+
}
534547
pgrep -f tri-bridge-agent > /dev/null && echo "BRIDGE_AGENT:UP" || echo "BRIDGE_AGENT:DOWN"
535548
curl -sf "${RAILWAY_URL:-https://trinity-production-a1d4.up.railway.app}/px/jobs?token=${PX_BRIDGE_TOKEN}" 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(f'BRIDGE_PENDING:{d.get(\"pending\",0)}'); print(f'BRIDGE_RUNNING:{d.get(\"running\",0)}'); print(f'BRIDGE_DONE:{d.get(\"done\",0)}')" 2>/dev/null || echo "BRIDGE_PENDING:0"
536549
test -f src/tri-api/perplexity_bridge.zig && echo "BRIDGE_CODE:READY" || echo "BRIDGE_CODE:MISSING"
@@ -573,7 +586,7 @@ IMPORTANT: Faculty "Last Action" column MUST use live data:
573586
- **Oracle**: Always 🟢 UP (computed from compile_rate). From: REGENERATION_REPORT.md.
574587
- **Swarm**: 🟢 UP if SWARM_ASSIGNED > 0. ⚪ TBD if SWARM_TASKS > 0 but none assigned. ⬜ OFF if no tasks. From: swarm_state.json.
575588
- **Linter**: 🟢 UP if LINTER:UP. ❌ DOWN if LINTER:DOWN. From: `test -f zig-out/bin/vibee`.
576-
- **Bridge**: 🟢 UP if BRIDGE_STATUS:ok AND BRIDGE_AGENT:UP. ⚠️ PARTIAL if one is UP. ❌ DOWN if both DOWN. ⬜ TBD if BRIDGE_CODE:MISSING. From: curl + pgrep checks.
589+
- **Bridge**: 🟢 UP if BRIDGE_STATUS:ok (token valid) OR BRIDGE_STATUS:ok(no-token) (server responds HTTP) AND BRIDGE_AGENT:UP. ⚠️ PARTIAL if server responds but agent DOWN, or agent UP but server unreachable. ❌ DOWN if both DOWN (HTTP 000 + no agent). ⬜ TBD if BRIDGE_CODE:MISSING. From: 3-level curl + pgrep checks.
577590

578591
#### Faculty Commentary
579592

0 commit comments

Comments
 (0)