Skip to content

Providers: unify history context wrappers#672

Closed
steipete wants to merge 5 commits into
mainfrom
feature/unified-history
Closed

Providers: unify history context wrappers#672
steipete wants to merge 5 commits into
mainfrom
feature/unified-history

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • unify history context wrapping across providers with shared helpers
  • add per-provider/per-account historyLimit overrides and clear on reply
  • document history context + config defaults

Testing

  • pnpm vitest run src/auto-reply/reply/history.test.ts src/slack/monitor.tool-result.test.ts src/config/config.test.ts

@cursor

cursor Bot commented Jan 10, 2026

Copy link
Copy Markdown

PR Summary

Centralizes and standardizes group history context across providers; clarifies command vs prompt bodies and config overrides.

  • Introduces shared history helpers (buildHistoryContext*, HISTORY_CONTEXT_MARKER) and clears per-room history after replies
  • Applies history wrapping to Slack, Discord, Telegram, Signal, iMessage, and WhatsApp Web; preserves Body (wrapped) and CommandBody/RawBody (clean)
  • Adds historyLimit overrides to config/types/zod for providers and per-account; falls back to messages.groupChat.historyLimit; 0 disables
  • Switches directive/abort/commands parsing to CommandBody (treat RawBody as legacy) and preserves history in Body
  • Updates docs (messages, provider pages, configuration) to document wrappers, defaults, and overrides; adds targeted tests for helpers, Slack wrapping, config validation, and RawBody/CommandBody behavior

Written by Cursor Bugbot for commit 279ae30. This will update automatically on new commits. Configure here.

@steipete

Copy link
Copy Markdown
Contributor Author

Summary:

  • unify history context wrappers across providers with shared helpers
  • add per-provider/per-account historyLimit overrides + clear group history on reply
  • update docs for history context + config defaults

Testing:

  • pnpm vitest run src/auto-reply/reply/history.test.ts src/slack/monitor.tool-result.test.ts src/config/config.test.ts

@steipete

Copy link
Copy Markdown
Contributor Author

Update:

  • fix import ordering + HistoryEntry typing after lint/build

Testing:

  • pnpm lint
  • pnpm build
  • pnpm test (stalled at src/commands/onboard-non-interactive.lan-auto-token.test.ts; aborted after ~45s with 2232/2233 tests complete)
  • pnpm docs:list

@steipete

Copy link
Copy Markdown
Contributor Author

Refactor: centralized history wrapping via new history helper (append+build+clear) and applied across Slack/Discord/Telegram/Signal/iMessage/MSTeams. Tests: pnpm lint; pnpm vitest run src/auto-reply/reply/history.test.ts.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 585147ca24

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/web/auto-reply.ts
Comment on lines 822 to +824
const groupHistoryLimit =
cfg.messages?.groupChat?.historyLimit ?? DEFAULT_GROUP_HISTORY_LIMIT;
cfg.whatsapp?.accounts?.[tuning.accountId ?? ""]?.historyLimit ??
cfg.whatsapp?.historyLimit ??

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor default account historyLimit in web provider

The account-specific override lookup uses tuning.accountId ?? "", so when monitorWebProvider is called without an explicit account id (documented as defaulting to "default") or with a non-normalized id, the lookup misses whatsapp.accounts.<id>.historyLimit and silently falls back to the global/default limit. That makes per-account history tuning (including disabling with 0) ineffective for the default account in this code path. Consider indexing with the resolved/normalized account.accountId (or DEFAULT_ACCOUNT_ID) so the override is honored consistently.

Useful? React with 👍 / 👎.

@steipete

Copy link
Copy Markdown
Contributor Author

Merged via rebase onto main and fast-forwarded. Full gate: pnpm lint && pnpm build && pnpm test && pnpm docs:list. Landed commits: d41372b (feat: unify provider history context), c0a0103 (docs: document history context overrides), b977ae1 (chore: fix lint and typing), 82f71d2 (refactor: centralize history context wrapping), 801e7dd (docs: update changelog for unified history).

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.

1 participant