From d54b930807118d92d3754cf202f576bf75c3166f Mon Sep 17 00:00:00 2001 From: Lovebug MCP Date: Mon, 27 Jul 2026 01:22:27 +0000 Subject: [PATCH] =?UTF-8?q?mcp:=20project-plan=20=E2=80=94=20PBS=20IG=20Au?= =?UTF-8?q?to-Reply=20=E2=80=94=20Post-Cutover=20Polish=20Batch=20(6=20ite?= =?UTF-8?q?ms)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Dev/pbs-ig-autoreply-polish-0726.md | 52 +++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Sources/Dev/pbs-ig-autoreply-polish-0726.md diff --git a/Sources/Dev/pbs-ig-autoreply-polish-0726.md b/Sources/Dev/pbs-ig-autoreply-polish-0726.md new file mode 100644 index 0000000..0454207 --- /dev/null +++ b/Sources/Dev/pbs-ig-autoreply-polish-0726.md @@ -0,0 +1,52 @@ +--- +created: '2026-07-27' +path: Sources/Dev +project: pbs-ig-autoreply-polish-0726 +tags: +- pbs +- n8n +- automation +- flask +- mysql +- instagram +type: project-plan +--- + +## Goal + +Six post-cutover fixes/features for the PBS IG comment→auto-reply automation, prepped on branches for Travis to review + deploy. Sibling to [[pbs-ig-autoreply-prod-cutover]] (thread 1008); this batch is the polish/bugfix pass after the prod cutover landed. + +The six items: + +1. **Blank recipe URL in first reply.** In `Sub-instra-reply-handle-new`, `Prep_FB_Msg` reads `recipeUrl` from the `Merge` node, but on the first-process path the URL isn't loaded yet (the cache-populating call in `instra-reel-cache-new` hasn't returned), so the DM goes out with a blank URL. Fix: source the URL reliably — leading candidate is returning `recipe_url` from the `instra-reel-cache-new` subworkflow so the caller has it in hand. +2. **Staging GChat error `Cannot read properties of undefined (reading '0')`** on `insta-webhook-new [v1]`, node "Call 'Sub-instra-reply-handle-new'", execution 7400 (~19:40 ET). Suspected an unmapped value; possibly correlated with prod activity (unconfirmed). Root-cause the `[0]` deref; get as far as static analysis allows. +3. **Recipe-select filter (pbs-video-manager).** On the project-management page and the platform-post individual record page, add a way to filter/narrow the recipe list when selecting. +4. **Split GChat spaces (full-wire).** Currently all GChat messages hit one space. Route into three: errors, admin messages, PBS alerts. Travis creates the 3 spaces + provides 3 webhook URLs; n8n side wired end-to-end (centralize in `SendPBSChat_New` chokepoint, callers pass a message-type). +5. **Reel title in PBS alerts.** For PBS alert messages that carry the reel ID, also include the title. +6. **Editable recipe keyword on projects page (pbs-video-manager).** After a recipe is linked, allow changing the recipe keyword on the projects page, using the same format as the platform-post individual record page. + +## Locked Decisions + +- **Access:** staging n8n via API key (`n8n.pbs-staging.herbylab.dev`). Key value pending from Travis → live verification of 1/2/4/5 deferred; all prep is static/repo-based. +- **Deploy:** prep-only. Workers commit on branches; Travis runs the staging deploy and any prod steps. No autonomous deploys. +- **Item 4 scope:** full-wire the n8n routing. Travis creates the 3 GChat spaces and pastes 3 webhook URLs into vault/env later. +- **Branches:** fresh off `main` in each repo. wordpress-install → `feat/n8n-alerting-and-reply-fixes`; pbs-video-manager → `feat/recipe-filter-and-keyword-edit`. +- **No production.** No `git push` (Travis reconciles from his tower). Staging is the only test target, and only Travis deploys to it. + +## Open Items + +- [ ] n8n API key value (blocks live verification of items 1/2/4/5). +- [ ] Execution 7400 input/error detail (confirms item 2 root cause). +- [ ] Three GChat space webhook URLs (item 4 env wiring — vars scaffolded, values pending). + +## Phases + +- **Worker A — web app (pbs-video-manager, items 3 + 6):** recipe-select filter on project-management + platform-post pages; editable recipe keyword on projects page mirroring the platform-post record page. Runs `zero-check` after (Python/Flask); `a-review` if >50 lines changed. +- **Worker B — n8n (wordpress-install, items 1 + 2 + 4 + 5, serialized):** items share the same single-line workflow JSONs, so one owner avoids clobbering. Order: 2 (root-cause) → 1 (URL fix) → 5 (title in alert) → 4 (GChat split, largest). Each item reported discretely with what needs a staging run to confirm. + +## Notes + +- Two workers max, one per repo — no cross-repo file contention. n8n items serialized inside Worker B because items 1/4/5 all touch `Sub-instra-reply-handle-new` / `SendPBSChat_New` / `PBS-Central-Error-Handler` and the JSON is minified single-line (merge-hostile). +- Workflow JSONs live in `wordpress-install/roles/dockers/files/n8n/workflows/`; env template in `.../n8n/.env.j2`; `stamp-workflows.py` stamps `[vN]` + substitutes `__PBS_DOMAIN__`. +- `SendPBSChat_New` (id `DrnZwagaEHZhR8wL`) is an executeWorkflowTrigger sub-workflow — the natural routing chokepoint for item 4. `PBS-Central-Error-Handler` (id `NDgjEmiULuSmfcN0`) is the errorWorkflow target — relevant to items 2/5. +- Prep-only + no API key means the whole batch lands as reviewable branch commits + a design note for item 4; Travis deploys to staging to verify. \ No newline at end of file