Skip to content

revert(tui_gateway): drop the heavy session-read admission gate (#215, #441) - #1189

Closed
Kyzcreig wants to merge 2 commits into
mainfrom
audit/unresolved/revert-215-441
Closed

Kyzcreig wants to merge 2 commits into
mainfrom
audit/unresolved/revert-215-441

Conversation

@Kyzcreig

@Kyzcreig Kyzcreig commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Fork-PR audit UNRESOLVED ruling: DROP #215 + #441 (the re-land), reverted as ONE unit. Card t_7c17872a (from t_63023f77; rulings doc PR #1186).

What gets removed:

  • hermes_cli/session_db_heavy_gate.py (deleted)
  • tui_gateway/ws.py: the gate import and _dispatch_ws_request. WS requests go back to asyncio.to_thread(server.dispatch, req, transport).
  • tui_gateway/server.py: _SESSION_DB_HEAVY_METHODS, is_session_db_heavy_method, backend_busy_error, handle_request_bound. The data= parameter on _err stays because methods_prompt.py and methods_bot_relay.py now use it.
  • hermes_cli/web_server.py: the gate import, the 503 shed handler and the /api/status session_db_heavy_reads field. _session_db_read(heavy=True) goes back to the per-loop asyncio.Semaphore(2) it used before feat(tui_gateway): async-side shared heavy-read bound for session.list (seam a) #215.
  • config_defaults: dashboard.heavy_read_max_concurrency
  • The gate tests in tests/test_web_server_sessiondb_eventloop.py and tests/scripts/test_preyield_permit_release.py, plus the live-site line in scripts/check_preyield_permit_release.py. The guard sweep still has one live site (gateway/turn_admission.py::TurnAdmission.slot), and that site's named coverage test stays, so the guard is not vacuous.

A plain git revert conflicted (UD on the gate module; UU on config.py, server.py and ws.py). The defaults had moved to config_defaults.py, and the checkout-admission and event_replay code grew around the same hunks. All of these were resolved by hand.

Why drop it: 0 session_db_heavy_read log lines across ~/.hermes/logs and profiles/*/logs (the gate logs any wait of 1 ms or more), so it has never contended under fleet load. It is 473/474 loc across 5 files, and those files conflicted in all 3 upstream syncs. Upstream bounds reads in its SessionDB read pool instead. One caveat: the live /api/status counter is auth-gated and was not read.

Verification:

  • test-gate (ACE-AI), running pytest on tests/test_web_server_sessiondb_eventloop.py tests/scripts/test_preyield_permit_release.py tests/test_tui_gateway_ws.py tests/tui_gateway/test_ws_keepalive.py: 85 passed
  • ruff --select F on the touched files: no new findings compared with origin/main
  • git grep finds no remaining reference outside docs/ to session_db_heavy_gate, SessionDBHeavyReadBusy, session_db_heavy_reads, heavy_read_max_concurrency, handle_request_bound, backend_busy_error or _dispatch_ws_request

Not merged from the worker lane; open for the merge pass.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…#441)

Reverts 66d98d3 (#215) and its re-land 0986938 (#441) as one unit,
per the fork-PR audit UNRESOLVED ruling (DROP, t_63023f77 / t_7c17872a).

Removed:
- hermes_cli/session_db_heavy_gate.py (SessionDBHeavyReadBusy, the slot,
  stats, lazy dashboard.heavy_read_max_concurrency read)
- tui_gateway/ws.py: gate import + _dispatch_ws_request; WS requests go
  back to asyncio.to_thread(server.dispatch, ...)
- tui_gateway/server.py: _SESSION_DB_HEAVY_METHODS,
  is_session_db_heavy_method, backend_busy_error, handle_request_bound
  (_err's data= param kept: methods_prompt/methods_bot_relay use it)
- hermes_cli/web_server.py: gate import, 503 shed handler and the
  /api/status session_db_heavy_reads field; _session_db_read(heavy=True)
  returns to the pre-#215 per-loop asyncio.Semaphore(2)
- config_defaults: dashboard.heavy_read_max_concurrency
- gate tests in tests/test_web_server_sessiondb_eventloop.py and
  tests/scripts/test_preyield_permit_release.py; the guard script's
  live-site list. The guard sweep keeps a live site
  (gateway/turn_admission.py) and its named coverage test.

Why: 0 'session_db_heavy_read' log lines across ~/.hermes/logs and
profiles/*/logs (no read ever queued >= 1 ms); 473/474 loc across 5 files
conflicting in all 3 upstream syncs; upstream bounds reads in its
SessionDB read pool instead.

Verified: test-gate (ACE-AI) pytest tests/test_web_server_sessiondb_eventloop.py
tests/scripts/test_preyield_permit_release.py tests/test_tui_gateway_ws.py
tests/tui_gateway/test_ws_keepalive.py -> 85 passed. ruff --select F on the
touched files: no new findings vs origin/main.
@ang-fleet-lander

Copy link
Copy Markdown

🤖 merged-by: daedalus-opus · lane: t_f201acde · gate: BYPASS: FleetReview paused by Ace 2026-09-22 (state/fleetreview-pause marker present) · why: fork-PR audit DROP (Ace ruling 1A, campaign t_03e35f0e, card t_7c17872a): revert-#215+#441; PR CI green on head; conflict-free vs fork/main + sibling reverts (merge-tree chain)

@ang-fleet-lander
ang-fleet-lander Bot added this pull request to the merge queue Sep 26, 2026
@Kyzcreig
Kyzcreig removed this pull request from the merge queue due to a manual request Sep 26, 2026
@Kyzcreig

Copy link
Copy Markdown
Collaborator Author

Superseded by batched PR #1230 (card t_7c5e08a5). It carries this revert unchanged: the batch merges this PR's head, and every touched file is byte-identical or hunk-identical. Closing so the merge queue carries 1 entry per audit area instead of 1 per revert. The branch is kept.

@Kyzcreig Kyzcreig closed this Sep 26, 2026
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