Skip to content

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(agent): check an app before saying it is not connected

LeoXing52c07e630215
diff --git a/apps/node-services/src/agent/prompt/compact-meta-instructions.ts b/apps/node-services/src/agent/prompt/compact-meta-instructions.ts
index 689aa63b..ef115ad8 100644
--- a/apps/node-services/src/agent/prompt/compact-meta-instructions.ts
+++ b/apps/node-services/src/agent/prompt/compact-meta-instructions.ts
@@ -147,7 +147,7 @@ const authority = (agentType: AgentType, roomKind: MetaRoomKind): string => {
};
const CONNECTED_APPS = `
-- Connected apps: gmail, outlook, gcal, gdrive, slack, notion, and figma have their own commands (teamhub gmail --help). For other apps, find the tool with teamhub apps search "<the action in English, with the app name>", then run teamhub apps execute --connectionId <id> --toolSlug <slug> --toolVersion <version> --arguments '<json>'. When an app has no account, teamhub apps connect <app-key> posts an authorization card. Never resend a write whose outcome is unknown; check the app first.`;
+- Connected apps: gmail, outlook, gcal, gdrive, slack, notion, and figma have their own commands (teamhub gmail --help). For other apps, find the tool with teamhub apps search "<the action in English, with the app name>", then run teamhub apps execute --connectionId <id> --toolSlug <slug> --toolVersion <version> --arguments '<json>'. Before saying whether an app is connected, run teamhub apps connect <app-key> and read its result: it returns the account, or posts an authorization card. Never resend a write whose outcome is unknown; check the app first.`;
const commands = (agentType: AgentType, connectedApps: boolean): string =>
`TeamHub commands, all run through your shell tool (teamhub <domain> <action> --help explains each; credentials are installed, never read them)
diff --git a/apps/node-services/src/agent/prompt/meta-instructions.ts b/apps/node-services/src/agent/prompt/meta-instructions.ts
index cdb99408..aaaaafcb 100644
--- a/apps/node-services/src/agent/prompt/meta-instructions.ts
+++ b/apps/node-services/src/agent/prompt/meta-instructions.ts
@@ -217,7 +217,7 @@ const WORKSPACE = `Your workspace
- Extract archives with tar --no-same-owner.`;
const CONNECTED_APPS = `
-- Connected apps: when a requested app has no delegated account, run teamhub apps connect <app-key> to post an authorization card here instead of asking for credentials. Never automatically resend a teamhub apps execute call whose outcome is unknown; check the app first. To turn the Human's auto reminders for Gmail, Outlook, Google Calendar or Slack on or off, use teamhub apps auto-reminders list and set (Another Me only).`;
+- Connected apps: what earlier context says about connected apps can be out of date. Before telling the Human whether an app is connected, run teamhub apps connect <app-key> and read its result: it returns the delegated account, or posts an authorization card here instead of asking for credentials. Never automatically resend a teamhub apps execute call whose outcome is unknown; check the app first. To turn the Human's auto reminders for Gmail, Outlook, Google Calendar or Slack on or off, use teamhub apps auto-reminders list and set (Another Me only).`;
const commands = (
agentType: AgentType,
diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/cold-then-hot.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/cold-then-hot.jsonl
index f25f2369..772d1114 100644
--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/cold-then-hot.jsonl
+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/cold-then-hot.jsonl
@@ -2,7 +2,7 @@
{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}
{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}
{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}
-{"step":"backend.activate","developerInstructions":"sha256:220cf7d658991cc5","mappings":1}
+{"step":"backend.activate","developerInstructions":"sha256:87a46eb004b07205","mappings":1}
{"step":"provider.createSession"}
{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}
{"hook":"context.prepareInput","messageId":"m-1"}
diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/developer-instructions.txt b/apps/node-services/tests/agent/__golden__/executor-hook-trace/developer-instructions.txt
index 64bf6f6e..b1fc5377 100644
--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/developer-instructions.txt
+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/developer-instructions.txt
@@ -121,7 +121,7 @@ TeamHub commands
- Documents are identified by document_id, not filenames, and aren't mounted locally. You can read, edit and manage every Document your Human has. Find them with teamhub docs list (--shared lists the ones someone shared with you to look at), read them with teamhub docs get <document-id>, and create one with teamhub docs create --title "..." --file <markdown-path>. Deliver an existing file with teamhub message send --attach <path>.
- Tasks: teamhub task check lists the Tasks you delegated from this Room; teamhub task check --task-id <id> shows its status, recent activity, pending approvals, and last report. A Task's reports reach you as private Task callbacks; read one again with teamhub message read --inbox taskmeta:<task-id>.
- Routines: for something recurring in this Room, use teamhub routine create; for a one-off check at a set time, use --at <RFC 3339 time> instead of a schedule, never a recurring routine you plan to turn off later. Omit --mention-actor-id for plain text, pass self to wake yourself, or pass another Agent's actor id. To change one, get its id from teamhub routine list. Delete it when it is no longer needed, and to move it to another time, delete it and create a new one. Pause only when someone wants it stopped for now and resumed later. Delete or pause a routine someone else created only when they ask. Say it is deleted or paused only after the command succeeds. A routine wake is your own standing order, not someone typing: carry it out, and stay quiet when there's nothing worth saying.
-- Connected apps: when a requested app has no delegated account, run teamhub apps connect <app-key> to post an authorization card here instead of asking for credentials. Never automatically resend a teamhub apps execute call whose outcome is unknown; check the app first. To turn the Human's auto reminders for Gmail, Outlook, Google Calendar or Slack on or off, use teamhub apps auto-reminders list and set (Another Me only).
+- Connected apps: what earlier context says about connected apps can be out of date. Before telling the Human whether an app is connected, run teamhub apps connect <app-key> and read its result: it returns the delegated account, or posts an authorization card here instead of asking for credentials. Never automatically resend a teamhub apps execute call whose outcome is unknown; check the app first. To turn the Human's auto reminders for Gmail, Outlook, Google Calendar or Slack on or off, use teamhub apps auto-reminders list and set (Another Me only).
- Cards: a command that needs a Human's decision (a question, an app authorization, an Agent change, a connector write, a Room creation, Document access) posts a card for that Human and returns at once. The decision arrives later as a new message here. Until then, keep doing work that doesn't depend on it; if everything depends on it, end your turn. Don't wait or poll for it, don't post the same card again, and never act as if it were decided.
- Questions: when you need your Sponsor to choose before you can go on, post a question card here. Only your Sponsor can answer it:
teamhub message ask-user --title "Friday team outing" --questions '[{"question":"Where should we go?","options":["Hotpot","BBQ"]},{"question":"What else would you like to do?","options":["KTV","Board games","Movie"],"multiple":true}]'
diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/release.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/release.jsonl
index c87d1981..64de5adc 100644
--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/release.jsonl
+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/release.jsonl
@@ -2,7 +2,7 @@
{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}
{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}
{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}
-{"step":"backend.activate","developerInstructions":"sha256:220cf7d658991cc5","mappings":1}
+{"step":"backend.activate","developerInstructions":"sha256:87a46eb004b07205","mappings":1}
{"step":"provider.createSession"}
{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}
{"hook":"context.prepareInput","messageId":"m-1"}
diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-canceled.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-canceled.jsonl
index e4815d6f..5f4e8440 100644
--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-canceled.jsonl
+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-canceled.jsonl
@@ -2,7 +2,7 @@
{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}
{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}
{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}
-{"step":"backend.activate","developerInstructions":"sha256:220cf7d658991cc5","mappings":1}
+{"step":"backend.activate","developerInstructions":"sha256:87a46eb004b07205","mappings":1}
{"step":"provider.createSession"}
{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}
{"hook":"context.prepareInput","messageId":"m-1"}
diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-failed.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-failed.jsonl
index 1e2bdc24..d5b40939 100644
--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-failed.jsonl
+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/run-failed.jsonl
@@ -2,7 +2,7 @@
{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}
{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}
{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}
-{"step":"backend.activate","developerInstructions":"sha256:220cf7d658991cc5","mappings":1}
+{"step":"backend.activate","developerInstructions":"sha256:87a46eb004b07205","mappings":1}
{"step":"provider.createSession"}
{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}
{"hook":"context.prepareInput","messageId":"m-1"}
diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/steer.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/steer.jsonl
index cea2b39d..00cb7ac8 100644
--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/steer.jsonl
+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/steer.jsonl
@@ -2,7 +2,7 @@
{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}
{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}
{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}
-{"step":"backend.activate","developerInstructions":"sha256:220cf7d658991cc5","mappings":1}
+{"step":"backend.activate","developerInstructions":"sha256:87a46eb004b07205","mappings":1}
{"step":"provider.createSession"}
{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}
{"hook":"context.prepareInput","messageId":"m-1"}
diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/stop-during-submit.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/stop-during-submit.jsonl
index 65caf30f..011bc377 100644
--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/stop-during-submit.jsonl
+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/stop-during-submit.jsonl
@@ -2,7 +2,7 @@
{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}
{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}
{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}
-{"step":"backend.activate","developerInstructions":"sha256:220cf7d658991cc5","mappings":1}
+{"step":"backend.activate","developerInstructions":"sha256:87a46eb004b07205","mappings":1}
{"mark":"stop during submit"}
{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}
{"step":"state.cancelLocalRun","runId":"run-1","status":"canceled"}
diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-handlers.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-handlers.jsonl
index b101b8cf..b2ddef93 100644
--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-handlers.jsonl
+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-handlers.jsonl
@@ -2,7 +2,7 @@
{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}
{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}
{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}
-{"step":"backend.activate","developerInstructions":"sha256:220cf7d658991cc5","mappings":1}
+{"step":"backend.activate","developerInstructions":"sha256:87a46eb004b07205","mappings":1}
{"step":"provider.createSession"}
{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}
{"hook":"context.prepareInput","messageId":"m-1"}
diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-input-hook.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-input-hook.jsonl
index 5c4729ea..700c0b93 100644
--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-input-hook.jsonl
+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/throwing-input-hook.jsonl
@@ -2,7 +2,7 @@
{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}
{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}
{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}
-{"step":"backend.activate","developerInstructions":"sha256:220cf7d658991cc5","mappings":1}
+{"step":"backend.activate","developerInstructions":"sha256:87a46eb004b07205","mappings":1}
{"step":"provider.createSession"}
{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}
{"hook":"prepareInput","feature":"trace-failing","threw":true}
diff --git a/apps/node-services/tests/agent/__golden__/executor-hook-trace/timer-maintenance.jsonl b/apps/node-services/tests/agent/__golden__/executor-hook-trace/timer-maintenance.jsonl
index c06ec1e8..690dd2a2 100644
--- a/apps/node-services/tests/agent/__golden__/executor-hook-trace/timer-maintenance.jsonl
+++ b/apps/node-services/tests/agent/__golden__/executor-hook-trace/timer-maintenance.jsonl
@@ -2,7 +2,7 @@
{"hook":"context.onContextBound","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"bootstrap":"new"}
{"step":"state.enqueueTrustedTurn","messageIds":["m-1"],"runId":"run-1"}
{"hook":"activation.prepareRuntime","context":{"kind":"meta","agentId":"agent-trace","roomId":"room-trace"},"newSession":true}
-{"step":"backend.activate","developerInstructions":"sha256:220cf7d658991cc5","mappings":1}
+{"step":"backend.activate","developerInstructions":"sha256:87a46eb004b07205","mappings":1}
{"step":"provider.createSession"}
{"step":"state.claimLocalRun","runId":"run-1","messageIds":["m-1"]}
{"hook":"context.prepareInput","messageId":"m-1"}
diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration-compact.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration-compact.txt
index 05e08833..2f55bb04 100644
--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration-compact.txt
+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration-compact.txt
@@ -78,7 +78,7 @@ TeamHub commands, all run through your shell tool (teamhub <domain> <action> --h
Add "multiple": true to allow several options. Every question must be answered. Ask an open question or a missing fact in your reply instead.
- To show something the person looks at or uses here and now (a quick chart, dashboard, checklist or small tool), send it inline as a chat card (read the chat-card skill first); use the artifact skill only for a file to share, print, present or keep, or when a file is asked for.
- Agents: teamhub room invite --agent-id <actor-id> brings an Agent from teamhub agent list into this Room (not a direct chat); teamhub agent create --name "<name>" --prompt "<working instructions>" adds a new teammate; teamhub agent update --agent-id <actor-id> --prompt "..." changes an Agent you manage. A change to an established Agent waits for approval.
-- Connected apps: gmail, outlook, gcal, gdrive, slack, notion, and figma have their own commands (teamhub gmail --help). For other apps, find the tool with teamhub apps search "<the action in English, with the app name>", then run teamhub apps execute --connectionId <id> --toolSlug <slug> --toolVersion <version> --arguments '<json>'. When an app has no account, teamhub apps connect <app-key> posts an authorization card. Never resend a write whose outcome is unknown; check the app first.
+- Connected apps: gmail, outlook, gcal, gdrive, slack, notion, and figma have their own commands (teamhub gmail --help). For other apps, find the tool with teamhub apps search "<the action in English, with the app name>", then run teamhub apps execute --connectionId <id> --toolSlug <slug> --toolVersion <version> --arguments '<json>'. Before saying whether an app is connected, run teamhub apps connect <app-key> and read its result: it returns the account, or posts an authorization card. Never resend a write whose outcome is unknown; check the app first.
- With --operation-id, use a unique id per write; after an unknown outcome, rerun the same command with the id the error printed.
<personal-knowledge-policy>
diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration.txt
index 989a5857..886ffbc4 100644
--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration.txt
+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-collaboration.txt
@@ -127,7 +127,7 @@ TeamHub commands
- Documents are identified by document_id, not filenames, and aren't mounted locally. You can read, edit and manage every Document your Human has. Find them with teamhub docs list (--shared lists the ones someone shared with you to look at), read them with teamhub docs get <document-id>, and create one with teamhub docs create --title "..." --file <markdown-path>. Deliver an existing file with teamhub message send --attach <path>.
- Tasks: teamhub task check lists the Tasks you delegated from this Room; teamhub task check --task-id <id> shows its status, recent activity, pending approvals, and last report. A Task's reports reach you as private Task callbacks; read one again with teamhub message read --inbox taskmeta:<task-id>.
- Routines: for something recurring in this Room, use teamhub routine create; for a one-off check at a set time, use --at <RFC 3339 time> instead of a schedule, never a recurring routine you plan to turn off later. Omit --mention-actor-id for plain text, pass self to wake yourself, or pass another Agent's actor id. To change one, get its id from teamhub routine list. Delete it when it is no longer needed, and to move it to another time, delete it and create a new one. Pause only when someone wants it stopped for now and resumed later. Delete or pause a routine someone else created only when they ask. Say it is deleted or paused only after the command succeeds. A routine wake is your own standing order, not someone typing: carry it out, and stay quiet when there's nothing worth saying.
-- Connected apps: when a requested app has no delegated account, run teamhub apps connect <app-key> to post an authorization card here instead of asking for credentials. Never automatically resend a teamhub apps execute call whose outcome is unknown; check the app first. To turn the Human's auto reminders for Gmail, Outlook, Google Calendar or Slack on or off, use teamhub apps auto-reminders list and set (Another Me only).
+- Connected apps: what earlier context says about connected apps can be out of date. Before telling the Human whether an app is connected, run teamhub apps connect <app-key> and read its result: it returns the delegated account, or posts an authorization card here instead of asking for credentials. Never automatically resend a teamhub apps execute call whose outcome is unknown; check the app first. To turn the Human's auto reminders for Gmail, Outlook, Google Calendar or Slack on or off, use teamhub apps auto-reminders list and set (Another Me only).
- Cards: a command that needs a Human's decision (a question, an app authorization, an Agent change, a connector write, a Room creation, Document access) posts a card for that Human and returns at once. The decision arrives later as a new message here. Until then, keep doing work that doesn't depend on it; if everything depends on it, end your turn. Don't wait or poll for it, don't post the same card again, and never act as if it were decided.
- Questions: when you need your Sponsor to choose before you can go on, post a question card here. Only your Sponsor can answer it:
teamhub message ask-user --title "Friday team outing" --questions '[{"question":"Where should we go?","options":["Hotpot","BBQ"]},{"question":"What else would you like to do?","options":["KTV","Board games","Movie"],"multiple":true}]'
diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct-compact.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct-compact.txt
index 75e55616..92712e4f 100644
--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct-compact.txt
+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct-compact.txt
@@ -70,7 +70,7 @@ TeamHub commands, all run through your shell tool (teamhub <domain> <action> --h
Add "multiple": true to allow several options. Every question must be answered. Ask an open question or a missing fact in your reply instead.
- To show something the person looks at or uses here and now (a quick chart, dashboard, checklist or small tool), send it inline as a chat card (read the chat-card skill first); use the artifact skill only for a file to share, print, present or keep, or when a file is asked for.
- Agents: teamhub room invite --agent-id <actor-id> brings an Agent from teamhub agent list into this Room (not a direct chat); teamhub agent create --name "<name>" --prompt "<working instructions>" adds a new teammate; teamhub agent update --agent-id <actor-id> --prompt "..." changes an Agent you manage. A change to an established Agent waits for approval.
-- Connected apps: gmail, outlook, gcal, gdrive, slack, notion, and figma have their own commands (teamhub gmail --help). For other apps, find the tool with teamhub apps search "<the action in English, with the app name>", then run teamhub apps execute --connectionId <id> --toolSlug <slug> --toolVersion <version> --arguments '<json>'. When an app has no account, teamhub apps connect <app-key> posts an authorization card. Never resend a write whose outcome is unknown; check the app first.
+- Connected apps: gmail, outlook, gcal, gdrive, slack, notion, and figma have their own commands (teamhub gmail --help). For other apps, find the tool with teamhub apps search "<the action in English, with the app name>", then run teamhub apps execute --connectionId <id> --toolSlug <slug> --toolVersion <version> --arguments '<json>'. Before saying whether an app is connected, run teamhub apps connect <app-key> and read its result: it returns the account, or posts an authorization card. Never resend a write whose outcome is unknown; check the app first.
- With --operation-id, use a unique id per write; after an unknown outcome, rerun the same command with the id the error printed.
<personal-knowledge-policy>
diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct.txt
index 530c4c75..2a474715 100644
--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct.txt
+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-anotherme-direct.txt
@@ -111,7 +111,7 @@ TeamHub commands
- Documents are identified by document_id, not filenames, and aren't mounted locally. You can read, edit and manage every Document your Human has. Find them with teamhub docs list (--shared lists the ones someone shared with you to look at), read them with teamhub docs get <document-id>, and create one with teamhub docs create --title "..." --file <markdown-path>. Deliver an existing file with teamhub message send --attach <path>.
- Tasks: teamhub task check lists the Tasks you delegated from this Room; teamhub task check --task-id <id> shows its status, recent activity, pending approvals, and last report. A Task's reports reach you as private Task callbacks; read one again with teamhub message read --inbox taskmeta:<task-id>.
- Routines: for something recurring in this Room, use teamhub routine create; for a one-off check at a set time, use --at <RFC 3339 time> instead of a schedule, never a recurring routine you plan to turn off later. Omit --mention-actor-id for plain text, pass self to wake yourself, or pass another Agent's actor id. To change one, get its id from teamhub routine list. Delete it when it is no longer needed, and to move it to another time, delete it and create a new one. Pause only when someone wants it stopped for now and resumed later. Delete or pause a routine someone else created only when they ask. Say it is deleted or paused only after the command succeeds. A routine wake is your own standing order, not someone typing: carry it out, and stay quiet when there's nothing worth saying.
-- Connected apps: when a requested app has no delegated account, run teamhub apps connect <app-key> to post an authorization card here instead of asking for credentials. Never automatically resend a teamhub apps execute call whose outcome is unknown; check the app first. To turn the Human's auto reminders for Gmail, Outlook, Google Calendar or Slack on or off, use teamhub apps auto-reminders list and set (Another Me only).
+- Connected apps: what earlier context says about connected apps can be out of date. Before telling the Human whether an app is connected, run teamhub apps connect <app-key> and read its result: it returns the delegated account, or posts an authorization card here instead of asking for credentials. Never automatically resend a teamhub apps execute call whose outcome is unknown; check the app first. To turn the Human's auto reminders for Gmail, Outlook, Google Calendar or Slack on or off, use teamhub apps auto-reminders list and set (Another Me only).
- Cards: a command that needs a Human's decision (a question, an app authorization, an Agent change, a connector write, a Room creation, Document access) posts a card for that Human and returns at once. The decision arrives later as a new message here. Until then, keep doing work that doesn't depend on it; if everything depends on it, end your turn. Don't wait or poll for it, don't post the same card again, and never act as if it were decided.
- Questions: when you need your Sponsor to choose before you can go on, post a question card here. Only your Sponsor can answer it:
teamhub message ask-user --title "Friday team outing" --questions '[{"question":"Where should we go?","options":["Hotpot","BBQ"]},{"question":"What else would you like to do?","options":["KTV","Board games","Movie"],"multiple":true}]'
diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration-compact.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration-compact.txt
index 2494e58b..22c25d73 100644
--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration-compact.txt
+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration-compact.txt
@@ -76,7 +76,7 @@ TeamHub commands, all run through your shell tool (teamhub <domain> <action> --h
Add "multiple": true to allow several options. Every question must be answered. Ask an open question or a missing fact in your reply instead.
- To show something the person looks at or uses here and now (a quick chart, dashboard, checklist or small tool), send it inline as a chat card (read the chat-card skill first); use the artifact skill only for a file to share, print, present or keep, or when a file is asked for.
- Agents: teamhub room invite --agent-id <actor-id> brings an Agent from teamhub agent list into this Room (not a direct chat); teamhub agent create --name "<name>" --prompt "<working instructions>" adds a new teammate; teamhub agent update --prompt "..." changes you, or add --agent-id <actor-id> for an Agent you manage. A change to an established Agent waits for approval.
-- Connected apps: gmail, outlook, gcal, gdrive, slack, notion, and figma have their own commands (teamhub gmail --help). For other apps, find the tool with teamhub apps search "<the action in English, with the app name>", then run teamhub apps execute --connectionId <id> --toolSlug <slug> --toolVersion <version> --arguments '<json>'. When an app has no account, teamhub apps connect <app-key> posts an authorization card. Never resend a write whose outcome is unknown; check the app first.
+- Connected apps: gmail, outlook, gcal, gdrive, slack, notion, and figma have their own commands (teamhub gmail --help). For other apps, find the tool with teamhub apps search "<the action in English, with the app name>", then run teamhub apps execute --connectionId <id> --toolSlug <slug> --toolVersion <version> --arguments '<json>'. Before saying whether an app is connected, run teamhub apps connect <app-key> and read its result: it returns the account, or posts an authorization card. Never resend a write whose outcome is unknown; check the app first.
- With --operation-id, use a unique id per write; after an unknown outcome, rerun the same command with the id the error printed.
<personal-knowledge-policy>
diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration.txt
index b00f1f8c..d768e446 100644
--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration.txt
+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-collaboration.txt
@@ -119,7 +119,7 @@ TeamHub commands
- Documents are identified by document_id, not filenames, and aren't mounted locally. You can read, edit and manage every Document your Human has. Find them with teamhub docs list (--shared lists the ones someone shared with you to look at), read them with teamhub docs get <document-id>, and create one with teamhub docs create --title "..." --file <markdown-path>. Deliver an existing file with teamhub message send --attach <path>.
- Tasks: teamhub task check lists the Tasks you delegated from this Room; teamhub task check --task-id <id> shows its status, recent activity, pending approvals, and last report. A Task's reports reach you as private Task callbacks; read one again with teamhub message read --inbox taskmeta:<task-id>.
- Routines: for something recurring in this Room, use teamhub routine create; for a one-off check at a set time, use --at <RFC 3339 time> instead of a schedule, never a recurring routine you plan to turn off later. Omit --mention-actor-id for plain text, pass self to wake yourself, or pass another Agent's actor id. To change one, get its id from teamhub routine list. Delete it when it is no longer needed, and to move it to another time, delete it and create a new one. Pause only when someone wants it stopped for now and resumed later. Delete or pause a routine someone else created only when they ask. Say it is deleted or paused only after the command succeeds. A routine wake is your own standing order, not someone typing: carry it out, and stay quiet when there's nothing worth saying.
-- Connected apps: when a requested app has no delegated account, run teamhub apps connect <app-key> to post an authorization card here instead of asking for credentials. Never automatically resend a teamhub apps execute call whose outcome is unknown; check the app first. To turn the Human's auto reminders for Gmail, Outlook, Google Calendar or Slack on or off, use teamhub apps auto-reminders list and set (Another Me only).
+- Connected apps: what earlier context says about connected apps can be out of date. Before telling the Human whether an app is connected, run teamhub apps connect <app-key> and read its result: it returns the delegated account, or posts an authorization card here instead of asking for credentials. Never automatically resend a teamhub apps execute call whose outcome is unknown; check the app first. To turn the Human's auto reminders for Gmail, Outlook, Google Calendar or Slack on or off, use teamhub apps auto-reminders list and set (Another Me only).
- Cards: a command that needs a Human's decision (a question, an app authorization, an Agent change, a connector write, a Room creation, Document access) posts a card for that Human and returns at once. The decision arrives later as a new message here. Until then, keep doing work that doesn't depend on it; if everything depends on it, end your turn. Don't wait or poll for it, don't post the same card again, and never act as if it were decided.
- Questions: when you need your Sponsor to choose before you can go on, post a question card here. Only your Sponsor can answer it:
teamhub message ask-user --title "Friday team outing" --questions '[{"question":"Where should we go?","options":["Hotpot","BBQ"]},{"question":"What else would you like to do?","options":["KTV","Board games","Movie"],"multiple":true}]'
diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct-compact.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct-compact.txt
index 2a3435f6..9247e24c 100644
--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct-compact.txt
+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct-compact.txt
@@ -68,7 +68,7 @@ TeamHub commands, all run through your shell tool (teamhub <domain> <action> --h
Add "multiple": true to allow several options. Every question must be answered. Ask an open question or a missing fact in your reply instead.
- To show something the person looks at or uses here and now (a quick chart, dashboard, checklist or small tool), send it inline as a chat card (read the chat-card skill first); use the artifact skill only for a file to share, print, present or keep, or when a file is asked for.
- Agents: teamhub room invite --agent-id <actor-id> brings an Agent from teamhub agent list into this Room (not a direct chat); teamhub agent create --name "<name>" --prompt "<working instructions>" adds a new teammate; teamhub agent update --prompt "..." changes you, or add --agent-id <actor-id> for an Agent you manage. A change to an established Agent waits for approval.
-- Connected apps: gmail, outlook, gcal, gdrive, slack, notion, and figma have their own commands (teamhub gmail --help). For other apps, find the tool with teamhub apps search "<the action in English, with the app name>", then run teamhub apps execute --connectionId <id> --toolSlug <slug> --toolVersion <version> --arguments '<json>'. When an app has no account, teamhub apps connect <app-key> posts an authorization card. Never resend a write whose outcome is unknown; check the app first.
+- Connected apps: gmail, outlook, gcal, gdrive, slack, notion, and figma have their own commands (teamhub gmail --help). For other apps, find the tool with teamhub apps search "<the action in English, with the app name>", then run teamhub apps execute --connectionId <id> --toolSlug <slug> --toolVersion <version> --arguments '<json>'. Before saying whether an app is connected, run teamhub apps connect <app-key> and read its result: it returns the account, or posts an authorization card. Never resend a write whose outcome is unknown; check the app first.
- With --operation-id, use a unique id per write; after an unknown outcome, rerun the same command with the id the error printed.
<personal-knowledge-policy>
diff --git a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct.txt b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct.txt
index 961c4ae0..348cf0a7 100644
--- a/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct.txt
+++ b/apps/node-services/tests/agent/agent-features/__snapshots__/context-instructions/meta-general-direct.txt
@@ -108,7 +108,7 @@ TeamHub commands
- Documents are identified by document_id, not filenames, and aren't mounted locally. You can read, edit and manage every Document your Human has. Find them with teamhub docs list (--shared lists the ones someone shared with you to look at), read them with teamhub docs get <document-id>, and create one with teamhub docs create --title "..." --file <markdown-path>. Deliver an existing file with teamhub message send --attach <path>.
- Tasks: teamhub task check lists the Tasks you delegated from this Room; teamhub task check --task-id <id> shows its status, recent activity, pending approvals, and last report. A Task's reports reach you as private Task callbacks; read one again with teamhub message read --inbox taskmeta:<task-id>.
- Routines: for something recurring in this Room, use teamhub routine create; for a one-off check at a set time, use --at <RFC 3339 time> instead of a schedule, never a recurring routine you plan to turn off later. Omit --mention-actor-id for plain text, pass self to wake yourself, or pass another Agent's actor id. To change one, get its id from teamhub routine list. Delete it when it is no longer needed, and to move it to another time, delete it and create a new one. Pause only when someone wants it stopped for now and resumed later. Delete or pause a routine someone else created only when they ask. Say it is deleted or paused only after the command succeeds. A routine wake is your own standing order, not someone typing: carry it out, and stay quiet when there's nothing worth saying.
-- Connected apps: when a requested app has no delegated account, run teamhub apps connect <app-key> to post an authorization card here instead of asking for credentials. Never automatically resend a teamhub apps execute call whose outcome is unknown; check the app first. To turn the Human's auto reminders for Gmail, Outlook, Google Calendar or Slack on or off, use teamhub apps auto-reminders list and set (Another Me only).
+- Connected apps: what earlier context says about connected apps can be out of date. Before telling the Human whether an app is connected, run teamhub apps connect <app-key> and read its result: it returns the delegated account, or posts an authorization card here instead of asking for credentials. Never automatically resend a teamhub apps execute call whose outcome is unknown; check the app first. To turn the Human's auto reminders for Gmail, Outlook, Google Calendar or Slack on or off, use teamhub apps auto-reminders list and set (Another Me only).
- Cards: a command that needs a Human's decision (a question, an app authorization, an Agent change, a connector write, a Room creation, Document access) posts a card for that Human and returns at once. The decision arrives later as a new message here. Until then, keep doing work that doesn't depend on it; if everything depends on it, end your turn. Don't wait or poll for it, don't post the same card again, and never act as if it were decided.
- Questions: when you need your Sponsor to choose before you can go on, post a question card here. Only your Sponsor can answer it:
teamhub message ask-user --title "Friday team outing" --questions '[{"question":"Where should we go?","options":["Hotpot","BBQ"]},{"question":"What else would you like to do?","options":["KTV","Board games","Movie"],"multiple":true}]'
diff --git a/apps/teamhub/internal/typedcard/profile_setup.go b/apps/teamhub/internal/typedcard/profile_setup.go
index 7b6e3595..87fdc369 100644
--- a/apps/teamhub/internal/typedcard/profile_setup.go
+++ b/apps/teamhub/internal/typedcard/profile_setup.go
@@ -148,7 +148,9 @@ type onboardingStatus struct {
// onboardingStatusText is the hidden status AnotherMe reads: the facts, then
// what to do with them. With nothing shared it keeps AnotherMe from reading
-// the personal-profile Skill or checking apps, so the chat goes on normally.
+// the personal-profile Skill, so the chat goes on normally. The apps are the
+// grants at this moment; a Connection that activates later is granted without
+// another status, so the text must not read as permanent.
func onboardingStatusText(status onboardingStatus) string {
lines := []string{"Onboarding status from TeamHub (automatic, not written by the Human)."}
if status.finished {
@@ -157,9 +159,9 @@ func onboardingStatusText(status onboardingStatus) string {
lines = append(lines, "Setup cards: not finished; the Human can still answer them above.")
}
if len(status.connections) == 0 {
- lines = append(lines, "Connected apps: none.")
+ lines = append(lines, "Connected apps right now: none.")
} else {
- lines = append(lines, "Connected apps (current, no need to run teamhub apps list):")
+ lines = append(lines, "Connected apps right now (no need to run teamhub apps list):")
for _, connection := range status.connections {
line := "- " + connection.AppName
if connection.AccountLabel != "" {
@@ -184,9 +186,9 @@ func onboardingStatusText(status onboardingStatus) string {
}
switch {
case !shared && !status.finished:
- lines = append(lines, "Answer the Human's message first. Then mention once that they can still connect an app or share links and files in the setup cards above. Do not open the personal-profile Skill or check apps until they share something.")
+ lines = append(lines, "Answer the Human's message first. Then mention once that they can still connect an app or share links and files in the setup cards above. Do not open the personal-profile Skill until they share something.")
case !shared:
- lines = append(lines, "The Human shared nothing. Do not open the personal-profile Skill, check apps, or bring up setup again. Say briefly that you will get to know them as you talk and that they can connect apps anytime, then talk normally.")
+ lines = append(lines, "The Human shared nothing. Do not open the personal-profile Skill or bring up setup again. Say briefly that you will get to know them as you talk and that they can connect apps anytime, then talk normally.")
case !status.finished:
lines = append(lines, "Answer the Human's message first. Then tell them once that building their profile takes a while, and ask whether to start now from what is connected so far. Start it with the personal-profile Skill only if they agree; otherwise wait until they finish the setup cards.")
case status.chatted:
diff --git a/apps/teamhub/internal/typedcard/profile_setup_test.go b/apps/teamhub/internal/typedcard/profile_setup_test.go
index b34821a6..a223d4b3 100644
--- a/apps/teamhub/internal/typedcard/profile_setup_test.go
+++ b/apps/teamhub/internal/typedcard/profile_setup_test.go
@@ -14,7 +14,7 @@ func TestOnboardingStatusTextTellsAnotherMeWhatSetupCollected(t *testing.T) {
}{
"open, nothing shared": {
onboardingStatus{},
- []string{"Setup cards: not finished", "Connected apps: none.", "mention once that they can still connect", "Do not open the personal-profile Skill"},
+ []string{"Setup cards: not finished", "Connected apps right now: none.", "mention once that they can still connect", "Do not open the personal-profile Skill"},
},
"open, app connected": {
onboardingStatus{connections: gmail},
@@ -37,6 +37,10 @@ func TestOnboardingStatusTextTellsAnotherMeWhatSetupCollected(t *testing.T) {
if !strings.HasPrefix(text, "Onboarding status from TeamHub") {
t.Fatalf("%s: text=%q", name, text)
}
+ // Apps can be granted after this status, so it never forbids checking them.
+ if strings.Contains(text, "check apps") {
+ t.Fatalf("%s: status forbids checking apps: %q", name, text)
+ }
for _, want := range test.want {
if !strings.Contains(text, want) {
t.Fatalf("%s: missing %q in %q", name, want, text)
diff --git a/apps/teamhub/tests/integration/another_me_profile_setup_test.go b/apps/teamhub/tests/integration/another_me_profile_setup_test.go
index 21c5839e..8191666a 100644
--- a/apps/teamhub/tests/integration/another_me_profile_setup_test.go
+++ b/apps/teamhub/tests/integration/another_me_profile_setup_test.go
@@ -317,7 +317,7 @@ func TestAnotherMeProfileSetupSourcesDoneHandsOffStatusWithAttachments(t *testin
}
// The Human never wrote, so the status tells AnotherMe to start.
status := f.onboardingStatus(t, cardMessageID)
- for _, want := range []string{"Setup cards: finished.", "Connected apps: none.",
+ for _, want := range []string{"Setup cards: finished.", "Connected apps right now: none.",
"Links: https://alice.example.com https://github.com/alice", "Files: 2, attached to this message.",
"Tell the Human you are starting their profile"} {
if !strings.Contains(status.body, want) {