fix(cron): unblock #55 + #56, and make cron-failure alert show log tail#63
Draft
SALL911 wants to merge 2 commits into
Draft
fix(cron): unblock #55 + #56, and make cron-failure alert show log tail#63SALL911 wants to merge 2 commits into
SALL911 wants to merge 2 commits into
Conversation
#55 GEO Audit Queue (prospects) - fetch_prospects() was URL-embedding an ISO timestamp with a "+00:00" timezone suffix into the PostgREST query string. The "+" is decoded as a space per the form-encoding spec, so PostgREST received a malformed timestamp and 400'd every run. Wrap the cutoff with urllib.parse.quote (safe="") so the offset survives transit. #56 Composio Lead -> HubSpot sync - HubSpot rejects null-valued firstname/lastname/company properties and returns 409 on duplicate email. Both were treated as hard failures, so one already-synced lead in the queue burned the entire run. Now we strip empty-string properties before sending and treat the "already exists / 409 / duplicate" surface as an idempotent success (still marks the row synced so we stop re-trying). Both fixes are narrow and based on script inspection (no Actions log access from this environment). If next hour's cron still red, the remaining suspect is the Composio v3 actions/{name}/execute path, which we haven't touched.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
So far the bot just dropped a run URL into the issue. With #55/#56 still red for ~14 days and no log-fetch tool available outside the workflow itself, we were guessing at root causes. This step: 1. Lists jobs of the failed workflow_run, picks the first failure. 2. Downloads that job's plain-text log via the Actions API. 3. Strips the timestamp prefix and grabs the last 80 lines. 4. Embeds it in a <details> block on the alert issue (initial body and each "failed again" follow-up comment). actions: read added to permissions; base64 piped through GITHUB_OUTPUT so multi-line log content survives intact. Step is wrapped in set +e and falls back to empty if log fetch fails — alert workflow must never go red itself.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
3 commits, two fronts:
1. 高信心修兩條 cron — #55 + #56
靠程式碼推回兩個 90%+ 信心的 bug(沒 Actions log 存取):
fetch_prospects()把datetime.now(timezone.utc).isoformat()(含+00:00時區後綴)直接塞進 PostgREST query string。+在 query string 規範下解碼成空格,PostgREST 收到的就是2026-05-...123456 00:00,timestamp 解析失敗 → 400 → 整支腳本從第一步就 raise。改用urllib.parse.quote(..., safe="")包住 cutoff。null屬性、且對既存 email 回 409。兩個都讓整批 sync 被一筆爛資料拖垮。改成「空字串屬性過濾掉」+「409 /already exists/CONTACT_EXISTS視為冪等成功、mark synced」。故意沒動:Composio v3 endpoint 路徑
/api/v3/actions/{name}/execute。沒 log 我不敢猜 v3 是不是改了路徑。2. 改造 cron-failure-alert,讓下次失敗自帶 log
剩 4 條(#57 Figma / #59 BCI / #60 Quota / #61 Notion)我沒把握靠肉眼推。改告警 workflow 比改 4 支腳本安全。
新版
cron-failure-alert.yml:<details>區塊set +e+ fallback 空字串,告警自己絕不能變紅下一輪 cron 失敗,所有 issue 都會自帶錯誤摘要,剩 4 條的根因就會浮出來。
Test plan