DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
test(settings): persist restored subagent drafts
XZHfc8ef2f36072
diff --git a/web/tests/settings-unified-draft.spec.tsx b/web/tests/settings-unified-draft.spec.tsxindex 18a272783..8549e8a41 100644--- a/web/tests/settings-unified-draft.spec.tsx+++ b/web/tests/settings-unified-draft.spec.tsx@@ -89,13 +89,16 @@ function Capture() {function Editor({ name }: { name: string }) {const [liveValue, setLiveValue] = useState(resources[name]);const [draft, edit] = useStagedSettings(name, liveValue, setLiveValue);+ const isSubagent = name.startsWith("subagent:");return (<inputaria-label={name}- value={draft.path ?? draft.provider}+ value={isSubagent ? draft.model ?? "" : draft.path ?? draft.provider}onChange={(e) =>edit(- name === "workspace"+ isSubagent+ ? { model: e.target.value }+ : name === "workspace"? { path: e.target.value }: { provider: e.target.value },)@@ -277,6 +280,37 @@ it("applies a restored draft while its editor is mounted without reverting the dexpect(screen.getByLabelText("workspace")).toHaveValue("/restored");});+it("persists a restored subagent draft before clearing it", async () => {+ const subagent = { enabled: true, model: "restored-model", effort: "high" };+ resources["subagent:opencode"] = {};+ stored = {+ catalog: live,+ extensions: { "subagent:opencode": subagent },+ };+ render(<App page="subagent:opencode" />);+ await ready();++ await waitFor(() =>+ expect(screen.getByLabelText("subagent:opencode")).toHaveValue(+ "restored-model",+ ),+ );+ await act(() => settings.applyCatalog());++ const subagentWriteIndex = mocks.fetch.mock.calls.findIndex(+ ([url, init]) =>+ url === "/api/subagents/settings" && init?.method === "PUT",+ );+ const catalogApplyIndex = mocks.fetch.mock.calls.findIndex(+ ([url, init]) => url === "/api/settings/apply" && init?.method === "POST",+ );+ expect(JSON.parse(String(mocks.fetch.mock.calls[subagentWriteIndex][1]?.body)))+ .toEqual({ backends: { opencode: subagent } });+ expect(subagentWriteIndex).toBeLessThan(catalogApplyIndex);+ expect(settings.draftState).toBe("clean");+ expect(stored).toBeNull();+});+it("keeps the toolbar available when reverting an already saved draft", async () => {render(<App />);await ready();