Files
hermes-agent/agent
Teknium 6ec9d85795 feat: retain a safety-refused turn for display, still hidden from the model
Replace the durable ERASE of a content-policy-refused turn with a RETAIN-for-display:
the whole refused turn (user row + any tool rounds + the refusal) still leaves the
MODEL's context exactly as /undo does — so the deterministic safety filter can't
re-trip and lock the chat — but the user's own message now STAYS VISIBLE in the chat
surfaces as a greyed "refused, try a different query" block that survives a close+reopen.

Teknium's directive: wipe the refused turn forward out of the model conversation, but
keep showing it in the surfaces (Desktop primary, then CLI/TUI), collapsing the raw tool
actions + refusal detail into a short notice.

Mechanism (verified via the store's own model vs display reads): the refused turn head
(the user row) is kept in the DISPLAY projection as active=0, compacted=1 — the same way
compaction-archived rows stay visible — and tagged display_kind='content_refused' with a
stored CONTENT_REFUSED_NOTICE; the tool rounds + refusal stay soft-deleted (removed) so
only one greyed notice renders. The model read is active=1, so it sees none of it.

- agent/turn_failure_copy.py: CONTENT_REFUSED_DISPLAY_KIND / _NOTICE / _METADATA_KEY.
- hermes_state_rewind.py: SessionDB.retain_refused_turn_for_display (reuses the /undo
  rewind for the model side, then re-surfaces + tags the user row); the owner helper
  retain_refused_turn_for_display replaces erase_refused_turn_from_transcript.
- gateway/session_transcript.py + run_turn_persistence.py: async-store retain + owner call.
- hermes_cli/cli_chat_turn_mixin.py, acp_adapter/server.py: call the retain helper.

Tests (red on base — base full-rewind drops the ask from the display read): the refused
turn leaves the model but stays in the display tagged content_refused, survives a
simulated reopen, and the best-effort no-ops. Existing ACP + gateway model-exclusion
tests stay green (active-only reads unchanged).
2026-11-05 22:23:44 -08:00
..
…
2026-10-20 21:04:30 -04:00
2026-10-20 21:04:30 -04:00
2026-10-21 23:05:11 -04:00
…
…
2026-10-20 22:18:49 -04:00
2026-10-21 23:05:11 -04:00