Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.
fix(teamhub): name Composio users and auth configs with the linger prefix
muterCd8942e6b08b8
diff --git a/apps/teamhub/internal/agentconnectedapps/service_test.go b/apps/teamhub/internal/agentconnectedapps/service_test.goindex 35e68c22..23550810 100644--- a/apps/teamhub/internal/agentconnectedapps/service_test.go+++ b/apps/teamhub/internal/agentconnectedapps/service_test.go@@ -21,15 +21,15 @@ func TestSearchToolsInterleavesToolkitsAndProjectsDelegatedConnections(t *testin}}service := &Service{provider: provider}connections := []externalsource.AgentToolConnection{- {ID: "connection-slack", AccountID: "owner", UserID: "co_workspace:test:account:owner", UpstreamConnectionID: "ca-slack", AppKey: "slack", DisplayName: "Slack", ToolkitSlug: "slack"},- {ID: "connection-gmail", AccountID: "owner", UserID: "co_workspace:test:account:owner", UpstreamConnectionID: "ca-gmail", AppKey: "gmail", DisplayName: "Gmail", ToolkitSlug: "gmail"},+ {ID: "connection-slack", AccountID: "owner", UserID: "linger:test:account:owner", UpstreamConnectionID: "ca-slack", AppKey: "slack", DisplayName: "Slack", ToolkitSlug: "slack"},+ {ID: "connection-gmail", AccountID: "owner", UserID: "linger:test:account:owner", UpstreamConnectionID: "ca-gmail", AppKey: "gmail", DisplayName: "Gmail", ToolkitSlug: "gmail"},}tools, err := service.searchTools(context.Background(), connections, "send", 3)if err != nil {t.Fatal(err)}- if len(provider.searches) != 2 || provider.searches[0].UserID != "co_workspace:test:account:owner" || provider.searches[0].ConnectedAccountID != "ca-gmail" || provider.searches[1].ConnectedAccountID != "ca-slack" {+ if len(provider.searches) != 2 || provider.searches[0].UserID != "linger:test:account:owner" || provider.searches[0].ConnectedAccountID != "ca-gmail" || provider.searches[1].ConnectedAccountID != "ca-slack" {t.Fatalf("search must use the server-resolved owner and granted connection: %+v", provider.searches)}if len(tools) != 3 || tools[0].ToolSlug != "GMAIL_ONE" || tools[1].ToolSlug != "SLACK_ONE" || tools[2].ToolSlug != "GMAIL_TWO" {diff --git a/apps/teamhub/internal/composio/client_test.go b/apps/teamhub/internal/composio/client_test.goindex 62f720db..4560075d 100644--- a/apps/teamhub/internal/composio/client_test.go+++ b/apps/teamhub/internal/composio/client_test.go@@ -62,7 +62,7 @@ func TestClientCreatesManagedAuthLinkAndMapsStatus(t *testing.T) {if err := json.NewDecoder(r.Body).Decode(&body); err != nil {t.Fatal(err)}- if body["auth_config_id"] != "gmail-auth" || body["user_id"] != "co_workspace:test:account:account_1" {+ if body["auth_config_id"] != "gmail-auth" || body["user_id"] != "linger:test:account:account_1" {t.Fatalf("unexpected link body: %#v", body)}w.WriteHeader(http.StatusCreated)@@ -112,7 +112,7 @@ func TestClientGetsAndExecutesVersionedToolsWithoutWriteRetry(t *testing.T) {if err := json.NewDecoder(r.Body).Decode(&request); err != nil {t.Fatal(err)}- if request["connected_account_id"] != "ca_internal" || request["user_id"] != "co_workspace:test:account:account_1" || request["version"] != "20260721_00" {+ if request["connected_account_id"] != "ca_internal" || request["user_id"] != "linger:test:account:account_1" || request["version"] != "20260721_00" {t.Fatalf("unexpected execute request: %#v", request)}w.Header().Set("Retry-After", "0")diff --git a/apps/teamhub/internal/composio/connection_scope.go b/apps/teamhub/internal/composio/connection_scope.goindex 817b437a..17362ee1 100644--- a/apps/teamhub/internal/composio/connection_scope.go+++ b/apps/teamhub/internal/composio/connection_scope.go@@ -25,13 +25,13 @@ func (c *Client) SetConnectionAuthority(authority ConnectionAuthority) {}func (c *Client) UserIDForAccount(accountID string) string {- return "co_workspace:" + c.environmentKey + ":account:" + accountID+ return "linger:" + c.environmentKey + ":account:" + accountID}// AuthConfigName is the stable name TeamHub finds or creates the auth config// of toolkit under.func (c *Client) AuthConfigName(toolkit, scheme string) string {- return "co_workspace:" + c.environmentKey + ":" + toolkit + ":" + scheme + ":v1"+ return "linger:" + c.environmentKey + ":" + toolkit + ":" + scheme + ":v1"}func (c *Client) authorizeConnection(ctx context.Context, upstreamID string) (ConnectionBinding, error) {diff --git a/apps/teamhub/internal/composio/connection_scope_test.go b/apps/teamhub/internal/composio/connection_scope_test.goindex 2ddfd2ee..3cb309cc 100644--- a/apps/teamhub/internal/composio/connection_scope_test.go+++ b/apps/teamhub/internal/composio/connection_scope_test.go@@ -91,7 +91,7 @@ func TestEnvironmentUserIdentityIsStableAndDistinct(t *testing.T) {if ci.UserIDForAccount("same-account") == owner.UserIDForAccount("same-account") {t.Fatal("environments share user identity")}- if got := ci.UserIDForAccount("same-account"); got != "co_workspace:ci:account:same-account" {+ if got := ci.UserIDForAccount("same-account"); got != "linger:ci:account:same-account" {t.Fatal(got)}for _, invalid := range []string{"CI", "../ci", "ci:account:foreign", " ci"} {diff --git a/apps/teamhub/internal/composio/tool_search_test.go b/apps/teamhub/internal/composio/tool_search_test.goindex b428e67c..8d89a567 100644--- a/apps/teamhub/internal/composio/tool_search_test.go+++ b/apps/teamhub/internal/composio/tool_search_test.go@@ -20,7 +20,7 @@ func TestToolSearchUsesRouterForNaturalLanguageAndResolvesExecutableMetadata(t *if err := json.NewDecoder(r.Body).Decode(&body); err != nil {t.Error(err)}- if body["user_id"] != "co_workspace:test:account:owner" || !reflect.DeepEqual(body["connected_accounts"], map[string]any{"notion": "ca_authorized"}) || !reflect.DeepEqual(body["toolkits"], map[string]any{"enable": []any{"notion"}}) ||+ if body["user_id"] != "linger:test:account:owner" || !reflect.DeepEqual(body["connected_accounts"], map[string]any{"notion": "ca_authorized"}) || !reflect.DeepEqual(body["toolkits"], map[string]any{"enable": []any{"notion"}}) ||!reflect.DeepEqual(body["manage_connections"], map[string]any{"enable": false}) ||!reflect.DeepEqual(body["workbench"], map[string]any{"enable": false}) {t.Errorf("search session must be restricted: %#v", body)@@ -69,7 +69,7 @@ func TestToolSearchUsesRouterForNaturalLanguageAndResolvesExecutableMetadata(t *if err != nil {t.Fatal(err)}- tools, err := client.SearchTools(t.Context(), ToolSearchRequest{UserID: "co_workspace:test:account:owner", ConnectedAccountID: "ca_authorized", ToolkitSlug: "notion", Query: query, Limit: 5})+ tools, err := client.SearchTools(t.Context(), ToolSearchRequest{UserID: "linger:test:account:owner", ConnectedAccountID: "ca_authorized", ToolkitSlug: "notion", Query: query, Limit: 5})if err != nil {t.Fatal(err)}diff --git a/apps/teamhub/tests/integration/composio_fake_test.go b/apps/teamhub/tests/integration/composio_fake_test.goindex ce24b7d3..b8d40f7e 100644--- a/apps/teamhub/tests/integration/composio_fake_test.go+++ b/apps/teamhub/tests/integration/composio_fake_test.go@@ -162,7 +162,7 @@ func (f *fakeComposio) externalSources(t *testing.T, pool *pgxpool.Pool, provide// as a connect link would, for a connection a test inserts directly.func (f *fakeComposio) seedAccount(t *testing.T, pool *pgxpool.Pool, upstreamID, accountID, toolkit string, status composio.ConnectionStatus) {t.Helper()- userID := "co_workspace:" + fakeComposioEnvironment + ":account:" + accountID+ userID := "linger:" + fakeComposioEnvironment + ":account:" + accountIDif _, err := pool.Exec(t.Context(), `INSERT INTO external_connection_upstreams(upstream_id,account_id,user_id,toolkit_slug,auth_config_id) VALUES($1,$2,$3,$4,$5)`,upstreamID, accountID, userID, toolkit, fakeComposioAuthConfigs[toolkit]); err != nil {t.Fatal(err)diff --git a/apps/teamhub/tests/integration/listener_grant_revocation_test.go b/apps/teamhub/tests/integration/listener_grant_revocation_test.goindex ccad0c86..d0f58b0a 100644--- a/apps/teamhub/tests/integration/listener_grant_revocation_test.go+++ b/apps/teamhub/tests/integration/listener_grant_revocation_test.go@@ -51,7 +51,7 @@ func newListenerGrantFixture(t *testing.T, serve http.HandlerFunc, judge proactit.Fatal(err)}for _, statement := range []string{- `INSERT INTO external_connection_upstreams(upstream_id,account_id,user_id,toolkit_slug,auth_config_id) VALUES('ca_revoke','account_alice','co_workspace:test:account:account_alice','gmail','ac_gmail')`,+ `INSERT INTO external_connection_upstreams(upstream_id,account_id,user_id,toolkit_slug,auth_config_id) VALUES('ca_revoke','account_alice','linger:test:account:account_alice','gmail','ac_gmail')`,`INSERT INTO external_connections(id,account_id,provider,upstream_connection_id,status,revision,remote_principal_key,identity_label,toolkit_slug,auth_config_id,auto_reminders) VALUES('connection_revoke','account_alice','gmail','ca_revoke','active',1,'gmail:[email protected]','[email protected]','gmail','ac_gmail',false)`,} {if _, err := pool.Exec(t.Context(), statement); err != nil {diff --git a/apps/teamhub/tests/integration/managed_apps_test.go b/apps/teamhub/tests/integration/managed_apps_test.goindex 4559e45c..a4e3da2e 100644--- a/apps/teamhub/tests/integration/managed_apps_test.go+++ b/apps/teamhub/tests/integration/managed_apps_test.go@@ -169,7 +169,7 @@ func TestManagedAppsConcurrentProvisioning(t *testing.T) {provider.mu.Lock()defer provider.mu.Unlock()link := provider.links[connections[0].UpstreamConnectionID]- if link["user_id"] != "co_workspace:ci:account:account_alice" {+ if link["user_id"] != "linger:ci:account:account_alice" {t.Fatalf("upstream user %q", link["user_id"])}if link["auth_config_id"] == "ac_foreign" {@@ -300,9 +300,9 @@ func TestManagedAppsCreateCustomAuthConfigs(t *testing.T) {bodies := provider.createBodiesprovider.mu.Unlock()want := []map[string]any{- {"toolkit": map[string]any{"slug": "higgsfield_mcp"}, "auth_config": map[string]any{"type": "use_custom_auth", "name": "co_workspace:ci:higgsfield_mcp:DCR_OAUTH:v1", "authScheme": "DCR_OAUTH", "credentials": map[string]any{}}},- {"toolkit": map[string]any{"slug": "fal_ai"}, "auth_config": map[string]any{"type": "use_custom_auth", "name": "co_workspace:ci:fal_ai:API_KEY:v1", "authScheme": "API_KEY", "credentials": map[string]any{}}},- {"toolkit": map[string]any{"slug": "linear"}, "auth_config": map[string]any{"type": "use_composio_managed_auth", "name": "co_workspace:ci:linear:OAUTH2:v1", "auth_scheme": "OAUTH2"}},+ {"toolkit": map[string]any{"slug": "higgsfield_mcp"}, "auth_config": map[string]any{"type": "use_custom_auth", "name": "linger:ci:higgsfield_mcp:DCR_OAUTH:v1", "authScheme": "DCR_OAUTH", "credentials": map[string]any{}}},+ {"toolkit": map[string]any{"slug": "fal_ai"}, "auth_config": map[string]any{"type": "use_custom_auth", "name": "linger:ci:fal_ai:API_KEY:v1", "authScheme": "API_KEY", "credentials": map[string]any{}}},+ {"toolkit": map[string]any{"slug": "linear"}, "auth_config": map[string]any{"type": "use_composio_managed_auth", "name": "linger:ci:linear:OAUTH2:v1", "auth_scheme": "OAUTH2"}},}if !reflect.DeepEqual(bodies, want) {t.Fatalf("auth config requests = %v", bodies)@@ -316,8 +316,8 @@ func TestManagedAppsReuseExistingCustomAuthConfig(t *testing.T) {pool, provider, server := managedAppsFixture(t)service := managedAppsService(t, pool, server)provider.mu.Lock()- provider.configs["co_workspace:ci:fal_ai:API_KEY:v1"] = managedAuthConfig{id: "ac_existing", toolkit: "fal_ai", scheme: "API_KEY"}- provider.configs["co_workspace:ci:higgsfield_mcp:DCR_OAUTH:v1"] = managedAuthConfig{id: "ac_wrong_kind", toolkit: "higgsfield_mcp", scheme: "DCR_OAUTH", managed: true}+ provider.configs["linger:ci:fal_ai:API_KEY:v1"] = managedAuthConfig{id: "ac_existing", toolkit: "fal_ai", scheme: "API_KEY"}+ provider.configs["linger:ci:higgsfield_mcp:DCR_OAUTH:v1"] = managedAuthConfig{id: "ac_wrong_kind", toolkit: "higgsfield_mcp", scheme: "DCR_OAUTH", managed: true}provider.mu.Unlock()connection, err := service.CreateConnection(t.Context(), "account_alice", "fal_ai")if err != nil {diff --git a/apps/teamhub/tests/integration/proactive_test.go b/apps/teamhub/tests/integration/proactive_test.goindex 97bd6e84..2dbab10e 100644--- a/apps/teamhub/tests/integration/proactive_test.go+++ b/apps/teamhub/tests/integration/proactive_test.go@@ -258,7 +258,7 @@ func TestProactiveRoutinesEventsAndListeners(t *testing.T) {for _, provider := range []string{"gmail", "outlook", "google_calendar", "slack", "notion"} {statements = append(statements,`INSERT INTO external_connection_upstreams(upstream_id,account_id,user_id,toolkit_slug,auth_config_id)- VALUES('ca_alice_`+provider+`','account_alice','co_workspace:test:account:account_alice','`+provider+`','ac_`+provider+`')`,+ VALUES('ca_alice_`+provider+`','account_alice','linger:test:account:account_alice','`+provider+`','ac_`+provider+`')`,`INSERT INTO external_connections(id,account_id,provider,upstream_connection_id,status,revision,remote_principal_key,identity_label,toolkit_slug,auth_config_id,auto_reminders)VALUES('connection_alice_`+provider+`','account_alice','`+provider+`','ca_alice_`+provider+`','active',1,'`+provider+`:[email protected]','[email protected]','`+provider+`','ac_`+provider+`',false)`,`INSERT INTO external_connection_agent_grants(id,connection_id,tenant_id,agent_actor_id,represented_human_actor_id,status)@@ -541,7 +541,7 @@ func TestProactiveAutoRemindersSwitchRemovesAndRestoresTheListener(t *testing.T)}for _, statement := range []string{`INSERT INTO external_connection_upstreams(upstream_id,account_id,user_id,toolkit_slug,auth_config_id)- VALUES('ca_alice_auto','account_alice','co_workspace:test:account:account_alice','gmail','ac_gmail')`,+ VALUES('ca_alice_auto','account_alice','linger:test:account:account_alice','gmail','ac_gmail')`,`INSERT INTO external_connections(id,account_id,provider,upstream_connection_id,status,revision,remote_principal_key,identity_label,toolkit_slug,auth_config_id)VALUES('connection_alice_auto','account_alice','gmail','ca_alice_auto','active',1,'gmail:[email protected]','[email protected]','gmail','ac_gmail')`,`INSERT INTO external_connection_agent_grants(id,connection_id,tenant_id,agent_actor_id,represented_human_actor_id,status)@@ -660,7 +660,7 @@ func TestProactiveListenerSweepAndSwitchInstallWithoutDeadlock(t *testing.T) {}for _, statement := range []string{`INSERT INTO external_connection_upstreams(upstream_id,account_id,user_id,toolkit_slug,auth_config_id)- VALUES('ca_alice_race','account_alice','co_workspace:test:account:account_alice','gmail','ac_gmail')`,+ VALUES('ca_alice_race','account_alice','linger:test:account:account_alice','gmail','ac_gmail')`,`INSERT INTO external_connections(id,account_id,provider,upstream_connection_id,status,revision,remote_principal_key,identity_label,toolkit_slug,auth_config_id)VALUES('connection_alice_race','account_alice','gmail','ca_alice_race','active',1,'gmail:[email protected]','[email protected]','gmail','ac_gmail')`,`INSERT INTO external_connection_agent_grants(id,connection_id,tenant_id,agent_actor_id,represented_human_actor_id,status)