-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversation
There was a problem hiding this 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
// 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 |
There was a problem hiding this comment.
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
There was a problem hiding this 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
There was a problem hiding this 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 = '', |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
View stack outputs
|
ffe8360
to
c53bc03
Compare
…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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Integrates agent-store into the infra and removes custom invocation execution and storage that was used previously. Requires storacha/w3up#1479