Skip to content

Fix update function signatures and data handling in GET requests #13

Draft
satti-hari-krishna-reddy wants to merge 14 commits intoShuffle:mainfrom
satti-hari-krishna-reddy:main
Draft

Fix update function signatures and data handling in GET requests #13
satti-hari-krishna-reddy wants to merge 14 commits intoShuffle:mainfrom
satti-hari-krishna-reddy:main

Conversation

@satti-hari-krishna-reddy
Copy link
Copy Markdown
Contributor

@satti-hari-krishna-reddy satti-hari-krishna-reddy commented Apr 9, 2026

NoTE: This depends on Shuffle/shuffle-shared#367

@satti-hari-krishna-reddy satti-hari-krishna-reddy marked this pull request as draft April 9, 2026 14:05
Copy link
Copy Markdown
Member

@frikky frikky left a comment

Choose a reason for hiding this comment

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

This is weird

Comment thread pkg/api.go
// Runs attempts up to X times
var maxRerunAttempts = 7
// var maxRerunAttempts = 7
var maxRerunAttempts = 3
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are you sure about this? I don't mind, but I'd rather have something working but slow, than broken and fast.

Comment thread pkg/api.go
}

ctx = context.WithValue(ctx, "caller", "RunCategoryAction")
ctx = context.WithValue(ctx, "org_id", org.Id)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure I understand what these do. Is it related to the logging stuff?

Comment thread pkg/api.go
// Check if this is a GET request - GET requests should NOT have a body
isGetRequest := false
for _, p := range secondAction.Parameters {
if p.Name == "method" && strings.ToUpper(p.Value) == "GET" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Problem: Other methods can also not have a body. E.g. HEAD or OPTIONS. And custom methods.

How do we handle that?

Comment thread pkg/api.go
if debug {
// BUT: Don't apply this logic to proper HTTP fields like headers/body
if !isProperHttpField && ((strings.Contains(field.Value, "http") && strings.Contains(field.Value, "://") && (strings.Contains(field.Value, "GET") || strings.Contains(field.Value, "POST") || strings.Contains(field.Value, "PUT") || strings.Contains(field.Value, "PATCH") || strings.Contains(field.Value, "DELETE"))) || (strings.HasPrefix(field.Value, "{") && strings.HasSuffix(field.Value, "}"))) {
log.Printf("[HEYOOO] Singul - Found HTTP request in field %s: %s", field.Key, field.Value)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Only print of debug pls :P

Comment thread pkg/api.go
}

if len(ctx.Value("caller").(string)) == 0 {
ctx = context.WithValue(ctx, "caller", "AnalyzeIntentAndCorrectApp")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Still confused about these contexts (:

Comment thread pkg/api.go
- slack.com/api → Slack
- api.github.com → GitHub
- random-api.com → http
- api.telegram.org/bot123456:TOKEN/sendMessage → http (has bot token, keep as HTTP)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Uhm, we need a better way to handle this. We can't be adding specifics this way.

Any ideas?

Comment thread pkg/api.go
If the URL and fields clearly match a known service, return that service even if the intent text disagrees.
If the request does not strongly match any known service and appears to be a generic or custom HTTP call, return "http"

IMPORTANT: If the request already contains authentication credentials (API keys, tokens, bearer tokens in headers, bot tokens in URL, etc.),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This feels like it will break something

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