Skip to content

fix(blackbox): background_review fork inherits parent chat context#12

Merged
Kyzcreig merged 0 commit into
mainfrom
fix/background-review-chat-attribution
Jun 4, 2026
Merged

fix(blackbox): background_review fork inherits parent chat context#12
Kyzcreig merged 0 commit into
mainfrom
fix/background-review-chat-attribution

Conversation

@Kyzcreig

@Kyzcreig Kyzcreig commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Problem

Memory/skill background-review forks (the "Review the conversation above…" agents in agent/background_review.py) constructed their AIAgent with platform= but without chat_id/chat_name/chat_type. Their blackbox telemetry rows therefore landed with empty chat fields — un-attributable in /cost session and the blackbox DB.

Root cause

Verified empirically against the live Aegis blackbox DB: all post-#9 turns with empty chat_id were exactly these review forks (user_text = "Review the conversation above…"), while real user turns populated correctly. The fork passed every other runtime field but dropped the chat context.

Fix

Pass parent's _chat_id/_chat_name/_chat_type (coerced to "") into the review-fork AIAgent.

Test

test_review_fork_inherits_parent_chat_context asserts the fork inherits all three chat fields. Full background_review + blackbox suites green (67 passing).

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

🔎 Lint report: fix/background-review-chat-attribution vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9831 on HEAD, 9831 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5117 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@Kyzcreig Kyzcreig merged this pull request into main Jun 4, 2026
24 checks passed
@Kyzcreig Kyzcreig deleted the fix/background-review-chat-attribution branch June 4, 2026 13:10
Kyzcreig added a commit that referenced this pull request Jun 5, 2026
* docs: remote desktop connect uses username/password, not --insecure + session token (NousResearch#38926)

The documented path for connecting Hermes Desktop to a remote backend was
`--insecure` + a pinned HERMES_DASHBOARD_SESSION_TOKEN — an unauthenticated
bind plus a copy-pasted token. Replace it everywhere with the bundled
username/password dashboard-auth provider: set HERMES_DASHBOARD_BASIC_AUTH_*,
run `hermes dashboard --host 0.0.0.0` (the non-loopback bind engages the auth
gate), and Sign in from the app.

- desktop.md: rewrite 'Connecting to a remote backend' for the user/pass + Sign in flow
- web-dashboard.md: rewrite both remote-backend sections (overview + dedicated);
  reframe the auth-gate section so --insecure is a discouraged escape hatch, not a
  co-equal use case; drop the removed --tui flag from the systemd example
- environment-variables.md: lead with HERMES_DASHBOARD_BASIC_AUTH_*; drop the
  session-token / HERMES_DESKTOP_REMOTE_TOKEN remote-connect entries
- docker.md: mention the username/password provider as the simplest gate provider

* fix(cli): clear screen on exit so live chrome isn't stranded in scrollback (NousResearch#38928)

The classic CLI left its live bottom chrome — the status bar, input box,
and separator rules — frozen in terminal scrollback after exit, on every
exit path (/exit, /quit, Ctrl+C, EOF) and on both Linux and Windows. The
prior erase_when_done=True fix (bf82a7f) routes prompt_toolkit's teardown
through renderer.erase(), but that walks back by the renderer's internal
cursor model and does not reliably wipe the chrome in practice — users still
saw a dead status bar + the rest of the session sitting above the resume
summary.

Clear the screen + scrollback directly at the single exit funnel instead.
All exit paths converge on _print_exit_summary() (called from the run-loop
finally block after app.run() returns and prompt_toolkit has restored
terminal modes), so a new _clear_terminal_on_exit() helper runs there before
the summary prints. It writes ESC[3J ESC[2J ESC[H (erase scrollback, erase
screen, home cursor) on a real TTY, no-ops silently when stdout is not a
terminal (pipes/redirects), and falls back to the platform clear command if
the escape write fails. Works on Linux, macOS, and modern Windows terminals
(Terminal/conhost with VT processing, already enabled by prompt_toolkit).

The resume/goodbye summary now prints at a clean top-left with nothing
stranded above it.

Fixes NousResearch#38252.

* feat(approval): env-gated reboot/shutdown downgrade (HERMES_ALLOW_REBOOT)

The reboot/shutdown family is on the unconditional hardline blocklist —
the correct default for most agents, but a hard blocker for fleet/ops
agents that legitimately need to restart the Linux hosts they manage.

Add an opt-in escape hatch: when HERMES_ALLOW_REBOOT is set truthy, the
reboot/shutdown family downgrades from HARDLINE to the DANGEROUS layer —
still approval-gated, and yolo / approvals.mode=off can pass it through.
Every other catastrophic pattern (root recursive delete, filesystem
format, raw-device overwrite, fork bomb, kill -1) stays unconditionally
hardline.

Default (flag unset) is byte-identical to the historical always-block
behavior. Verified: 129 tests pass including new downgrade and
isolation tests.

* fix(blackbox): background_review fork inherits parent chat context

Memory/skill background-review forks constructed AIAgent with platform=
but no chat_id/chat_name/chat_type, so their blackbox telemetry rows landed
with empty chat fields and were un-attributable in /cost session.

Pass through parent's _chat_id/_chat_name/_chat_type (coerced to '') so
review-fork turns are attributed to the originating channel.

Regression test asserts the fork inherits all three chat fields.

---------

Co-authored-by: Teknium <127238744+teknium1@users.noreply.github.com>
Co-authored-by: Kyzcreig <9063726+Kyzcreig@users.noreply.github.com>
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