Skip to content

Correcting Reducer Callback Information in llms.md #335

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

Merged

Conversation

Lethalchip
Copy link
Contributor

There is currently incorrect information within the reducer callback function in llms.txt:

private handleSendMessageResult(ctx: ReducerEventContext, messageText: string) {
    const wasOurCall = ctx.reducerEvent.callerIdentity.isEqual(this.identity);
    if (!wasOurCall) return; // Only care about our own calls here

    if (ctx.reducerEvent.status === Status.Committed) {
        console.log(`Our message "${messageText}" sent successfully.`);
    } else if (ctx.reducerEvent.status.isFailed()) {
        console.error(`Failed to send "${messageText}": ${ctx.reducerEvent.status.getFailedMessage()}`);
    }
}

Specifically:

  • ctx.reducerEvent.callerIdentity.isEqual(this.identity)
  • ctx.reducerEvent.status === Status.Committed
  • ctx.reducerEvent.status.isFailed()
  • ctx.reducerEvent.status.getFailedMessage()

I've corrected the issues and ensured that this particular example compiles and works by adapting it to an existing project.

Copy link
Contributor

@gefjon gefjon left a comment

Choose a reason for hiding this comment

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

Thanks so much!

@gefjon
Copy link
Contributor

gefjon commented Apr 28, 2025

Fixes #336

@gefjon gefjon merged commit 9f66227 into clockworklabs:master Apr 28, 2025
3 checks passed
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.

2 participants