Compare commits

...

1 Commits

Author SHA1 Message Date
Timmy
d69d289a9b fix(#1415): Resolve port 8080 conflict between L402 and preview server
Some checks failed
Review Approval Gate / verify-review (pull_request) Failing after 9s
CI / test (pull_request) Failing after 1m2s
CI / validate (pull_request) Failing after 1m3s
L402 server defaulted to port 8080, which conflicts with the Nexus
preview server (#1339). Both cannot run simultaneously on the same
machine without port collision.

Changes:
  - l402_server.py: default port 8080 -> 8081, configurable via
    L402_PORT environment variable
  - app.js: update L402 cost-estimate URL from :8080 to :8081

This frees port 8080 for the preview server and makes L402 port
configurable for future flexibility.

Fixes #1415
2026-04-14 14:06:58 -04:00
2 changed files with 5 additions and 2 deletions

2
app.js
View File

@@ -681,7 +681,7 @@ function updateGOFAI(delta, elapsed) {
// Simulate calibration update
calibrator.update({ input_tokens: 100, complexity_score: 0.5 }, 0.06);
if (Math.random() > 0.95) l402Client.fetchWithL402("http://localhost:8080/api/cost-estimate");
if (Math.random() > 0.95) l402Client.fetchWithL402("http://localhost:8081/api/cost-estimate");
}
metaLayer.track(startTime);

View File

@@ -2,6 +2,7 @@
#!/usr/bin/env python3
from http.server import HTTPServer, BaseHTTPRequestHandler
import json
import os
import secrets
class L402Handler(BaseHTTPRequestHandler):
@@ -25,7 +26,9 @@ class L402Handler(BaseHTTPRequestHandler):
self.send_response(404)
self.end_headers()
def run(server_class=HTTPServer, handler_class=L402Handler, port=8080):
def run(server_class=HTTPServer, handler_class=L402Handler, port=None):
if port is None:
port = int(os.environ.get('L402_PORT', 8081))
server_address = ('', port)
httpd = server_class(server_address, handler_class)
print(f"Starting L402 Skeleton Server on port {port}...")