Commit Graph

10 Commits

Author SHA1 Message Date
Teknium
c5270d2fbb fix(webapp): every stored owner is read by one rule, so old Webapp chats open and adopt again
Review of #145598 (comment 6448254020):

- Chats a Webapp tab imported before the upgrade open again: session_history_mount._reader read the
  import binding by string equality while the sidebar (authorize_history) used the owner rule, so
  the sidebar listed the chat and the open refused it. Both now ask binding_names().
- An old chat a Webapp tab edited is adopted again: bind_legacy_target compared the binding exactly.
- gateway.owner_identity.same_owner is now the one owner rule (owns_row_stamp folded into it), and
  every comparison of a stored owner/binding/principal with a caller in gateway/ goes through it.
- Local stamps match this machine's account only.
- hosted_auth_probe: restore the refused groups.create over another tab's room id and the
  'FORBIDDEN' never reaching the model, adapted to the single-owner contract.
2026-10-27 17:32:49 -07:00
Teknium
aca73b2f64 fix(kanban): a card attempt lost across an owner restart settles interrupted
A Kanban card attempt fenced `unknown` across owner epochs paused its card
session forever: run_task admitted with the worker's principal and a
`{text, finite}` payload, so GW-10's unattended settle rule never matched it.

The dispatcher now hands SessionAuthority.submit a trusted producer marker
(`_kanban_card`, a keyword argument, never a payload field). submit commits
it as `kanban_card_v1`; is_unattended recognises it, so boot recovery and the
drain settle the lost card turn interrupted with the automation notice and
never replay it. Clients cannot mint it: the authority's payload allowlist
and session.submit's parameter allowlist both refuse the key. An attempt
main committed without the marker resubmits unmarked on retry (same digest,
original receipt) and keeps today's pause.

The real-process restart probe (kanban_recovery_probe.py) pinned the old
pause; it now expects terminal/interrupted.

Refs #134889 (KB-8)
Refs #134889 only
2026-10-19 03:00:38 -07:00
unsupportedpastels
021468f4b3 fix(approval): keep the execute_code gate for injected turns in a local session
The whole-script execute_code exemption keyed on the session, not on the
turn. Every turn that runs in a local session's FIFO had a local launch
policy, was no delegated child and had the turn's notifier registered, so a
plugin inject_message turn also skipped the gate: its
shutil.rmtree()/subprocess calls never pass through terminal() and ran with
no prompt, where the base asked.

The exemption now keys on the admission's origin. execute_admission binds the
live session in a new viewer_turn contextvar (beside admission_author) only
for a row the session's viewer submitted through session.submit
(is_viewer_input: the fields SessionAuthority.submit commits, not a hosted:
request). A local_automation_v1 admission (plugin injection, delegation
completions, background-process and watch notices, /loop, heartbeat), a
hosted-room task and every other producer row bind nothing, and the approval
check reads that through approval_context.is_viewer_submitted_turn(). Cron
and managed-worker turns return before the binding, so they keep the gate as
well. No protocol or schema change: the origin is read from the committed
row.

Tests: an injected turn's script that deletes a directory with subprocess
gets the whole-script prompt and, denied, never runs (failed on the base: the
script ran); a viewer submit, a plugin injection and a /loop tick run through
the real drain and only the viewer's turn skips the gate (failed on the base
for the injection and the tick).

Refs #134889 (T2)
Refs #139523
2026-10-16 19:42:20 -04:00
Teknium
9665f6404c feat(gateway): prompt.submit admits the classic CLI's turn_author, api_text and model_override
Main's HermesCLI sends run_conversation an API-only message (voice prefix, model-switch and
skills-reload notes) while persisting the clean text, names the turn's author for memory
attribution, and runs /model --once and /moa as a one-turn runtime swap. Over the session
authority those are facts about ONE admitted turn.

gateway/session_cli_turn.py validates the wire fields (turn_author via parse_turn_author,
api_text as a bounded string, model_override {model, provider?} only) and commits them with the
admission row as cli_turn_v1, so a retry or a queued drain runs exactly what was admitted.
execute_finite_admission binds them for that admission only (cli_turn_scope), row_turn_author
reads the committed author, and the local-operator check accepts the key. A malformed field is
refused with invalid_params before anything is committed.

Contracts: CanonicalSubmitParams declares turn_author / api_text / model_override; generated
TS/OpenRPC regenerated. This commit only admits and binds; the turn uses them next.

(cherry picked from commit bbda17ba96abe5fded71587f31c0ab01423e3178)
2026-10-12 22:25:25 -07:00
Teknium
4d08419982 fix(gateway): canonical prompt.submit admits Desktop hidden and large-paste sends
Desktop's composer adds `display_kind: 'hidden'` to widget intents (goal
control, inline-preview decisions, first-run kickoffs) and `title_preview` to
every paste of 3,000+ characters. The canonical contract and the handler's
closed key set refused both with 4001 invalid_params, which is not a
pre-admission downgrade code: the send failed and Retry failed the same way.

Both fields are now part of the canonical contract and are committed with the
admission row as `display_v1` (gateway/session_display.py), like the surface:
- only `hidden` is client-authorable; any other kind is refused, never
  rendered, so stripped or mistyped presentation cannot turn machine text into
  a visible user bubble;
- the committed presentation binds to the executing admission's own event
  (message_id == admission_id), never to a /queue follow-up on the same task;
- the hidden row persists display_kind=hidden and the preview rides the user
  row's display_metadata (titler input only, never model input), in process
  and in a managed child (re-validated across the bootstrap like surface_v1).
`extra="forbid"` is unchanged everywhere else.

Regression: real AuthorityConnection admission (paste, hidden, plain, minted
kind refused) plus a real gateway.run daemon over the WS (hidden row typed
hidden; preview persisted, absent from every model request). Red on r10-base
(4001 fields=['title_preview']), green after.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5475590057
2026-10-10 06:27:29 -07:00
Brian Fernstrom
c51049aa8f fix(gateway): persist operator provenance for native recovery 2026-10-06 11:58:01 -07:00
Brian Fernstrom
f4fd982b56 fix(gateway): recover mixed local queues and retire failed hot serves 2026-10-06 11:57:52 -07:00
teknium1
a858451b5f fix: -z keeps the oneshot auto-approve over the daemon; operator-mode homes reach the control socket
- hermes -z submits finite+unattended: main's oneshot ran with HERMES_YOLO_MODE (nobody can
  answer a prompt); the daemon mapped it to single-query deny, so execute_code/dangerous
  commands were blocked. -q keeps approvals.single_query_mode. unattended is only admitted
  with finite and binds for that turn alone.
- Control-socket discovery and the owner's peer check refuse group/other WRITE on the profile
  home (the socket-swap vector) instead of any group/other bit: main leaves modes beyond a
  directory link and HERMES_HOME_MODE to the operator, so a symlinked ~/.hermes (or 0750/0701)
  could not reach the gateway at all. Sockets, pointer and fallback directory stay owner-only.
- test_approval redaction tests pin the launch-snapshot switch (order-dependent otherwise).
2026-09-27 03:12:41 -07:00
teknium1
64596711da fix(gateway): HUD and live-voice submits are admitted and noted to the model
Desktop sends surface="hud" / surface="voice-live" (+ voice_context) and the
barge-in flag on prompt.submit; the canonical submit allowlist refused them
with invalid_params. Carry them through admission as a committed surface_v1
payload field, execute the turn under a surface scope and render the note into
the per-turn user-message sidecar, so the frozen system prefix is untouched and
the persisted row stays the words the user typed. The legacy TUI
_hud_surface_note regains its voice-live branch via the same renderer.

Findings: F9 (review F09).
2026-09-12 10:02:05 -07:00
unsupportedpastels
dd6d41e220 fix(gateway): preserve operator access across native and dashboard sessions
A session started in the TUI should be accessible from an authorized remote
Desktop client, but access is still tied to the identity that created it.
That undermines the unified gateway's goal: one live conversation that
clients can join and leave without starting another agent.

The gateway already owns execution; the problem is the creator-identity
check. Native bootstrap and dashboard authentication produce different
subjects, so an otherwise-authorized operator cannot join the same session
when moving between those paths, in either direction. Preserve the existing
operator permissions without rewriting session ownership or attribution.

Issue session:operator only at verified native interactive bootstrap and
existing dashboard WebSocket/HTTP operator gates. Strip that capability from
identity-supplied data, exclude worker-adoption tickets, and retain the real
authenticated subject for attribution. Relax only the canonical LOCAL owner
comparison; preserve profile, instance, operation-capability, subscription,
revision, generation, and legacy first-claim checks.

Persist a private profile/session/principal binding for cross-subject input
so the authority can drain accepted work after disconnect or recovery without
rewriting ownership or losing FIFO and retry identity. Apply the same access
policy to profile session projections and existing metadata/control paths.

Add regression coverage in both directions through real temporary gateway,
SQLite, native bootstrap, and dashboard login/cookie/ticket/WS paths with a
synthetic identity provider and loopback model. Verify reconnect, submission
deduplication, distinct attribution, retained conversation context, unchanged
system messages, and no private provenance in public or model projections.
Update prior owner-only test expectations and document the deliberate access
policy change, trusted credential scope, and recovery evidence limits.

Validation: scripts/run_tests.sh over 89 related files, retries disabled:
439 passed, 0 failed, 1 Windows-only skipped on Linux. Changed Python files
pass Ruff; git diff --check is clean. The new cold-recovery case uses a stub
executor; it does not certify a cross-auth gateway-process crash scenario.

This does not expose the embedded API remotely, change serve deployment,
or implement OpenAI API-to-local session affinity.
2026-09-12 09:02:23 -07:00