fix(goal): bound goal-driven turns and map ESC to goal pause - #280
Merged
Conversation
- GOAL-TURN-SCOPE: process-local turn provenance for kick/continuation/resume-kick - cap goal turns at min(agent.steps, GOAL_TURN_MAX_STEPS=50) so every turn reaches idle where judge/budget engage - ESC on a goal turn now pauses the goal instead of auto-resurrecting via judge continuation - statusLine shows 执行中 while a goal turn runs; honest budget-exhaustion/resume texts - tests: turn-scope.test.ts (9 cases)
This was referenced Aug 15, 2026
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.
Problem
Session ses_fe5ffaee337c9jD5JRqJyzB5fr 生产事故:
/goal 完成TODO后 goal_state 停留 active/turns_used=0/20 超 10 分钟,judge 从未运行。根因(日志+DB+源码三方定位):GoalLoop 纯 idle 事件驱动,而 build agent 无 steps 配置 → 首轮
agent.steps ?? Infinity无界执行(step 67+)→ idle 永不到来 → judge/budget/全部防御不可达。reasoner 推演确认 3 个 Critical:
Fix(GOAL-TURN-SCOPE)
GoalPrompts.GOAL_TURN_MAX_STEPS = 50:goal 驱动轮步数上限min(agent.steps ?? ∞, 50)(用户更严格配置始终优先),保证每轮必达 idle 使 judge/budget 接管Review
subagent review VERDICT: PASS(0 blocking / 4 info)。#1 purgeSession 对称性、#2 admit-mark 窗口(mark 提前到 admitIfIdle 前)已修;#3 记录为已知边界(dispatch 已有 busy guard);#4 集成测试部分补充。
Verification
bun typecheck(packages/opencode) 干净bun test test/goal test/session/prompt.test.ts:175 pass / 0 fail / 1 skip(既有 skip)