Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions apps/controller/src/app/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,12 @@ export async function createContainer(): Promise<ControllerContainer> {
);
const githubStarVerificationService = new GithubStarVerificationService();

// Wire cloud state change callback to sync refreshed cloud inventory without
// auto-switching the default model during startup or first-channel connect.
// Wire cloud state change callback to sync refreshed cloud inventory and
// auto-select a default model when inventory changes.
configStore.onCloudStateChanged = async (change) => {
await modelProviderService.ensureValidDefaultModel();
await openclawSyncService.syncAll();
if (!change.hadCloudInventory && change.hasCloudInventory) {
if (change.hadCloudInventory !== change.hasCloudInventory) {
await openclawProcess.stop();
openclawProcess.enableAutoRestart();
openclawProcess.start();
Expand Down
8 changes: 6 additions & 2 deletions apps/controller/src/routes/desktop-compat-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,12 @@ export function registerDesktopCompatRoutes(
},
},
}),
async (c) =>
c.json(await container.desktopLocalService.disconnectCloud(), 200),
async (c) => {
const result = await container.desktopLocalService.disconnectCloud();
await container.modelProviderService.ensureValidDefaultModel();
const { configPushed } = await container.openclawSyncService.syncAll();
return c.json({ ...result, configPushed }, 200);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update cloud-disconnect schema to include configPushed

This handler now returns configPushed, but the route is still declared with cloudDisconnectResponseSchema (currently just { ok: boolean } in packages/shared/src/schemas/provider.ts). That leaves the OpenAPI contract and generated SDK types out of sync for /api/internal/desktop/cloud-disconnect, so typed clients cannot rely on configPushed and schema-driven consumers may strip/reject it. Please either extend the shared response schema (and regenerate types) or remove the extra field from the response.

Useful? React with 👍 / 👎.

},
);

app.openapi(
Expand Down
11 changes: 11 additions & 0 deletions apps/controller/src/store/nexu-config-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2688,6 +2688,12 @@ export class NexuConfigStore {
const previousCloud = readDesktopCloud(await this.getConfig());
this.abortDesktopCloudPolling();

const config = await this.getConfig();
const currentModelId = config.runtime.defaultModelId;
const wasCloudModel =
resolveManagedCloudModel(currentModelId, previousCloud.models ?? []) !==
null;

await this.setDesktopCloudState({
connected: false,
polling: false,
Expand All @@ -2699,6 +2705,11 @@ export class NexuConfigStore {
apiKey: null,
models: [],
});

if (wasCloudModel) {
await this.setDefaultModel("");
}

await this.onCloudStateChanged?.({
hadCloudInventory: (previousCloud.models?.length ?? 0) > 0,
hasCloudInventory: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const plugin = {
register(api) {
api.on("before_model_resolve", async () => {
const state = loadState();
if (!state) {
if (!state || !state.selectedModelRef) {
return;
}
const slashIndex = state.selectedModelRef.indexOf("/");
Expand All @@ -63,7 +63,7 @@ const plugin = {

api.on("before_prompt_build", async () => {
const state = loadState();
if (!state?.promptNotice) {
if (!state?.selectedModelRef || !state?.promptNotice) {
return;
}
return {
Expand Down
22 changes: 0 additions & 22 deletions apps/web/src/layouts/workspace-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1085,28 +1085,6 @@ function WorkspaceLayoutInner() {
{sidebarCreditBreakdown.giftedBalance}
</span>
</div>
<div className="flex items-center justify-between">
<span className="flex items-center gap-1 text-[11px] text-text-muted">
{t("layout.sidebar.balancePopup.recharged")}
<span className="group relative inline-flex cursor-default items-center">
<Info
size={10}
className="text-text-muted/60"
/>
<span
role="tooltip"
className="pointer-events-none absolute bottom-full left-0 z-[10000] mb-1.5 w-52 rounded-md bg-neutral-800 px-2.5 py-1.5 text-left text-[11px] font-normal leading-snug text-white opacity-0 shadow-lg transition-opacity duration-150 group-hover:opacity-100"
>
{t(
"layout.sidebar.balancePopup.rechargedTooltip",
)}
</span>
</span>
</span>
<span className="tabular-nums text-[11px] font-medium text-text-secondary">
{sidebarCreditBreakdown.planBalance}
</span>
</div>
</div>
<button
type="button"
Expand Down
Loading