mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-06-17 13:05:58 +00:00
fix(channels): make runtime provider state authoritative (#3580)
* fix(channels): make runtime provider state authoritative * make format * fix(channels): close runtime provider config races and status gaps Address review findings on the runtime-provider-state change: - configure/disconnect now re-read the live app.state.channels_config after the worker await and mutate only the affected provider key in place, so a concurrent mutation for a different provider is no longer clobbered by a stale pre-await snapshot. - disconnect revokes DB connection rows before committing the store and cache, so a repo failure cannot leave the store/cache "disconnected" while the DB keeps "connected" rows a later re-configure would silently reactivate. - _provider_response preserves non-connected statuses (e.g. revoked) when the provider is unavailable, only masking a stale "connected" row as not_connected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -117,7 +117,9 @@ export function WorkspaceChannelsList() {
|
||||
<SidebarMenu>
|
||||
{visibleProviders.map((provider) => {
|
||||
const canEditRuntimeConfig = providerCanEditRuntimeConfig(provider);
|
||||
const isConnected = provider.connection_status === "connected";
|
||||
const isConnected =
|
||||
!provider.unavailable_reason &&
|
||||
provider.connection_status === "connected";
|
||||
const isPending =
|
||||
(connectMutation.isPending &&
|
||||
connectMutation.variables === provider.provider) ||
|
||||
|
||||
@@ -117,9 +117,11 @@ function ChannelProviderItem({
|
||||
const configureMutation = useConfigureChannelProvider();
|
||||
const disconnectProviderMutation = useDisconnectChannelProvider();
|
||||
const [setupOpen, setSetupOpen] = useState(false);
|
||||
const runtimeAvailable = provider.configured && !provider.unavailable_reason;
|
||||
const isConnected =
|
||||
connection?.status === "connected" ||
|
||||
provider.connection_status === "connected";
|
||||
runtimeAvailable &&
|
||||
(connection?.status === "connected" ||
|
||||
provider.connection_status === "connected");
|
||||
const canEditRuntimeConfig = providerCanEditRuntimeConfig(provider);
|
||||
const canConnect =
|
||||
(provider.connectable ?? (provider.enabled && provider.configured)) &&
|
||||
@@ -186,7 +188,7 @@ function ChannelProviderItem({
|
||||
</ItemTitle>
|
||||
<ItemDescription className="line-clamp-none">
|
||||
{getProviderDescription(provider, t.channels.descriptions)}
|
||||
{connectionLabel
|
||||
{isConnected && connectionLabel
|
||||
? ` ${t.channels.connectedAs(connectionLabel)}`
|
||||
: ""}
|
||||
{!isConnected && provider.unavailable_reason
|
||||
|
||||
Reference in New Issue
Block a user