It appears that the provided code snippets and descriptions outline how OpenFiend, a local AI assistant, integrates with Notion for task management, decision-making processes, and real-time updates. Here's a breakdown of each component:
1. Decision Poller (10s)
- Functionality: This poller checks every 10 seconds to see if any decisions in the "pending_approval" state have been updated by an authorized user.
- Process:
- Reads all pending decisions from Notion.
- Compares current and previous statuses of each decision.
- If a decision transitions from "pending_approval" to either "approved" or "rejected", it triggers actions such as resolving permission promises, logging the event, and broadcasting updates to clients.
2. Task Poller (60s, Dynamic)
- Functionality: This poller checks every 60 seconds for pending tasks in Notion.
- Process:
- Queries Notion for tasks with a "pending" status, sorted by priority.
- Picks the highest-priority task and executes it.
- Writes back the results of completed tasks to Notion.
3. Polling Pattern (vs Web
Read the full article at DEV Community
Want to create content about this topic? Use Nemati AI tools to generate articles, social posts, and more.

![[AINews] The Unreasonable Effectiveness of Closing the Loop](/_next/image?url=https%3A%2F%2Fmedia.nemati.ai%2Fmedia%2Fblog%2Fimages%2Farticles%2F600e22851bc7453b.webp&w=3840&q=75)



