agent: honor the caller's event under workflow_call (#2) #6

Open
hermes_forgeron wants to merge 2 commits from agent/issue-2 into main
Collaborator

Fixes the automatic-trigger no-op: intent resolution could not handle runs delegated through a reusable workflow.

What changed

  • glue/src/event.ts — new effectiveEventName(): when GITHUB_EVENT_NAME is workflow_call, the event family is derived from the payload shape in GITHUB_EVENT_PATH (which still holds the caller's original issue_comment / issues event): comment → issue_comment, issue → issues, otherwise workflow_call (unchanged skip). resolveIntent() itself is untouched.
  • glue/src/smoke.ts — 9 regression cases covering the workflow_call path: plan command, plain comment on agent-labeled issue, build label, opened with agent label, irrelevant label skip, non-issue payload skip, bot-author self-guard, and explicit AGENT_MODE precedence.

Verification

  • npm run check (tsc) clean; npm test: all PASS — 9 new cases + the 14 pre-existing ones, no regression.
  • Live validation after merging requires a new agent image tag (glue is baked into the image): rebuild/push the image, update the agent-image default in .forgejo/workflows/agent.yml, then on serious-devs/test_factory_ai comment on an agent-labeled issue without any manual dispatch — the run should log trigger: … and post a plan reply (no more unhandled event workflow_call/created — skipping).

Wiki updates on merge

  • Limitations page — once the new agent image tag is built, pushed and the agent-image default updated (the fix is inert until then): remove the "Automatic triggers fire but the agent skips" bullet from the "Trigger quirks" section (resolved by this PR). Keep the "agent job logs HTTP 500" bullet (tracked in #5). If merged before the image is repinned, keep the bullet but note the fix is pending deployment.
  • Workflow page — nothing to change: the entry-points table already describes automatic triggers as designed; they will now genuinely work.
  • Home page — nothing to change.

Closes #2

Fixes the automatic-trigger no-op: intent resolution could not handle runs delegated through a reusable workflow. ## What changed - **`glue/src/event.ts`** — new `effectiveEventName()`: when `GITHUB_EVENT_NAME` is `workflow_call`, the event family is derived from the payload shape in `GITHUB_EVENT_PATH` (which still holds the caller's original `issue_comment` / `issues` event): `comment` → `issue_comment`, `issue` → `issues`, otherwise `workflow_call` (unchanged skip). `resolveIntent()` itself is untouched. - **`glue/src/smoke.ts`** — 9 regression cases covering the `workflow_call` path: plan command, plain comment on agent-labeled issue, `build` label, `opened` with `agent` label, irrelevant label skip, non-issue payload skip, bot-author self-guard, and explicit `AGENT_MODE` precedence. ## Verification - `npm run check` (tsc) clean; `npm test`: all PASS — 9 new cases + the 14 pre-existing ones, no regression. - Live validation after merging requires a new agent image tag (glue is baked into the image): rebuild/push the image, update the `agent-image` default in `.forgejo/workflows/agent.yml`, then on `serious-devs/test_factory_ai` comment on an `agent`-labeled issue **without any manual dispatch** — the run should log `trigger: …` and post a plan reply (no more `unhandled event workflow_call/created — skipping`). ## Wiki updates on merge - `Limitations` page — once the new agent image tag is built, pushed and the `agent-image` default updated (the fix is inert until then): remove the "Automatic triggers fire but the agent skips" bullet from the "Trigger quirks" section (resolved by this PR). Keep the "agent job logs HTTP 500" bullet (tracked in #5). If merged before the image is repinned, keep the bullet but note the fix is pending deployment. - `Workflow` page — nothing to change: the entry-points table already describes automatic triggers as designed; they will now genuinely work. - `Home` page — nothing to change. Closes #2
Inside a reusable workflow, GITHUB_EVENT_NAME is `workflow_call` while
GITHUB_EVENT_PATH still holds the caller's original issue_comment/issues
payload. Derive the effective event family from the payload shape so
automatic triggers (agent label, @agent comments) resolve their intent
instead of being skipped.

Closes #2
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin "agent/issue-2:agent/issue-2"
git switch "agent/issue-2"

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch "main"
git merge --no-ff "agent/issue-2"
git switch "agent/issue-2"
git rebase "main"
git switch "main"
git merge --ff-only "agent/issue-2"
git switch "agent/issue-2"
git rebase "main"
git switch "main"
git merge --no-ff "agent/issue-2"
git switch "main"
git merge --squash "agent/issue-2"
git switch "main"
git merge --ff-only "agent/issue-2"
git switch "main"
git merge "agent/issue-2"
git push origin "main"
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
serious-devs/ai-factory!6
No description provided.