Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: agent store integration #380

Merged
merged 30 commits into from
May 30, 2024
Merged

Conversation

Gozala
Copy link
Contributor

@Gozala Gozala commented May 25, 2024

Integrates agent-store into the infra and removes custom invocation execution and storage that was used previously. Requires storacha/w3up#1479

Copy link
Contributor

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we please move the formatting chanegs to other PR? This makes reviewing again super more difficult

read-pipeline.tldr Outdated Show resolved Hide resolved
upload-api/functions/ucan-invocation-router.js Outdated Show resolved Hide resolved
Comment on lines +119 to +123
// Prior implementation used to resolve the invocation and include it's
// details the stream record. If invocation was not found it threw
// exception which would result in HTTP status 500.

// 🔬 Need to figure if there are consumers downstream that depend on
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC it is currently needed. There are consumers that need the information of the invocation to track metrics. For instance, when we receive a store/add receipt with 'ok', we need the invocation info to know the size value to increment the size os bytes received by the service

I would wish we just attempt these changes in follow up, or we are going to make this quite complicated

Copy link
Contributor

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to raise that except for the 2 problems still above and once we also merge here #381, everything else looks good to me and I am confident we can merge this tomorrow

Copy link
Member

@alanshaw alanshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, I left a couple of comments but I'm super happy for this!

@@ -27,25 +22,34 @@ const AWS_REGION = process.env.AWS_REGION || 'us-west-2'
async function handlerFn(request) {
const {
INVOCATION_BUCKET_NAME: invocationBucketName = '',
TASK_BUCKET_NAME: taskBucketName = '',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this bucket go?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was never used and me and @vasco-santos realized that it would introduce extra indirection which we could avoid by using new pathing in form of

task/invocation@message.in
task/revocation@message.out

const result = await ctx.agentStore.messages.write({
source: request,
data: message,
index: AgentMessage.index(message)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm...why do we still have to do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this is yet another endpoint we have that simply receives invocations / receipts and simply writes them into a store and indexes them, so all of the stuff added in upload-api was does not cover this 🥺

I thine we could clean this up or perhaps deprecate this endpoint all together, but until we do this seemed like a best compromise I could think of

This PR fixes 3/4 integration tests failing in target PR, as well as
swaps receiptsStorage in blob tests by the agent store. The remaining
one is a problem from
#380 (comment)
Copy link

seed-deploy bot commented May 30, 2024

View stack outputs

@seed-deploy seed-deploy bot temporarily deployed to pr380 May 30, 2024 10:19 Inactive
vasco-santos pushed a commit to storacha/w3up that referenced this pull request May 30, 2024
…1479)

While working on storacha/w3infra#380 I have
realized that agent-store API was poorly designed because it imposed:

1. Store to traverse agent message in order to index each invocations
and receipts within it and code that dealt with traversal was trapped in
util module here that was not even exported.
2. Store has to encode message into bytes in order to persist it, which
is redundant given that we received message in encoded form.

This PR fixes above limitations by switching store interface from
receiving `AgentMessage` to `ParsedAgentMessage` which wraps
`AgentMessage` along with message bytes and index freeing store from
doing any kind of traversal or encoding.

I also removed legacy code that was left behind by previous PR.
Copy link
Contributor

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vasco-santos vasco-santos merged commit 6b05053 into main May 30, 2024
3 checks passed
@vasco-santos vasco-santos deleted the feat/agent-store-integration branch May 30, 2024 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants