Skip to content

feat(integrations): multi-account support with aliases#370

Open
AlanAAG wants to merge 2 commits into
V1.4.1from
feature/multi-account-integrations
Open

feat(integrations): multi-account support with aliases#370
AlanAAG wants to merge 2 commits into
V1.4.1from
feature/multi-account-integrations

Conversation

@AlanAAG

@AlanAAG AlanAAG commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds multi-account support to 10 integrations: Gmail, Google Calendar,
    Google Drive, Google Docs, YouTube, Outlook, LinkedIn, Notion, HubSpot,
    and Slack. Each can hold more than one connected account, with a
    user-assignable nickname (alias) and a designated primary account.
  • New shared layer (craftos_integrations/accounts.py) handles listing,
    resolving (by exact identity, alias, or unique substring), aliasing,
    and promoting/demoting primary — built once, reused by all 10
    integrations rather than reimplemented per-service.
  • Fixes the root OAuth bug: "Add account" was silently re-authenticating
    the same account instead of prompting a chooser (missing
    select_account/prompt=login params). Fixed per-provider.
  • Aliases are shared across the Google family for the same underlying
    account — set a nickname once on Gmail and it applies to Calendar,
    Drive, Docs, and YouTube automatically. Existing per-service aliases
    migrate transparently.
  • ~290 agent actions across all 10 integrations accept an optional
    account parameter, defaulting to the primary account when omitted.
    Includes closing a gap found during testing: LinkedIn's 10 social/write
    actions (create_linkedin_post, likes, comments, DMs, follow) used a
    different dispatch path that never accepted account — now fixed and
    verified (intercepted the real HTTP call to confirm the correct
    account's token is used).
  • The Manage modal now stages account edits (alias, primary, disconnect)
    locally; nothing is written until "Save changes" is clicked, or
    discarded on modal close. "Add account" is the one exception — it's a
    real external OAuth grant and applies immediately.
  • Strengthened the routing/system prompts (agent_core/core/prompts/action.py,
    AGENT.md, all 10 integrations' INTEGRATION.md) to explicitly direct
    the agent to extract account qualifiers from natural language ("my
    school calendar") rather than silently defaulting to primary.
  • Fixed a keyword-matching bug in the just-in-time prompt injection
    (_integration_essentials.py): bare words like "calendar"/"docs"/
    "drive"/"youtube" never matched anything (only the full "google X"
    form did), so the per-integration guidance never reached the model
    for the most natural phrasing.

Test plan

  • New unit tests: tests/test_accounts_generic.py (integration-agnostic
    layer, tested against a synthetic credential shape) and
    tests/test_google_multi_account.py (Google-specific behavior,
    legacy alias migration)
  • Full backend suite passes (109/109 relevant tests; 4 pre-existing
    unrelated failures untouched)
  • Frontend type-checks with zero new TypeScript errors
  • Manually verified end-to-end against real connected Google accounts:
    write actions (Gmail draft, Google Doc) correctly scoped to the
    targeted account by alias, with real Google 404/403 responses
    confirming true cross-account isolation
  • LinkedIn account-routing fix verified by intercepting the HTTP call
    and confirming the correct account's bearer token was used
  • Keyword-matching fix verified: "what's on my school calendar" now
    correctly triggers Calendar-specific guidance (didn't before);
    confirmed "lark calendar" still resolves correctly alongside it
  • Manual verification of Outlook/LinkedIn/Notion/HubSpot/Slack against
    real accounts (only simulated/seeded credentials tested for these)
  • Live conversational test to confirm the LLM reliably extracts
    account qualifiers from natural language per the strengthened
    prompts — the code/prompt delivery side is verified, but actual
    model compliance can only be confirmed by using it

closes issue #368

@AlanAAG AlanAAG requested a review from korivi-CraftOS July 7, 2026 02:31
* feature/chat questionaire

* bug fixes and corrections

* fix: harden clarifying-questions flow per PR #377 review

- Error instead of parking 3h when no UI can answer (CLI mode / no
  clients), via new InterfaceAdapter.can_prompt_user()
- Drop duplicate submits from stale tabs (atomic first-submission-wins
  in storage) and broadcast resolution to all clients
- QuestionStepper: structured per-question drafts (comma values no longer
  corrupt on back-nav), selected-choice highlight, Dismiss button, Esc in
  free-text clears instead of declining
- Resume text falls back to storage after restart (no more raw "q1" ids)
- Dedupe question serializers into ChatMessageQuestion to_dict/from_dict
- Extract WAIT_FOR_REPLY_PARK_DELAY_SECONDS (imported inside action bodies - executor exec()s function source only)

---------

Co-authored-by: ahmad-ajmal <ahmadajmal1514@gmail.com>
@zfoong

zfoong commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

@AlanAAG You can remove Outlook for verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants