feat(scouts): debug scripts + deliver_pending diagnostic logs
- scripts/trigger_gmail_scout.py: manually fire ScoutEngine.trigger_scout - scripts/inspect_gmail_scout_token.py: decrypt + show stored OAuth scopes - scripts/show_gmail_scout_state.py: print scout config + queue/log counts - scripts/reset_triage_queue_to_queued.py: revert delivered → queued for re-delivery - engine.py: info logs around deliver_pending (rows found, send_json roundtrip) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
35
scripts/reset_triage_queue_to_queued.py
Normal file
35
scripts/reset_triage_queue_to_queued.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""Re-queue all delivered (but not acked) triage rows so deliver_pending sends them again.
|
||||
|
||||
Usage:
|
||||
python scripts/reset_triage_queue_to_queued.py
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
_API_ROOT = Path(__file__).resolve().parent.parent
|
||||
if str(_API_ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(_API_ROOT))
|
||||
|
||||
from sqlalchemy import update
|
||||
|
||||
from app.db import async_session
|
||||
from app.models import ScoutTriageQueue
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
async with async_session() as session:
|
||||
result = await session.execute(
|
||||
update(ScoutTriageQueue)
|
||||
.where(ScoutTriageQueue.status == "delivered")
|
||||
.values(status="queued", delivered_at=None)
|
||||
)
|
||||
await session.commit()
|
||||
print(f"Reset {result.rowcount} rows from delivered → queued")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Reference in New Issue
Block a user