fix: unify to single dashboard port (8080) from settings.json as sole source of truth

- server.py: --port default now reads dashboard.port from data/settings.json
- start.sh / start-agentic-os.sh: derive PORT from settings.json
- scheduler.py: SERVER_URL reads port from settings.json
- settings.json: dashboard.port 8081 -> 8080
- docs: refresh stale 8081 references
Resolves drift where launchers forced 8081 while CORS/scheduler/skin/docs expected 8080.
This commit is contained in:
Austin 2026-07-26 10:14:41 -07:00
parent 01dae3a4ac
commit 2c636d091d
5 changed files with 28 additions and 11 deletions

View File

@ -36,9 +36,9 @@ cd ~/agentic-os
```
**URLs:**
- Dashboard: `http://127.0.0.1:8081`
- Dashboard: `http://127.0.0.1:8080`
- Web Terminal: `http://127.0.0.1:8082` (WebSocket)
- API Base: `http://127.0.0.1:8081/api/`
- API Base: `http://127.0.0.1:8080/api/`
---
@ -170,7 +170,7 @@ Via the dashboard: **Agent Health** → **+ Add Agent**
Or via API:
```bash
curl -X POST http://127.0.0.1:8081/api/agents/register \
curl -X POST http://127.0.0.1:8080/api/agents/register \
-H "Content-Type: application/json" \
-d '{
"name": "my-llm",
@ -191,7 +191,7 @@ Via the dashboard: **Agent Health** → click **Remove** on any custom agent.
Or via API:
```bash
curl -X DELETE http://127.0.0.1:8081/api/agents/my-llm
curl -X DELETE http://127.0.0.1:8080/api/agents/my-llm
```
Built-in agents cannot be removed.
@ -572,7 +572,7 @@ cp -r skills/_template skills/my-skill
```python
# In server.py, add to BUILTIN_AGENTS dict, or use the API:
curl -X POST http://127.0.0.1:8081/api/agents/register \
curl -X POST http://127.0.0.1:8080/api/agents/register \
-H "Content-Type: application/json" \
-d '{"name":"my-agent","binary":"my-binary","type":"cli"}'
```
@ -595,7 +595,7 @@ curl -X POST http://127.0.0.1:8081/api/agents/register \
### Server Lifecycle
```bash
./start.sh # Start (port 8081 + terminal on 8082)
./start.sh # Start (dashboard port from data/settings.json, default 8080)
./start.sh --open # Start + open browser
./start.sh --stop # Stop
./start.sh --status # Check if running

View File

@ -31,7 +31,14 @@ import urllib.error
BASE_DIR = Path(__file__).parent.resolve()
JOBS_DIR = BASE_DIR / "jobs"
# Server URL — same host, main API port. Override with AGENTIC_OS_URL env.
SERVER_URL = "http://127.0.0.1:8080"
# Server URL — read the canonical port from settings.json so there is a
# single source of truth (launchers + server + scheduler all agree).
try:
_SET = json.loads(Path(__file__).parent.parent.joinpath("data", "settings.json").read_text(encoding="utf-8"))
_PORT = int(_SET.get("dashboard", {}).get("port", 8080))
except Exception:
_PORT = 8080
SERVER_URL = f"http://127.0.0.1:{_PORT}"
RUN_TIMEOUT = 300 # seconds per skill run

View File

@ -2810,14 +2810,24 @@ if __name__ == "__main__":
import uvicorn
# Single source of truth: the dashboard port lives in data/settings.json.
# Read it here so `--port` defaults to it (launchers, scheduler, docs all agree).
_settings_port = 8080
try:
_sf = BASE_DIR / "data" / "settings.json"
if _sf.exists():
_settings_port = int(json.loads(_sf.read_text(encoding="utf-8")).get("dashboard", {}).get("port", 8080))
except Exception:
_settings_port = 8080
parser = argparse.ArgumentParser()
parser.add_argument("--port", type=int, default=8081)
parser.add_argument("--port", type=int, default=_settings_port)
parser.add_argument("--host", type=str, default="0.0.0.0")
args = parser.parse_args()
# ── Double-launch guard ───────────────────────────────────────────
# Refuse to start if the API port is already bound by another process.
# Without this, two server.py instances collide on 8081 (and 8082),
# Without this, two server.py instances collide on the API port (default 8080),
# producing phantom "register doesn't persist" bugs and bind crashes.
probe = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:

View File

@ -9,7 +9,7 @@ DIR="/home/austin/agentic-os"
LOG="/tmp/agentic-os.log"
PIDFILE="$DIR/.agentic-os.pid"
HOST="0.0.0.0"
PORT="8080"
PORT="$(python3 -c "import json;print(json.load(open('data/settings.json')).get('dashboard',{}).get('port',8080))" 2>/dev/null || echo 8080)"
# Already serving? Then do nothing (idempotent).
if ss -ltn 2>/dev/null | grep -q ":$PORT "; then

View File

@ -7,7 +7,7 @@
set -euo pipefail
PORT="${PORT:-8081}"
PORT="${PORT:-$(python3 -c "import json;print(json.load(open('data/settings.json')).get('dashboard',{}).get('port',8080))" 2>/dev/null || echo 8080)}"
PID_FILE=".agentic-os.pid"
DASHBOARD_URL="http://127.0.0.1:${PORT}"