Commit Graph

209 Commits (b2de667b11272d3784fc1ff593dac57dd46d1439)

Author SHA1 Message Date
Peter Steinberger b2de667b11 fix: persist topic session files 2026-01-07 22:56:50 +00:00
hsrvc 8da4f259dd Implement Phase 2: Topic-level message history isolation for multi-topic Telegram support
Add topic-specific session file isolation to fix root cause of Gemini turn validation errors.
Each Telegram topic now maintains its own conversation history file, eliminating race
conditions and message corruption during concurrent topic processing.

Changes:
1. Enhanced resolveSessionTranscriptPath() to support optional topicId parameter
   - Topic ID (Telegram messageThreadId) now incorporated into session filename
   - Format: sessionId.jsonl (direct chats) vs sessionId-topic-{topicId}.jsonl (topics)
   - Backward compatible: topicId is optional

2. Updated reply.ts to pass MessageThreadId to session file resolution
   - ctx.MessageThreadId now flows through to resolveSessionTranscriptPath()
   - Automatically provides topic context for each incoming message

3. Automatic propagation through entire system
   - sessionFile parameter automatically carries topic-specific path through:
     - FollowupRun object (queued runs)
     - runEmbeddedPiAgent() calls
     - compactEmbeddedPiSession() calls
     - SessionManager lifecycle (load, read, write operations)

Benefits:
✓ Complete elimination of shared .jsonl race conditions
✓ Each topic's conversation history independently cached
✓ SessionManager instances operate on isolated files
✓ No concurrent mutations of the same message history
✓ Maintains full Phase 1 turn validation as safety layer

Testing:
✓ Build succeeds with no TypeScript errors
✓ Backward compatible with non-topic sessions (direct messages)
✓ Topic ID properly extracted from Telegram messageThreadId

Expected impact:
- Gemini "function call turn" errors eliminated (root cause fixed)
- Message history corruption prevented across all topics
- Improved stability in multi-topic scenarios
- Each topic maintains independent conversation state

This completes the two-phase fix:
- Phase 1 (previous): Turn validation to suppress errors
- Phase 2 (current): Topic isolation to fix root cause

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-07 22:51:26 +00:00
Peter Steinberger 434c25331e refactor: centralize typing mode signals 2026-01-07 22:18:11 +00:00
Peter Steinberger bac1608933 feat: add typing mode controls 2026-01-07 21:58:54 +00:00
Peter Steinberger 7ce1f635cd fix(commands): harden model alias parsing 2026-01-07 20:41:41 +00:00
Azade bb29a3ee3f fix: filter reserved commands from model aliases + add tests 2026-01-07 20:41:41 +00:00
Azade e41540e4ff feat(commands): add dynamic /<alias> model switching 2026-01-07 20:41:41 +00:00
Shadow 7e5cef29a0 Threads: add Slack/Discord thread sessions 2026-01-07 19:30:30 +01:00
Peter Steinberger 61f720b945 feat: add skill filter + group system prompt plumbing 2026-01-07 11:44:37 +01:00
Peter Steinberger a700f9896d feat: telegram draft streaming 2026-01-07 11:08:32 +01:00
Peter Steinberger 7973fd4caf feat: add agents command 2026-01-07 10:03:53 +01:00
Peter Steinberger 1673a221f8 feat: add /reasoning reasoning visibility 2026-01-07 06:17:31 +01:00
Peter Steinberger 3668388912 fix(routing): harden originating reply routing 2026-01-07 05:02:34 +00:00
Josh Lehman 9d50ebad7d feat(routing): route replies to originating channel
Implement reply routing based on OriginatingChannel/OriginatingTo fields.
This ensures replies go back to the provider where the message originated
instead of using the session's lastChannel.

Changes:
- Add OriginatingChannel/OriginatingTo fields to MsgContext (templating.ts)
- Add originatingChannel/originatingTo fields to FollowupRun (queue.ts)
- Create route-reply.ts with provider-agnostic router
- Update all providers (Telegram, Slack, Discord, Signal, iMessage)
  to pass originating channel info
- Update reply.ts to pass originating channel to followupRun
- Update followup-runner.ts to use route-reply for originating channels

This addresses the issue where messages from one provider (e.g., Slack)
would receive replies on a different provider (e.g., Telegram) because
the queue used the last active dispatcher instead of the originating one.
2026-01-07 04:51:33 +00:00
Shadow 9b22e1f6e9
feat(commands): unify chat commands (#275)
* Chat commands: registry, access groups, Carbon

* Chat commands: clear native commands on disable

* fix(commands): align command surface typing

* docs(changelog): note commands registry (PR #275)

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-01-06 20:17:56 +00:00
Peter Steinberger dbfa316d19 feat: multi-agent routing + multi-account providers 2026-01-06 18:33:37 +00:00
Onur 6cf3570c5b
feat(agent): add skipBootstrap config to skip bootstrap file creation (#292) 2026-01-06 11:02:51 -06:00
Peter Steinberger d5f088978a fix: stop typing after dispatcher idle 2026-01-06 03:09:49 +00:00
Peter Steinberger 20a361a3cf refactor: centralize agent timeout defaults 2026-01-06 02:48:44 +00:00
Peter Steinberger b56338171b feat: gate slash commands and add compact 2026-01-06 02:23:55 +01:00
Peter Steinberger b04c838c15 feat!: redesign model config + auth profiles 2026-01-06 00:56:58 +00:00
Peter Steinberger 17ef7b3b0e fix: status runtime + help 2026-01-05 07:07:17 +01:00
Peter Steinberger 995f5959af fix: stage sandbox media for inbound attachments 2026-01-05 06:18:11 +01:00
Peter Steinberger 1bad96aa2b style: tidy auto-reply imports and formatting 2026-01-05 01:46:16 +01:00
Peter Steinberger 852f947b44 fix: unify control command handling 2026-01-05 01:31:36 +01:00
Jake 946b32c842
fix(whatsapp): suppress typing during heartbeats
- Prevent typing indicator during heartbeat runs
- Add regression tests

Co-authored-by: Jake <mcinteerj@gmail.com>
2026-01-04 23:03:36 +00:00
Peter Steinberger 1657c5e3d2 fix: route system events per session 2026-01-04 22:11:04 +01:00
Cash Williams 64e656af82 fix: default elevated level to 'off' when not allowed
When elevatedAllowed is false (e.g., for heartbeat surface which isn't
in any allowFrom list), the elevated level was incorrectly defaulting
to 'on', causing bash commands to fail with 'elevated is not available'.

Now defaults to 'off' when elevated isn't allowed, so bash works
normally without trying to use elevated mode.

Fixes: https://github.com/clawdbot/clawdbot/issues/181
2026-01-04 17:36:14 +01:00
Peter Steinberger 246adaa119 chore: rename project to clawdbot 2026-01-04 14:38:51 +00:00
Peter Steinberger c9504a6f20 refactor: split config module 2026-01-04 07:05:17 +01:00
Peter Steinberger 5e36e2c3f3 fix: allow elevated via discord username 2026-01-04 05:47:28 +00:00
Peter Steinberger d2da305190 feat: fallback elevated allowlist to discord dms 2026-01-04 05:31:00 +00:00
Peter Steinberger ff88f3c075 style: fix lint ordering 2026-01-04 06:27:54 +01:00
Peter Steinberger a03895dfa9 fix: default elevated mode to on 2026-01-04 05:19:28 +00:00
Peter Steinberger fe0b3500cc feat: add elevated bash mode 2026-01-04 05:15:59 +00:00
Peter Steinberger 72a9e58777 refactor(auto-reply): split reply flow 2026-01-04 05:47:37 +01:00
Peter Steinberger a1780efb9f fix: adjust typing TTL 2026-01-04 00:26:31 +00:00
Peter Steinberger 86038ec165 chore: apply lint fixes 2026-01-04 00:06:02 +01:00
Peter Steinberger e7c9b9a749 feat: add sessions tools and send policy 2026-01-03 23:44:42 +01:00
Peter Steinberger 934f891932 fix: include embedded agent error cause in reply 2026-01-03 21:30:43 +00:00
Shadow ce92fac983
chore: formatting 2026-01-03 12:35:16 -06:00
Peter Steinberger f313af75e9 fix: avoid duplicate block-stream payloads 2026-01-03 16:53:56 +00:00
Peter Steinberger 200dd634fb fix: preserve block streaming order 2026-01-03 17:14:01 +01:00
Peter Steinberger 3bbdcaf87f fix: avoid duplicate block streaming 2026-01-03 17:10:47 +01:00
Peter Steinberger 9f8eeceae7 feat: soften block streaming chunking 2026-01-03 16:48:26 +01:00
Peter Steinberger 733e86516e fix: address runtime warnings in build 2026-01-03 15:01:38 +00:00
Peter Steinberger 1a00175eb7 chore: fix lint formatting 2026-01-03 14:57:49 +00:00
Peter Steinberger 48731f494b fix: add embedded run logs and typing ttl 2026-01-03 14:09:19 +00:00
Peter Steinberger b6301c719b fix: default low thinking for reasoning models 2026-01-03 12:19:06 +00:00
Peter Steinberger 772ada4308 fix: refine tool summaries and scope discord tool 2026-01-03 12:33:42 +01:00