feat(cpp): runtime configuration and dynamic reconfiguration#531
Open
feat(cpp): runtime configuration and dynamic reconfiguration#531
Conversation
- Add AgentConfig serialization: fromJson(), fromJsonFile(), toJson() in new src/types.cpp - Add AgentConfig validation with checks for empty strings, numeric bounds, temperature range - Add maxTokens field to AgentConfig (was hardcoded to 4096 in agent.cpp) - Wire maxTokens, maxPlanIterations, maxConsecutiveRepeats from config into processQuery loop - Add environment variable overrides: GAIA_BASE_URL, GAIA_MODEL_ID, GAIA_MAX_STEPS, GAIA_MAX_TOKENS, GAIA_CONTEXT_SIZE; deprecation warnings for GAIA_CPP_BASE_URL and GAIA_CPP_CTX_SIZE - Add dynamic reconfiguration setters: setModel(), setConfig(), setMaxSteps(), setMaxTokens(), setTemperature(), setDebug() and config() accessor - Thread-safe config snapshot pattern in processQuery(); double-checked locking in systemPrompt(); modelEnsured_ as std::atomic<bool> - Add ToolInfo::enabled flag with setEnabled()/isEnabled()/enabledTools() on ToolRegistry; disabled tools hidden from formatForPrompt() and rejected in executeTool() - Add rebuildSystemPrompt() to flush cached system prompt after tool enable/disable changes - Add 77 unit tests covering all new functionality Closes #361, #394, #395 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ction edge case - Snapshot config_.debug under configMutex_ in connectMcpServer() and reconnectMcpServer() — previously read without the lock, which was a data race if setDebug()/setConfig() was called concurrently - Tighten maxConsecutiveRepeats validation to >= 2 (was > 0); a value of 1 produced repeatThreshold = 0, causing the loop-detection window to be zero-length and the agent to abort on the very first tool call Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
fromJson(),fromJsonFile(),toJson()via newsrc/types.cpp; validation covers empty strings, numeric bounds, temperature range, andmaxConsecutiveRepeats >= 2maxTokens(was hardcoded to 4096),maxPlanIterations,maxConsecutiveRepeatsnow read from config throughout the execution loopGAIA_BASE_URL,GAIA_MODEL_ID,GAIA_MAX_STEPS,GAIA_MAX_TOKENS,GAIA_CONTEXT_SIZE; deprecated aliasesGAIA_CPP_BASE_URL/GAIA_CPP_CTX_SIZEemitstderrwarningssetModel(),setConfig(),setMaxSteps(),setMaxTokens(),setTemperature(),setDebug(),config()accessor — all thread-safe viaconfigMutex_ToolInfo::enabledflag withsetEnabled()/isEnabled()/enabledTools()onToolRegistry; disabled tools hidden from LLM prompt and rejected on execute;rebuildSystemPrompt()flushes the cacheprocessQuery()start; double-checked locking insystemPrompt();modelEnsured_asstd::atomic<bool>;config_.debugread under lock in MCP connection methodsTest plan
Closes #361
Also closes #394 and #395