fix(#151): refresh effort from registry on context_restart; fix PUT /effort - #653
Open
olegbrok wants to merge 1 commit into
Open
fix(#151): refresh effort from registry on context_restart; fix PUT /effort#653olegbrok wants to merge 1 commit into
olegbrok wants to merge 1 commit into
Conversation
…effort Two #151 follow-ups surfaced while dogfooding native ultracode: 1. restart_streaming_session reused the live in-memory _config and never re-read thinking_effort from the registry. An out-of-band default change (direct DB write or PUT /agents/{name}/effort) was invisible to the running session until a full daemon restart — so native ultracode arming in _build_claude_cmd evaluated a stale effort and silently skipped. Refresh _config.thinking_effort from agents.get() before reconnect. A session-level _effort_override still wins in effective_effort, so this only makes the stored default authoritative. 2. PUT /agents/{name}/effort called a nonexistent agents.update() → AttributeError → 500. AgentRegistry uses register() as its upsert and already handles thinking_effort on existing agents. Tests: regression coverage for both (PUT persists default; restart refreshes effort from registry). Sibling restart tests stay green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Why
Surfaced while dogfooding native ultracode (#151). A
context_restartwith the agent's stored default flipped toultracodedid not fire native/effort ultracode— the logs showedmode=fresh(continue correctly suppressed) but nonative /effortactivation, i.e.is_ultracode(effective_effort)wasFalseat_build_claude_cmdtime despite the DB holdingultracode.Root cause: the live session reuses its boot-time
_config, andrestart_streaming_sessionnever re-readthinking_effortfrom the registry. An out-of-band default change (direct DB write, orPUT /agents/{name}/effort) was invisible to the running session until a full daemon restart, so native arming evaluated a stale effort and silently skipped.Changes
restart_streaming_sessionrefreshes effort from the registry before reconnect (agents.get(name).thinking_effort). A session-level_effort_override(set viaset_thinking_effort) still wins ineffective_effort, so this only makes the stored default authoritative — it never clobbers an override.PUT /agents/{name}/effort500 fix — it called a nonexistentagents.update()→AttributeError.AgentRegistryusesregister()as its upsert and already handlesthinking_efforton existing agents. Swapped toagents.register(name, thinking_effort=level).Tests
test_put_agent_effort_persists_default— PUT persists the default and GET reflects it (regression for the 500).test_streaming_restart_refreshes_thinking_effort_from_registry— out-of-band default bump is picked up on restart.Not included
Frontend effort selector still missing
xhigh+ultracodeoptions — separate frontend change, tracked as the remaining #151 follow-up.🤖 Generated with Claude Code