You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -37,6 +38,8 @@ All type definitions are in `twister/src/` with full JSDoc:
37
38
3.**❌ Forgetting to clean up** - Delete callbacks and stored state when done
38
39
4.**❌ Not handling missing auth** - Always check for stored tokens before operations
39
40
5.**❌ Passing functions to `this.callback()`** - See `tools/AGENTS.md` for critical callback serialization pattern
41
+
6.**❌ Non-private auth activities** - Auth activities in `activate()` should be `private: true` with mentions targeting `context.actor`
42
+
7.**❌ Using installer auth for all write-backs** - Try acting user's credentials first for user-attributed actions (comments). See `twister/docs/MULTI_USER_AUTH.md`
Copy file name to clipboardExpand all lines: tools/AGENTS.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -270,6 +270,8 @@ Building a tool? Follow this checklist:
270
270
-[ ] Size batches appropriately - calculate requests per item to determine safe batch size
271
271
-[ ] Use `this.runTask()` to create new executions with fresh request limits
272
272
-[ ] Clean up stored state and callbacks in lifecycle methods
273
+
-[ ]**Per-user auth for write-backs**: Try `actorId` as `authToken` first, fall back to installer's token
274
+
-[ ]**Private auth activities**: Set `private: true` and add `mentions: [{ id: context.actor.id }]` in `activate()`
273
275
274
276
## Common Tool Pitfalls
275
277
@@ -279,7 +281,9 @@ Building a tool? Follow this checklist:
279
281
4.**❌ Forgetting to store the callback token** - Store it immediately after creating
280
282
5.**❌ Passing undefined instead of null** - Use `null` for optional values
281
283
6.**❌ Not breaking loops into batches** - Each execution has ~1000 request limit; use `runTask()` for fresh limits
282
-
7.**❌ Two-way sync without metadata correlation** - When pushing Plot items to an external system, embed the Plot ID (`Activity.id` / `Note.id`) in the external item's metadata, and update `source`/`key` after creation. In webhook handlers, check metadata for the Plot ID first. This prevents duplicates from a race condition where the webhook arrives before the `source`/`key` update. See SYNC_STRATEGIES.md §6 for a full example.
284
+
7.**❌ Using installer auth for all write-backs** - In multi-user priorities, try the acting user's credentials first (`note.author.id` as authToken) before falling back to installer auth
285
+
8.**❌ Non-private auth activities** - Auth activities from `activate()` should be `private: true` with mentions so only the installing user sees them
286
+
9.**❌ Two-way sync without metadata correlation** - When pushing Plot items to an external system, embed the Plot ID (`Activity.id` / `Note.id`) in the external item's metadata, and update `source`/`key` after creation. In webhook handlers, check metadata for the Plot ID first. This prevents duplicates from a race condition where the webhook arrives before the `source`/`key` update. See SYNC_STRATEGIES.md §6 for a full example.
0 commit comments