Skip to content

Fix/session refresh and powergrid simu proxy - #23

Merged
abdratsd merged 11 commits into
IRT-SystemX:mainfrom
ainetus:fix/session-refresh-and-powergrid-simu-proxy
Aug 27, 2026
Merged

Fix/session refresh and powergrid simu proxy#23
abdratsd merged 11 commits into
IRT-SystemX:mainfrom
ainetus:fix/session-refresh-and-powergrid-simu-proxy

Conversation

@abdratsd

Copy link
Copy Markdown
Collaborator

No description provided.

abdratsd and others added 11 commits July 24, 2026 13:59
Bump OVH chart image tags and frontend package version to 1.3.4.
Drop the cabcapitalization image override from the OVH values.
Reach host-run companion services (expert agent :5123, simulator :5122)
from the containers via host.docker.internal:

- cabrecommendation & frontend: add host.docker.internal host-gateway mapping
- frontend nginx /powergrid-simu/ upstream is now env-driven
  (POWERGRID_SIMU_UPSTREAM), substituted at startup in start-webui.sh, so one
  config serves local/LAN/k8s
- docker-compose.sh + .env.example/.secrets.example: document the local/server/
  public modes for RL_AGENT_API_URL/TOKEN and POWERGRID_SIMU_UPSTREAM
- README: .secrets-based env setup and expert agent (T2.1_deep_expert) install
Feat/enhance simulator example, added support & instructions for local deployment, updated READMEs.
Two demo-stability fixes that were developed together.

Session handling
----------------
The eval-demo hack that disabled auto-logout entirely is removed. In its
place the access token is now actually renewed:

- new utils/session.ts: decodes the JWT `exp` claim, and funnels every
  "session is over" path through a single handleSessionExpired() guarded
  so a burst of 401s yields one modal and one redirect, not one popup
  per failed request.
- auth store gains refresh()/scheduleRefresh(), a shared in-flight
  refresh promise, and isTokenExpired/canRefresh. A timer renews the
  token a minute before it dies.
- http interceptor retries a 401 once after refreshing, and only ends
  the session when the refresh token is gone too.
- the router guard renews on navigation, so a reloaded tab restoring a
  persisted token does not die at the next poll.
- the card subscription bypasses axios, so it does the same dance itself.
- services store now owns the context-polling interval id, fixing a leak
  where an interval restarted from the retry modal was never cancellable.

PowerGrid "apply action" proxy
------------------------------
The apply POST goes to a same-origin /powergrid-simu/ nginx location to
avoid CORS; several environments were missing their half of that wiring:

- CI never passed the VITE_POWERGRID_SIMU build-arg, so published images
  baked an empty base, posted to / and got nginx 405.
- the k8s configmap had no /powergrid-simu/ location at all.
- the compose and image nginx configs sent an explicit Host header, which
  routes to the wrong vhost behind the passerelle; dropping it lets nginx
  default to $proxy_host, correct for ip:port and vhost upstreams alike.
- .env.example documents the per-environment upstream and no longer
  ships a real RL_AGENT_API_TOKEN value.
@abdratsd
abdratsd merged commit c0b3c84 into IRT-SystemX:main Aug 27, 2026
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant