Repository navigation
ga: enforce long-term settlement at task completion for 15+ turn tasks - #821
Open
louisss1016 wants to merge 1 commit into
Open
louisss1016 wants to merge 1 commit into
louisss1016 wants to merge 1 commit into
Conversation
lsdefine#789) The tool schema only *asks* the model to call start_long_term_update when a 15+ turn task completes; nothing enforces it, and observed runs finished on turn 20/39 with zero settlement calls. do_no_tool() now runs a one-time completion gate: at/above the threshold a normal completion enters the existing settlement phase (reusing do_start_long_term_update, no duplicated prompt/SOP logic) instead of exiting. Exemptions: settlement already started (explicit call included -- a refused early call does not block the later gate), --no-user-tools, autonomous [AUTO] flows, and sub-threshold tasks all exit normally. The flag is set inside do_start_long_term_update, so the settlement phase itself cannot re-trigger the gate. CN schema wording aligned to 达到15轮(含) to match the >= 15 gate. 10 new tests covering every case listed in the issue.
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.
Addresses #789.
What
The schema only asks the model to call
start_long_term_updatewhen a 15+ turn task completes; the runtime never checks, and the issue's runs finished on turn 20/39 with zero settlement calls. This adds the suggested one-time completion gate.Changes
ga.pydo_no_tool()final branch: at/above the threshold a normal completion now delegates to the existingdo_start_long_term_update()(yield from, no duplicated prompt/SOP logic) and returns its settlementStepOutcomeinstead ofnext_prompt=None. The user's final answer is already streamed before tool dispatch, so nothing is hidden._needs_long_term_settlement()+_in_autonomous_flow(): gate only fires whencurrent_turn >= 15, settlement hasn't started,--no-user-toolsis absent (same argv detection asagentmain.BANNED_TOOLS), and the latest[USER]:message isn't an[AUTO]autonomous prompt.do_start_long_term_update()sets_lt_started = Truewhen it actually starts (after the< 10refusal). This gives all three guarantees from the issue: an explicit prior call blocks the gate, a refused early call does not, and the settlement phase's own completion cannot re-trigger the gate (no recursion).assets/tools_schema_cn.json超15轮→达到15轮(含), matching the EN schema (15+ turns) and the implementedturn >= 15boundary — the issue's threshold-wording item.Tests
frontends/tests/test_long_term_settlement_gate.py— 10 tests, one per case the issue lists: turn 14 exits normally; turn 15 / turn 40 enter settlement exactly once; settlement completion exits without recursion; a prior explicit call blocks the gate; a refused early call does not; no-op evaluation exits cleanly;--no-user-toolsexempt; autonomous flow exempt (with latest-user-message detection). Tests use the realGenericAgentHandler—ga.pyimports with stdlib only.Full suite: 308 passed; the 3 failures (
test_data_backupsymlink ×2,test_release_qualification) are pre-existing Windows-env issues, identical before and after.Scope notes
agent_loop.pyuntouched — the gate lives entirely inGenericAgentHandler, as the issue suggested.