Skip to content

fix(memory,skills): repair write-approval inline prompt, gateway staging, and gateway /skills review#43452

Merged
teknium1 merged 1 commit into
mainfrom
fix/write-approval-gate-followups
Jun 10, 2026
Merged

fix(memory,skills): repair write-approval inline prompt, gateway staging, and gateway /skills review#43452
teknium1 merged 1 commit into
mainfrom
fix/write-approval-gate-followups

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

The write-approval gate from #38199 now actually works on its two headline surfaces: the inline CLI prompt approves/denies instead of silently denying every gated memory write, and gateway sessions stage writes (and can review staged skills) instead of dead-ending in a CLI-only prompt.

Found in a post-merge review of #38199/#43354 via E2E with real imports — the unit suite only exercised the no-callback staging branch, so both breaks shipped green.

What was broken

  • _prompt_inline_memory_approval() called prompt_dangerous_approval() without the per-thread approval callback. Under prompt_toolkit the [Bug]: approval prompt get_input deadlocks against prompt_toolkit MainThread (regression of #13617) #15216 fail-closed guard returns "deny" instantly → every gated foreground memory write reported "denied by user" with no prompt ever shown. Verified: registered an approving callback, write blocked, callback invoked 0 times.
  • _interactive_approval_available() returned True for gateway sessions, but the gateway /approve round-trip lives in the pending-approval queue, which prompt_dangerous_approval never reaches → gated gateway memory writes hit the input() fallback and denied (EOF/timeout).
  • /skills pending|approve|reject|diff was CLI-only — a skill staged from a Telegram session could not be reviewed from Telegram, contradicting the feat(memory,skills): approve/deny gate for memory + skill writes #38199 PR body.

Changes

  • tools/write_approval.py: inline path invokes the registered CLI callback directly (a crashed prompt falls back to staging, never a silent deny); gateway contexts stage; stale tri-state write_mode docstrings rewritten for the boolean gate.
  • gateway/slash_commands.py + gateway/run.py: new _handle_skills_command — review-only /skills surface (pending/approve/reject/diff/approval) with chat-safe diff truncation; staged writes remain reviewable even after the gate is turned off.
  • hermes_cli/commands.py: /skills gains gateway_config_gate="skills.write_approval" so it only appears on gateway surfaces when the gate is in use.
  • tools/memory_tool.py: param validation moved before the gate — invalid writes are rejected immediately instead of staged and failing at approve time.
  • website/docs/user-guide/features/memory.md: inline prompt documented as interactive-CLI-only.
  • tests/tools/test_write_approval.py: 6 new tests — inline approve/deny/error, gateway staging, skills never-prompt invariant, pre-gate validation.

Validation

Result
tests/tools/test_write_approval.py 25 passed (19 existing + 6 new)
Targeted suites (memory_tool, skill_manager_tool, commands, verbose_command) 336 passed
E2E (isolated HERMES_HOME, real imports) CLI approve commits + callback invoked; CLI deny blocks; gateway stages; /skills gateway handler roundtrips pending→diff→approve→on-disk skill

Infographic

write-approval-gate-fixed

…ing, and gateway /skills review

Follow-ups to #38199/#43354 found in post-merge review:

- Inline CLI memory approval never worked: the per-thread approval callback
  was not passed to prompt_dangerous_approval, so the prompt_toolkit
  fail-closed guard (#15216) denied every gated foreground write without
  showing a prompt. Now invokes the registered callback directly; a crashed
  prompt falls back to staging instead of a silent deny.
- Gateway sessions claimed inline support but prompt_dangerous_approval has
  no gateway round-trip (that lives in the pending-approval queue), so gated
  gateway memory writes hit the input() fallback and denied. Gateway
  contexts now stage for /memory pending review.
- /skills pending|approve|reject|diff|approval now works on the gateway
  (gateway_config_gate on skills.write_approval), so skills staged from a
  messaging session can be reviewed there. Diff output truncated for chat.
- memory_tool validates required params before the gate so invalid writes
  are rejected immediately instead of staged and failing at approve time.
- Stale tri-state write_mode docstrings updated to the boolean gate; docs
  table corrected (inline prompt is interactive-CLI-only).
- 6 new tests covering the interactive approve/deny/error paths, gateway
  staging, skills never-prompt invariant, and pre-gate validation.
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists tool/memory Memory tool and memory providers comp/gateway Gateway runner, session dispatch, delivery comp/cli CLI entry point, hermes_cli/, setup wizard labels Jun 10, 2026
@teknium1 teknium1 merged commit 70d5d7e into main Jun 10, 2026
24 checks passed
@teknium1 teknium1 deleted the fix/write-approval-gate-followups branch June 10, 2026 09:57
changman pushed a commit to changman/hermes-agent that referenced this pull request Jun 10, 2026
…ing, and gateway /skills review (NousResearch#43452)

Follow-ups to NousResearch#38199/NousResearch#43354 found in post-merge review:

- Inline CLI memory approval never worked: the per-thread approval callback
  was not passed to prompt_dangerous_approval, so the prompt_toolkit
  fail-closed guard (NousResearch#15216) denied every gated foreground write without
  showing a prompt. Now invokes the registered callback directly; a crashed
  prompt falls back to staging instead of a silent deny.
- Gateway sessions claimed inline support but prompt_dangerous_approval has
  no gateway round-trip (that lives in the pending-approval queue), so gated
  gateway memory writes hit the input() fallback and denied. Gateway
  contexts now stage for /memory pending review.
- /skills pending|approve|reject|diff|approval now works on the gateway
  (gateway_config_gate on skills.write_approval), so skills staged from a
  messaging session can be reviewed there. Diff output truncated for chat.
- memory_tool validates required params before the gate so invalid writes
  are rejected immediately instead of staged and failing at approve time.
- Stale tri-state write_mode docstrings updated to the boolean gate; docs
  table corrected (inline prompt is interactive-CLI-only).
- 6 new tests covering the interactive approve/deny/error paths, gateway
  staging, skills never-prompt invariant, and pre-gate validation.
teknium1 added a commit that referenced this pull request Jun 11, 2026
…slash-command docs (#43801)

The memory/skill write-approval gate (#38199, #43354, #43452) was only
documented inside features/memory.md. Surface it everywhere users will
actually look:

- features/skills.md: new 'Gating agent skill writes' section under
  skill_manage, with the staging semantics, review commands, and the
  distinction from skills.guard_agent_created
- configuration.md: memory.write_approval added to the Memory
  Configuration block; new 'Write approval for skill writes' subsection
  next to the guard_agent_created scanner
- reference/slash-commands.md: /memory and /skills review subcommands in
  both the CLI and messaging tables; Notes updated since /skills
  pending/approve/reject/diff/approval now works on the gateway
- features/memory.md: cross-link to the new skills section
alt-glitch pushed a commit that referenced this pull request Jun 14, 2026
…ing, and gateway /skills review (#43452)

Follow-ups to #38199/#43354 found in post-merge review:

- Inline CLI memory approval never worked: the per-thread approval callback
  was not passed to prompt_dangerous_approval, so the prompt_toolkit
  fail-closed guard (#15216) denied every gated foreground write without
  showing a prompt. Now invokes the registered callback directly; a crashed
  prompt falls back to staging instead of a silent deny.
- Gateway sessions claimed inline support but prompt_dangerous_approval has
  no gateway round-trip (that lives in the pending-approval queue), so gated
  gateway memory writes hit the input() fallback and denied. Gateway
  contexts now stage for /memory pending review.
- /skills pending|approve|reject|diff|approval now works on the gateway
  (gateway_config_gate on skills.write_approval), so skills staged from a
  messaging session can be reviewed there. Diff output truncated for chat.
- memory_tool validates required params before the gate so invalid writes
  are rejected immediately instead of staged and failing at approve time.
- Stale tri-state write_mode docstrings updated to the boolean gate; docs
  table corrected (inline prompt is interactive-CLI-only).
- 6 new tests covering the interactive approve/deny/error paths, gateway
  staging, skills never-prompt invariant, and pre-gate validation.
alt-glitch pushed a commit that referenced this pull request Jun 14, 2026
…slash-command docs (#43801)

The memory/skill write-approval gate (#38199, #43354, #43452) was only
documented inside features/memory.md. Surface it everywhere users will
actually look:

- features/skills.md: new 'Gating agent skill writes' section under
  skill_manage, with the staging semantics, review commands, and the
  distinction from skills.guard_agent_created
- configuration.md: memory.write_approval added to the Memory
  Configuration block; new 'Write approval for skill writes' subsection
  next to the guard_agent_created scanner
- reference/slash-commands.md: /memory and /skills review subcommands in
  both the CLI and messaging tables; Notes updated since /skills
  pending/approve/reject/diff/approval now works on the gateway
- features/memory.md: cross-link to the new skills section
AIalliAI pushed a commit to AIalliAI/Hermes that referenced this pull request Jun 14, 2026
…slash-command docs (NousResearch#43801)

The memory/skill write-approval gate (NousResearch#38199, NousResearch#43354, NousResearch#43452) was only
documented inside features/memory.md. Surface it everywhere users will
actually look:

- features/skills.md: new 'Gating agent skill writes' section under
  skill_manage, with the staging semantics, review commands, and the
  distinction from skills.guard_agent_created
- configuration.md: memory.write_approval added to the Memory
  Configuration block; new 'Write approval for skill writes' subsection
  next to the guard_agent_created scanner
- reference/slash-commands.md: /memory and /skills review subcommands in
  both the CLI and messaging tables; Notes updated since /skills
  pending/approve/reject/diff/approval now works on the gateway
- features/memory.md: cross-link to the new skills section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants