Skip to content

Keep failed goal blocks with their turn and settle verified successors - #2503

Closed
trissim wants to merge 6 commits into
mainfrom
fix/p448-goal-turn-block
Closed

trissim wants to merge 6 commits into
mainfrom
fix/p448-goal-turn-block

Conversation

@trissim

@trissim trissim commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

P448: a failed goal turn has one block writer and retains its turn

Implementation checkpoint; not merged, installed or live-accepted.

  • FailedGoalTurn.settle_launched writes the terminal's own failure reason and TurnId once. Deleted Done.observe_goal's failure block, EndedWithoutResult's extra block, and the now-unused permit/account blocking path.
  • BlockedGoal owns verified-success supersession through its declared ActiveGoal successor. Only the same captured block, observed before a distinct successful productive turn, qualifies. Explicit goal-action blocks have no failed turn and keep explicit Retry.
  • Verified settlement also handles fresh message turns without a goal launch permit; blocked goals otherwise never enter permit settlement. Same goal ID, incarnation and worktree are required. UUID ordering is not invented: the pre-turn captured state establishes chronology.
  • Removed blank-success early blocking; unsuccessful/unproductive goal turns go through the same terminal failure writer.
  • Completed the related family: goals created during a turn now use that same failure writer and carry the same TurnId. Deleted FailedGoalOrigin, Goals.block_failed_origin, GoalTurnPermit.fail_origin and both implementations, and the obsolete observe_goal callback/production invocation.

Source evidence

Before and after: refactor-audit Package.load parsed 427 production modules with no omissions. AST declarations and name/attribute consumers retained in owned scratch ast-before.json and ast-after.json (126 before / 90 after related sites; spelling set expanded after for new/deleted members, so these are source inventories, not a score). Relevant declarations/consumers: goal_states.py, goals.py, goal_management.py, goal_attempts.py, turn_goal_account.py, goal_turn_permit.py, turn_terminal.py, turn_progress.py, agent_events.py. Dynamic MroDispatch handler execution is confirmed by behavior checks, not claimed as AST-resolved. External scheduler launch refusal calls have no launched turn and remain explicit/non-recoverable.
Patterns: IDEN-5 (block detached from failed turn), IMPL-12 (three failure-block decisions), TIME-1 (removed superseded early block methods).
Whole-source required check: before 2, after 0:
grep -rnE 'Backend turn failed; inspect|Backend turn ended without a result; inspect' src | wc -l

Read-only live history (SQLite mode=ro, before editing)

Attribution is from the exact recorded reason and source writer, not a persisted stack trace. Turn chronology comes from retained turn files; goal history does not record the failure turn today.

All six recent backend blocks have Done.observe_goal's exact reason (Backend turn failed; inspect local diagnostics before resuming.); none has FailedGoalTurn.settle_launched's or EndedWithoutResult's reason:

  • unit-checkrule history1352: preceding turn9 160f84d09fd24a5898af7be3b3b453ab; next turn10 d489fa29bc7aa51b65c926a6d3c11c68.
  • unit-checkrule history1395: preceding turn14 6128762164df4c218772eb143537fcb1; next turn15 9f32d23ae35605a048430eade9deedd6.
  • fork-boundaries history1353: preceding turn115 ef8730ea67e0463d9f633f962575536e; next turn116 a0f3eeeb14b51aedb240cf6eebf5fb69.
  • fork-boundaries history1381: preceding turn119 a4dc0efa0aee4232ab9e2ee10cb70e62; next turn120 d94636a0974e44d21bbb55e2e48509c5.
  • unit-runtime-root history1349: preceding turn17 0b89f6c08fac4b19b9da6ccb042f07ad; next turn18 64252b3c35be041ecf2ce76679be119c.
  • unit-runtime-root history1374: preceding turn21 4c8805bbe469419cb29e2ee2111c8d87; next turn22 8149a7e47bffaadf620d169e0994b838.
    Older boundaries history1003 is an explicit model block about UNKNOWN completion (not any of the three writers); next turn11 8c5f6021f020a9ba4711f0a1e6900a67. History1136 is an administrative unresolved-attempt block, also not one of the three; next turn97 25326452b8f963c016d00d886c8841ea.

Verification

Three requested tests added to existing copied-bus test family. 6 passed in 6.19s, exit 0, using real registry/history/turn/attempt owners on isolated copied buses. Final obsolete-observer deletion rerun is recorded separately. The first test parametrizes original/origin goals and reported failure/missing result:

  • test_failed_goal_turn_writes_one_block_naming_turn
  • test_later_verified_turn_supersedes_failed_turn_block
  • test_goal_action_block_survives_later_verified_turn
    Ran only these under background timeout 300, PYTHONPATH=src, shared interpreter /home/ts/code/projects/agent-comms/.venv/bin/python, -n 0 -o faulthandler_timeout=60 -q, owned --basetemp=/home/ts/.cache/agent-scratch/unit-goalblock/pytest-published. No ratchets/full suite run locally. Tests load real state through Comms after settlement; installed Toad/native message journey remains merger qualification.

Assumed:

  • Verified progress requires a successful terminal plus assistant output or a successful tool; mere tool calls during a still-running/failed turn cannot clear a block.
  • Existing blocks without a retained failed TurnId are not retrospectively attributed or cleared.
  • Unlaunched scheduler refusals and explicit goal-action blocks remain retry-controlled.
  • Recovery of displayed goal state does not authorize/replay the original failed/UNKNOWN input. The failed attempt ledger is retained. Merger must qualify this scheduling boundary and the actual installed Toad path; no installed acceptance claimed.
  • Fresh installation qualification belongs to the merger; worker preserves live source, sessions and uncertain inputs.

trissim commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Closed by claude-ai: P448 landed as #2529 (derived goal execution, owner stop wins over the backend's failure report) and #2564 (generation-owned evidence, report-only blocked work, no reissue). This earlier approach to the same problem is superseded.


Generated by Claude Code

@trissim trissim closed this Oct 21, 2026
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