Simplify safety steps and retain target feedback - #182
Open
thedataking wants to merge 15 commits into
Open
Conversation
find_unsafe2 now records an entry point's exported name as ffi_symbol, and the summary agents' description of the inventory had drifted from the fields it actually emits. Target listing recognises entry points by either field, and the description names the fields as they are.
Each step used to append its own status notes to the plan, and the loop adopted the edited plan when a step landed. A plan that every step rewrites drifts from the planner's analysis, and a worker cannot tell the planner's conventions from a predecessor's notes. The plan now has no status section, workers are told its contents are guidance rather than rules, and the loop keeps the tree it started with.
… its start Some conversions, an ownership facade or a state-machine rewrite, do not fit in one agent invocation, and a half-finished one cannot pass the checker. Judging every invocation as a whole step forced the agent to either cram or give up. The agent now closes its final message with a verdict. CONTINUE hands the next invocation a checkpoint that must at least build; DONE submits the accumulated change to the full gate battery; BLOCKED discards the edits and says why. Throughout the step the agent's in-sandbox checker baseline stays pinned to the step's start, so its own cargo check-unsafe2 previews the judgment the whole step will face. The cheap unsafe comparison now runs before the test suite so a regressing attempt does not pay for the tests. LLM_SAFETY_ATTEMPT_INVOCATIONS bounds the span; each invocation still consumes fuel.
The agent used to pick its own target from the plan, and the only pressure on it was a nag that escalated after consecutive non-reducing steps and a consecutive-failure cutoff that ended the run. That let it return to the same failed function and let a run stall on refactoring that never touched the count. Each step's prompt now carries a menu built from the unsafety inventory: unsafe mass per file, the largest open functions, and the struct fields still holding raw pointers, minus fields of C-header ABI types that cannot change. The agent names its target; a step that is rejected, refused, or accepted without reducing the count defers that target until some other target reduces, so the menu rotates to the rest. The run stops when no target remains, and prints a ledger of every attempt. The consecutive-failure cutoff and its nags go away with the reason for them.
A run that ended printed the final unsafe count and test exit code and left the reader to work out whether the crate was safe, the budget ran out, every target was exhausted, or the final tests broke. It also exited zero when the final tests failed, so a driver script could not tell. The run now ends with one of COMPLETE_SAFE, SATURATED, BUDGET_EXHAUSTED, or FAILED, and FAILED exits nonzero.
The full report from the most recent review rejection was cleared as soon as any step landed, and was shown to the next attempt whatever target it chose. A rejection at one function could therefore be lost by unrelated accepted work, or read as a rejection of unrelated work. The report is now stored with the target it describes. It survives accepted steps on other targets, is retired only when its own target completes an attempt, and the prompt tells the agent which target it applies to. The bounded list of finding titles from earlier rejections is unchanged and still applies to every attempt.
thedataking
force-pushed
the
perl/optimize-agent-loop2
branch
from
September 6, 2026 23:56
478cc76 to
7e33057
Compare
thedataking
changed the base branch from
perl/ffi-pregate-recovery
to
perl/tolerated-unsafety-review
September 7, 2026 00:06
thedataking
force-pushed
the
perl/optimize-agent-loop2
branch
2 times, most recently
from
September 7, 2026 09:04
cbabd8a to
9664955
Compare
thedataking
force-pushed
the
perl/optimize-agent-loop2
branch
from
September 7, 2026 09:10
9664955 to
e7d373e
Compare
thedataking
force-pushed
the
perl/optimize-agent-loop2
branch
5 times, most recently
from
September 9, 2026 01:52
96d7454 to
7cc9c3d
Compare
thedataking
force-pushed
the
perl/optimize-agent-loop2
branch
from
September 9, 2026 02:19
7cc9c3d to
2e689bc
Compare
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.
Runs each safety step in one invocation, choosing Sol at medium or xhigh effort, then Astra at medium or xhigh effort. Escalates on review findings, two zero-progress attempts, or four steps removing at most eight unsafe operations in total. Progress history resets on tier changes; stays grow through two, four, and eight steps before trying a cheaper tier again. Explicit model overrides remain fixed. Removes continuation and checkpoint recovery.
Retains each target's latest full review report across unrelated work and refusals. Workers consult the relevant report before editing that target again, and invalid target declarations cannot bypass deferral.
Uses Astra to coordinate the initial planning analysts and write SAFETY_PLAN.md. Includes the complete Codex 0.153.4 package for Astra support and reports the final run status with a failing exit code when a final gate fails.
Fixes the resume lookup to find saved plans in the current agent record format.
Stacked on #184.