fix: reorder ingress checks and update requirements.md
- Move idempotency before external rules per ADR-0002 - Update requirements.md: new pipeline flow, BLOCKLIST_EMAILS, dispatch_context metadata Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+5
-3
@@ -68,12 +68,12 @@ Danh sách trạng thái hợp lệ:
|
||||
- Nếu có `IMAP_PROXY_URL` thì kết nối IMAP qua proxy; nếu không thì direct.
|
||||
- Khi có email mới:
|
||||
1. Anti-loop: nếu `sender` trùng email hệ thống -> `IGNORED`.
|
||||
2. Whitelist: nếu không nằm trong danh sách cho phép -> `IGNORED`.
|
||||
3. Idempotency: nếu `message_id` đã tồn tại -> bỏ qua.
|
||||
2. Idempotency: nếu `message_id` đã tồn tại -> bỏ qua.
|
||||
3. External rules: chạy pipeline các rule configurable (whitelist, blocklist, v.v.). Nếu reject -> `IGNORED`. Rule metadata được lưu vào `dispatch_context`.
|
||||
4. Threading:
|
||||
- Nếu có `In-Reply-To`/`References`: tìm email cha trong DB, kế thừa `thread_id`.
|
||||
- Nếu không có: `thread_id = message_id`.
|
||||
5. Lưu DB với `status = RECEIVED`.
|
||||
5. Lưu DB với `status = RECEIVED`, bao gồm `dispatch_context` từ rules.
|
||||
|
||||
4.2 Dispatch (OpenClaw)
|
||||
- Lấy nội dung email hiện tại và history của cùng `thread_id` (chỉ các bản ghi `COMPLETED`).
|
||||
@@ -84,6 +84,7 @@ Danh sách trạng thái hợp lệ:
|
||||
- `history` (optional)
|
||||
- `callback_url`
|
||||
- `metadata.task_uuid`
|
||||
- `metadata.*` từ `dispatch_context` (rule-derived context)
|
||||
- Cập nhật `status = AI_PROCESSING`.
|
||||
|
||||
Retry OpenClaw:
|
||||
@@ -146,6 +147,7 @@ Required:
|
||||
- `OPENCLAW_URL`, `OPENCLAW_API_KEY` (nếu dùng)
|
||||
- `BRIDGE_CALLBACK_TOKEN`
|
||||
- `WHITELIST_EMAILS` (comma-separated)
|
||||
- `BLOCKLIST_EMAILS` (comma-separated, optional)
|
||||
- `SYSTEM_EMAIL`
|
||||
- `IMAP_PROXY_URL` (optional)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user