fix(fork,shell_safety): actionable override hint and blank-error crash - #31
Open
12britz wants to merge 1 commit into
Open
fix(fork,shell_safety): actionable override hint and blank-error crash#3112britz wants to merge 1 commit into
12britz wants to merge 1 commit into
Conversation
fork: a failed fork whose result error is empty/whitespace crashed the failure banner with IndexError (str(error).strip().splitlines()[0] on an empty string). The blanket except then swallowed the failure, so the user got no error text at all. Fall back to the raw error when there is no first line, and let the emit actually run. shell_safety: the blocked-command hint told the agent to '/set yolo_mode true', but the callback only ever runs while yolo_mode is already on — a guaranteed no-op that wasted a turn. All three blocking messages now point only at the setting that actually changes behavior. The exception path is also fixed: it suggested raising safety_permission_level to the level of the very command that could not be assessed, defeating fail-closed; it now explains the assessment failed and points at manual review instead. Includes regression tests for both fixes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two small reliability fixes, each with a regression test:
1. fork — blank-error crash hides the failure (fixes #30)
fork/register_callbacks.py:282:When a fork's result carries an empty/whitespace error,
splitlines()returns[]and[0]raisedIndexError. The blanketexceptswallowed it, so the fork was marked failed with no error message at all.Now falls back to the raw error string when there is no first line, and lets the
_emit_erroractually run.2. shell_safety — override hint is a guaranteed no-op (fixes #25)
The safety callback only ever runs while
yolo_modeis already true — it returnsNonesilently otherwise. Yet all three blocking messages told the agent to/set yolo_mode true, wasting a turn. All three now point only at the setting that actually changes behavior.The exception path was worse: it declared risk HIGH and suggested raising
safety_permission_levelto high — the level of the very command that could not be assessed — defeating fail-closed. It now explains the assessment failed and points at manual review instead.Tests
tests/test_fork_plugin.py—test_fork_reports_blank_error_without_crashingtests/test_shell_safety_override_hint.py— new suite asserting the hint never suggestsyolo_mode trueand the fault path never raises permission to the fault levelruff check+ruff format --checkclean