fix(server,agent): apply Tasks 3-5 review fixes (non-blocking)
All checks were successful
All checks were successful
From the secure-session-core Tasks 3-5 code review (APPROVE-WITH-FIXES): - MEDIUM-2: delete the dead `validate_agent_key` "accept-any-key" placeholder + its AuthenticatedAgent/AuthState scaffolding (zero callers; the real agent auth is validate_agent_api_key + per-agent cak_ keys). Removes an auth landmine. - LOW-3: stop interpolating support-code values into 3 relay log lines (bearer credentials). - LOW-1: document the X-Real-IP trust requirement in ip_extract.rs (NPM must set it from $remote_addr); behavior unchanged. - LOW-2: correct the consent/heartbeat comment in agent session loop (the loop awaits the dialog; safe because CONSENT_TIMEOUT 60s < HEARTBEAT_TIMEOUT 90s). cargo fmt/clippy(-D warnings)/test all green on GURU-5070 (89 tests, 0 warnings). MEDIUM-1 (viewer-token logout revocation) remains a tracked follow-up. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -555,8 +555,14 @@ impl SessionManager {
|
||||
access
|
||||
);
|
||||
|
||||
// The MessageBox blocks the calling thread; run it on the blocking pool
|
||||
// so the agent's async loop is not stalled and heartbeats keep flowing.
|
||||
// The MessageBox blocks the calling thread, so it runs on the blocking
|
||||
// pool to avoid stalling the tokio runtime. Note, however, that the main
|
||||
// session loop `.await`s this method (see the ConsentRequest arm), so
|
||||
// the loop is SUSPENDED for the user's entire think-time and does NOT
|
||||
// process or respond to server heartbeats while the dialog is open.
|
||||
// This is safe because CONSENT_TIMEOUT_SECS (60s, server-side) is within
|
||||
// the server's 90s HEARTBEAT_TIMEOUT_SECS: the prompt resolves before the
|
||||
// server would consider the agent dead, so the session is not torn down.
|
||||
let granted = tokio::task::spawn_blocking(move || prompt_consent(&technician_name, access))
|
||||
.await
|
||||
.unwrap_or_else(|e| {
|
||||
|
||||
Reference in New Issue
Block a user