open-swe/agent/utils
open-swe[bot] 96f97710ad
feat: add optional Slack Assistants API typing status indicator (#1269)
* feat: add optional Slack Assistants API typing status indicator

Mirrors OpenClaw's pragmatic approach: instead of rebuilding around
assistant_thread_started events, just opt into assistants.threads.setStatus
to show 'is thinking…' while the agent is working, and clear it when
post_slack_thread_reply lands. Gated behind SLACK_ASSISTANTS_API_ENABLED so
it can be toggled without touching code.

* fix(slack): drop redundant clear, add status heartbeat across model calls

- Slack auto-clears the typing indicator on bot post; remove the explicit
  assistants.threads.setStatus("") call from post_slack_thread_reply.
- The indicator expires after ~2 minutes; add a before_model middleware
  that refreshes it on every model tick so it stays visible across long
  agent runs. Reuses the existing slack_thread.{channel_id,thread_ts}
  configurable already plumbed for notify_step_limit.
- chat:write is sufficient on the bot token (assistant:write is on the
  way out per Slack docs); no scope or app-config change required.

* feat(slack): contextual status text + rotating loading_messages

- set_slack_assistant_status now accepts an optional loading_messages list
  (capped at 10 per Slack's API), surfaced via the assistants.threads.setStatus
  payload so Slack rotates through them client-side.
- The heartbeat middleware derives a contextual status from the last
  assistant message's tool calls (e.g. "searching the codebase…" after
  grep, "running commands…" after execute), falling back to the default
  "is thinking…" when no tool calls or unknown tool name.
- Adds a curated DEFAULT_LOADING_MESSAGES list passed alongside the
  contextual status on each refresh.

* fix slack assistant status lifecycle

---------

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Co-authored-by: Johannes du Plessis <johannes@langchain.dev>
2026-05-08 10:21:55 -07:00
..
auth.py fix: log all exceptions (#1089) 2026-03-19 10:26:26 -07:00
authorship.py Revert "fix: Auto assign PRs to creator (#1211)" (#1214) 2026-04-22 13:46:44 -07:00
comments.py chore: Drop monorepo (#1029) 2026-03-06 16:10:34 -08:00
github_app.py feat: add GitHub PR comment trigger and reply support [closes OPE-1] (#1014) 2026-03-09 17:14:13 -07:00
github_comments.py feat(open-swe): trigger reviewer from @open-swe review PR comment (#1259) 2026-05-07 17:04:35 -07:00
github_token.py fix(open_pr): reuse config for GitHub token; defer installation token lookup (#1227) 2026-04-30 17:48:15 -07:00
github_user_email_map.py adding myself as user (#1162) 2026-04-03 15:52:04 -07:00
langsmith.py fix: use thread-level LangSmith URLs instead of run-level URLs to fix broken trace links (#1217) 2026-04-23 13:46:28 -07:00
linear.py fix: use thread-level LangSmith URLs instead of run-level URLs to fix broken trace links (#1217) 2026-04-23 13:46:28 -07:00
linear_team_repo_map.py chore: Add langsmith deployments data plane linear project (#1044) 2026-03-09 18:36:00 -07:00
messages.py chore: Drop monorepo (#1029) 2026-03-06 16:10:34 -08:00
model.py feat(open-swe): Default to GPT-5.5 medium reasoning (#1224) 2026-04-28 15:03:21 -07:00
multimodal.py feat: add Slack image support with url_private auth and content-type validation [closes: OPE-23] (#1073) 2026-03-20 14:34:14 -07:00
repo.py feat: extract repo parsing into shared util, add linear comment repo override (#1103) 2026-03-20 13:34:00 -07:00
sandbox.py feat: migrate LangSmith sandbox creation to snapshot API (#1201) 2026-04-21 12:17:19 -07:00
sandbox_paths.py fix: better custom backend support (#1071) 2026-03-17 11:55:36 -07:00
sandbox_state.py fix: better custom backend support (#1071) 2026-03-17 11:55:36 -07:00
slack.py feat: add optional Slack Assistants API typing status indicator (#1269) 2026-05-08 10:21:55 -07:00