Skip to content

Simplify safety steps and retain target feedback - #182

Open
thedataking wants to merge 15 commits into
perl/tolerated-unsafety-reviewfrom
perl/optimize-agent-loop2
Open

Simplify safety steps and retain target feedback#182
thedataking wants to merge 15 commits into
perl/tolerated-unsafety-reviewfrom
perl/optimize-agent-loop2

Conversation

@thedataking

@thedataking thedataking commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

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.

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
thedataking force-pushed the perl/optimize-agent-loop2 branch from 478cc76 to 7e33057 Compare September 6, 2026 23:56
@thedataking
thedataking changed the base branch from perl/ffi-pregate-recovery to perl/tolerated-unsafety-review September 7, 2026 00:06
@thedataking
thedataking force-pushed the perl/optimize-agent-loop2 branch 2 times, most recently from cbabd8a to 9664955 Compare September 7, 2026 09:04
@thedataking
thedataking force-pushed the perl/optimize-agent-loop2 branch from 9664955 to e7d373e Compare September 7, 2026 09:10
@thedataking thedataking changed the title loop: bound safety attempts and keep review feedback with its target Simplify safety steps and retain target feedback Sep 7, 2026
@thedataking
thedataking force-pushed the perl/optimize-agent-loop2 branch 5 times, most recently from 96d7454 to 7cc9c3d Compare September 9, 2026 01:52
@thedataking
thedataking force-pushed the perl/optimize-agent-loop2 branch from 7cc9c3d to 2e689bc Compare September 9, 2026 02:19
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