Skip to content

"Vibe-Trading: Your Personal Trading Agent"

Merge pull request #1737: apply channel edits in place and explain resets

Haozhe Wuba2327237db1
diff --cc agent/src/api/channels_config_routes.py
index 89f0ae19e,f48566aeb..9aa61dd53
--- a/agent/src/api/channels_config_routes.py
+++ b/agent/src/api/channels_config_routes.py
@@@ -31,9 -32,9 +32,10 @@@ from pydantic import BaseModel, ConfigD
from src.api import state as _state
from src.channels import config as _channels_config
+ from src.channels.bus.events import OutboundMessage
from src.channels.bus.queue import MessageBus
from src.channels.config_meta import (
+ _strip_url_userinfo,
channel_field_hints,
is_secret_key,
split_values_secrets,
@@@ -388,11 -403,18 +434,20 @@@ async def _hot_apply(name: str, section
async def _apply_update(name: str, payload: ChannelConfigUpdateRequest) -> dict[str, Any]:
- """Validate → optional enable-transition probe → write → hot apply."""
+ """Validate → optional enable-transition probe → write → apply.
+
+ The response ``applied`` field reports how the edit reached the runtime:
+ ``refreshed`` (a noop-key edit applied in place, no reconnect),
+ ``hot_swapped`` (adapter stop+start), ``reset`` (full runtime rebuild), or
+ ``deferred`` (no runtime yet; the next start reads disk). A ``reset`` that
+ degraded from a failed hot swap additionally carries ``reset_reason`` — a
+ sanitized one-line explanation (bounded, URL userinfo stripped); the key
+ is absent on every other path.
+ """
stored = _stored_section(name)
- patch = _normalize_nullable_blanks(name, _patch_of(name, payload.config))
+ patch = _drop_echoed_url_rewrites(
+ stored, _normalize_nullable_blanks(name, _patch_of(name, payload.config))
+ )
clears = _clear_flags(payload.model_extra)
merged = {**stored, **patch}
for key in clears:
diff --cc agent/src/channels/manager.py
index f341b489b,239b531fd..e9cdac817
--- a/agent/src/channels/manager.py
+++ b/agent/src/channels/manager.py
@@@ -323,9 -302,28 +326,29 @@@ class ChannelManager
async with self._reload_locks[name]:
return await self._reload_channel_locked(name, section)
+ async def refresh_channel_config(self, name: str, section: dict) -> bool:
+ """Apply a noop-key config edit in place; False if not built or rejected."""
+ # Same lock as reload_channel: a refresh and a reload of one channel
+ # must not interleave (the reason _reload_locks exists).
+ async with self._reload_locks[name]:
+ channel = self.channels.get(name)
+ if channel is None or not channel.refresh_config(section):
+ return False
+ channel.send_progress = self._resolve_bool_override(
+ section, "send_progress", self._global_bool("send_progress", True),
+ )
+ channel.send_tool_hints = self._resolve_bool_override(
+ section, "send_tool_hints", self._global_bool("send_tool_hints", False),
+ )
+ channel.show_reasoning = self._resolve_bool_override(
+ section, "show_reasoning", self._global_bool("show_reasoning", True),
+ )
+ self._store_channel_section(name, section)
+ return True
+
async def _reload_channel_locked(self, name: str, section: dict | None) -> dict[str, Any]:
old = self.channels.get(name)
+ stop_error: BaseException | None = None
if old is not None:
try:
await asyncio.wait_for(old.stop(), timeout=_RELOAD_STOP_TIMEOUT_S)