Skip to content

Conversation

@solaris007
Copy link
Member

@solaris007 solaris007 commented Nov 16, 2025

Overview

  • Fixed the task processor’s dual-mode entrypoint so it correctly distinguishes between SQS-triggered events and direct invocations (e.g., from Step Functions) even when the Lambda context contains invocation.event.Records.
  • Added a regression test to ensure direct payloads are processed through the synchronous path regardless of context metadata.

Motivation / Context

  • When the new agent Step Function invoked the task processor directly, the Lambda still saw context.invocation.event.Records (populated by the runtime), so we mistakenly treated the request as an SQS batch and returned the “event does not contain any records” warning—preventing agent execution and Slack notifications.
  • Direct invocation must remain synchronous so workflows can read agent results and handle Slack steps downstream.

Key Changes

  • src/index.js: simplified isSqsEvent to check only the incoming event (event.Records), ensuring real SQS batches continue to use the adapter while direct payloads skip it.
  • test/index.test.js: added a test case covering the scenario where the event is direct but the context still includes invocation.event.Records, confirming we pick the direct path.

Testing

  • npm test
  • Verified Step Function direct invokes now execute without warnings and produce agent results/slack notifications.

@solaris007 solaris007 self-assigned this Nov 16, 2025
@solaris007 solaris007 added the bug Something isn't working label Nov 16, 2025
@github-actions
Copy link

This PR will trigger a patch release when merged.

@solaris007
Copy link
Member Author

have to merge due to time pressure, post-merge review @dzehnder

@solaris007 solaris007 merged commit 0d74ca4 into main Nov 17, 2025
8 checks passed
@solaris007 solaris007 deleted the fix-direct-invoke branch November 17, 2025 13:26
solaris007 pushed a commit that referenced this pull request Nov 17, 2025
## [1.6.1](v1.6.0...v1.6.1) (2025-11-17)

### Bug Fixes

* **deps:** update dependency @adobe/spacecat-shared-gpt-client to v1.6.10 ([#133](#133)) ([97f6757](97f6757))
* direct invoke ([#134](#134)) ([0d74ca4](0d74ca4))
@solaris007
Copy link
Member Author

🎉 This PR is included in version 1.6.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants