Skip to content

Commit 0508cd7

Browse files
committed
Clarify issue type form routing
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ea8faa5c-7f26-4e2d-bf9c-6f0b5f173e8c
1 parent f5f644c commit 0508cd7

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

pkg/github/issues.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,14 +2047,6 @@ var issueWriteFormParams = map[string]struct{}{
20472047
"_ui_submitted": {},
20482048
}
20492049

2050-
func shouldIssueWriteDeferToForm(ctx context.Context, deps ToolDependencies, req *mcp.CallToolRequest, args map[string]any) bool {
2051-
issueType, issueTypeProvided, err := OptionalParamOK[string](args, "type")
2052-
explicitTypeClear := err == nil && issueTypeProvided && issueType == "" && args["method"] == "update"
2053-
// The form cannot preserve an empty type, so execute the complete call
2054-
// directly to avoid dropping the clear or any co-submitted values.
2055-
return !explicitTypeClear && shouldDeferToForm(ctx, deps, req, args, issueWriteFormParams)
2056-
}
2057-
20582050
// issueWriteAwaitingFormResult builds the "awaiting form submission" stub
20592051
// returned when issue_write hands off to the MCP App form. The body is shared
20602052
// by IssueWrite and LegacyIssueWrite. The result is marked IsError=true so
@@ -2232,7 +2224,15 @@ Options are:
22322224

22332225
// Hand off to the interactive MCP App form unless this call must
22342226
// execute now (see shouldDeferToForm).
2235-
if shouldIssueWriteDeferToForm(ctx, deps, req, args) {
2227+
deferToForm := shouldDeferToForm(ctx, deps, req, args, issueWriteFormParams)
2228+
if method == "update" {
2229+
if issueType, ok := args["type"].(string); ok && issueType == "" {
2230+
// The form replaces an empty type with the current type, so execute
2231+
// directly to preserve the clear and any co-submitted values.
2232+
deferToForm = false
2233+
}
2234+
}
2235+
if deferToForm {
22362236
issueNumber := 0
22372237
if method == "update" {
22382238
n, numErr := RequiredInt(args, "issue_number")

0 commit comments

Comments
 (0)