Self-hosted workflows for coding-agent delivery. Orchestrate CodeBuddy, Codex and Claude Code with scripts and human approval gates. Includes Local workflows for coding assistants.
JavaScript agent-orchestrationagentic-workflowai-agentsai-codingclaude-codecode-reviewcodebuddycodexcoding-agentscursordeveloper-toolshuman-on-the-loopllmmcpmulti-agentsdlcself-hostedsopworkflow-automationworkflow-engine
fix(chatbot): keep full permission for the current page only
tester62335e5b8c90
diff --git a/chatbot/src/PermissionPicker.jsx b/chatbot/src/PermissionPicker.jsxindex 0a46edd9..658eb595 100644--- a/chatbot/src/PermissionPicker.jsx+++ b/chatbot/src/PermissionPicker.jsx@@ -11,19 +11,21 @@ const modes = [];// The approval mode is a personal preference: new conversations and reloads-// keep the last pick instead of going back to "请求批准".+// keep the last pick instead of going back to "请求批准". 完全权限 is never+// stored: it lets platform and external writes run unreviewed, so it lasts+// for this page only and a reload returns to the last reviewed mode.const APPROVAL_KEY = "loopforge.assistant.approvalMode";-const knownMode = (value) => modes.some((mode) => mode.id === value);+const rememberedMode = (value) => value === "confirm" || value === "assisted";export function storedApprovalMode() {try {const value = localStorage.getItem(APPROVAL_KEY);- return knownMode(value) ? value : "confirm";+ return rememberedMode(value) ? value : "confirm";} catch {return "confirm";}}export function rememberApprovalMode(value) {- if (!knownMode(value)) return;+ if (!rememberedMode(value)) return;try {localStorage.setItem(APPROVAL_KEY, value);} catch {diff --git a/chatbot/tests/app-render.test.jsx b/chatbot/tests/app-render.test.jsxindex 9aa30ee7..1e76ace1 100644--- a/chatbot/tests/app-render.test.jsx+++ b/chatbot/tests/app-render.test.jsx@@ -104,6 +104,17 @@ describe("App", () => {await user.click(screen.getByRole("button", { name: "发送消息" }));expect(chat.send).toHaveBeenLastCalledWith(expect.objectContaining({ approvalMode: "assisted" }));});+ test("keeps full permission for this page only", async () => {+ const user = userEvent.setup();+ localStorage.setItem("loopforge.assistant.approvalMode", "assisted");+ const first = render(<App />);+ await user.click(screen.getByRole("button", { name: "操作确认方式" }));+ await user.click(screen.getByRole("menuitemradio", { name: "完全权限" }));+ expect(screen.getByRole("button", { name: "操作确认方式" })).toHaveTextContent("完全权限");+ first.unmount();+ render(<App />);+ expect(screen.getByRole("button", { name: "操作确认方式" })).toHaveTextContent("帮我批准");+ });test("does not ask for per-command native approval in a working conversation", () => {const previous = {...chat};Object.assign(chat,{activeId:"workspace-chat",busy:true,session:{id:"workspace-chat",runtimeMode:"workspace",messages:[{role:"user",content:"检查目录"}]}});diff --git a/chatbot/tests/pickers-and-activity.test.jsx b/chatbot/tests/pickers-and-activity.test.jsxindex c6c43960..0e24b80f 100644--- a/chatbot/tests/pickers-and-activity.test.jsx+++ b/chatbot/tests/pickers-and-activity.test.jsx@@ -91,6 +91,15 @@ describe("pickers and activity", () => {expect(storedApprovalMode()).toBe("confirm");});+ test("never remembers full permission across reloads", () => {+ rememberApprovalMode("assisted");+ rememberApprovalMode("auto");+ expect(storedApprovalMode()).toBe("assisted");+ // A value stored by an older build does not come back either.+ localStorage.setItem("loopforge.assistant.approvalMode", "auto");+ expect(storedApprovalMode()).toBe("confirm");+ });+test("expands detailed activity including failures", async () => {const user = userEvent.setup();const start = "2026-01-01T00:00:00Z";diff --git a/internal/httpapi/assistant_sponsor.go b/internal/httpapi/assistant_sponsor.goindex e9e0b30d..a4c7c7da 100644--- a/internal/httpapi/assistant_sponsor.go+++ b/internal/httpapi/assistant_sponsor.go@@ -2,6 +2,7 @@ package httpapiimport ("context"+ "log""strings""agentflow/internal/domain"@@ -87,7 +88,13 @@ func (h *assistantHandlers) turnCatalog(ctx context.Context, user domain.User, mreturn catalog}refreshCLIModels(ctx, user.CodeBuddyInternetEnvironment, user.CodeBuddyAPIKey)- return h.chatCatalog(ctx, user)+ catalog = h.chatCatalog(ctx, user)+ if !assistantCatalogLists(catalog, model) {+ // The list is fresh (or discovery failed) and still lacks the model:+ // the turn falls back to the default, so leave a trace of why.+ log.Printf("assistant model %q is not offered to user %d; the turn runs on %q", model, user.ID, catalog.Default)+ }+ return catalog}func assistantCatalogLists(catalog assistantModelCatalog, id string) bool {diff --git a/internal/httpapi/assistant_sponsor_test.go b/internal/httpapi/assistant_sponsor_test.goindex 12a4fa21..1a432c6e 100644--- a/internal/httpapi/assistant_sponsor_test.go+++ b/internal/httpapi/assistant_sponsor_test.go@@ -339,3 +339,20 @@ func TestTurnCatalogRefreshesBeforeFallingBackToTheDefault(t *testing.T) {t.Fatalf("a listed or empty model must not run discovery again, got %d", calls)}}++// The chat picker starts a person with nothing remembered on the first listed+// model, so every chat catalog must list its default first.+func TestChatCatalogsListTheDefaultFirst(t *testing.T) {+ t.Setenv("AGENTFLOW_ASSISTANT_MODEL", "glm-5.3-flash-ioa")+ t.Setenv("AGENTFLOW_ASSISTANT_MODELS", "claude-opus-5.5,glm-5.3-flash-ioa")+ ctx := context.Background()+ shared := []string{"deepseek-v4.1-flash", "glm-5.3-flash-ioa"}+ for name, catalog := range map[string]assistantModelCatalog{+ "own key": assistantChatCatalog(ctx, "", nil),+ "shared key": restrictAssistantCatalog(assistantChatCatalog(ctx, "", shared), shared),+ } {+ if len(catalog.Models) == 0 || catalog.Models[0].ID != catalog.Default {+ t.Fatalf("%s: default %q is not listed first in %+v", name, catalog.Default, catalog.Models)+ }+ }+}