Skip to content

fix(goal): keep unbound tool rejections recoverable - #343

Open
1anZhang wants to merge 1 commit into
mainfrom
fix/goal-unbound-turn-recovery
Open

1anZhang wants to merge 1 commit into
mainfrom
fix/goal-unbound-turn-recovery

Conversation

@1anZhang

@1anZhang 1anZhang commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Change

A follow-up user turn can call update_goal(status="complete") after a Goal has already completed, or while a Goal is still active. Ordinary user turns do not carry a Goal execution binding. Previously, the collector classified this missing binding as stale, and the tool incorrectly reported that the objective had changed and forcibly ended the turn. The model could not recover from the rejected call and continue handling the user's clarification.

This change separates an unbound turn from an invalidated Goal turn:

  • The collector returns not_a_goal_turn when the current turn has no Goal binding.
  • update_goal returns a tool error with the current Goal snapshot and recovery guidance, without setting terminate or accepting a status proposal.
  • A bound turn whose Goal ID or objective digest changed still takes the existing terminating rejection path. Accepted terminal proposals and budget-summary restrictions keep their existing behavior.

The change is limited to the collection result type, collector classification, and tool error handling. Existing tests cover unbound turns with active/completed Goals, unchanged durable state, and termination after a Goal replacement. No test files were added. Goal admission, scheduling, accounting, and verifier settlement are unchanged. This fixes recovery from a mistaken tool call; it does not establish that a model's completion claim is correct.

Validation

  • PASS: focused Goal tool, host settlement, and explicit-reset continuation suites, 3 files / 88 tests, on macOS arm64, Node 22.22.2:
    pnpm exec vitest run --config vitest.oss.config.mjs \
      packages/agent-modules/goal/test/unit/thread-goal/tool-impls.test.ts \
      packages/local-runtime/test/unit/thread-goal/host-integration-settlement.test.ts \
      packages/local-runtime/test/unit/thread-goal/host-integration-explicit-reset-rearm.test.ts
  • PASS: pnpm verify, full profile on clean commit 389c7ca: all 15 applicable gates, including source export, release tooling, lint, typecheck, build/artifacts, capabilities (172 files / 4,586 passed, 14 skipped), status contract, CLI smoke, offline BYOK, permissions, and macOS sandbox. Windows and release-archive profiles are not applicable to this local run.
  • PASS: git diff --check; the built CLI chunk contains the new recoverable rejection.
  • Performance: perf:full, because the change affects whether a Goal tool result ends a turn. The latest-head/base CI result remains required before merge.
  • NOT RUN: live-model completion/recovery scenarios, interactive product E2E, Windows/Linux acceptance. Offline tests verify tool/runtime contracts, not model task-understanding or verifier accuracy.

Publication and contribution checks

  • Changes are contributed under the existing applicable licenses; existing notices are preserved.
  • No credentials, account data, real user content, internal source history, or private review material is included.
  • Only existing source/test files changed; no inventory regeneration or test-suite registration is needed.
  • No documentation or configuration workflow changes are required. Offline results are not described as live-service acceptance.

Maintainer handoff

Publication scope or license changes: none.

Shared-source port: pending.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@1anZhang 1anZhang added bug Something isn't working cli Standalone mcode: TUI, headless, ACP and source builds/tooling perf:full Run the full performance suite; required for performance-sensitive changes labels Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cli Standalone mcode: TUI, headless, ACP and source builds/tooling perf:full Run the full performance suite; required for performance-sensitive changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants