Skip to content

Commit b2164a1

Browse files
committed
fix broken issue update logic
1 parent 69579b2 commit b2164a1

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

pkg/github/issues.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,8 +1083,15 @@ Options are:
10831083
return utils.NewToolResultError(err.Error()), nil, nil
10841084
}
10851085

1086-
// When insiders mode is enabled, show UI - the host will detect the UI metadata and display the form
1087-
if deps.GetFlags().InsidersMode {
1086+
// When insiders mode is enabled and this is an initial request (no title provided),
1087+
// show UI - the host will detect the UI metadata and display the form.
1088+
// If title is provided, this is a submission from the UI form, so proceed with the operation.
1089+
title, err := OptionalParam[string](args, "title")
1090+
if err != nil {
1091+
return utils.NewToolResultError(err.Error()), nil, nil
1092+
}
1093+
1094+
if deps.GetFlags().InsidersMode && title == "" {
10881095
if method == "update" {
10891096
issueNumber, numErr := RequiredInt(args, "issue_number")
10901097
if numErr != nil {
@@ -1095,11 +1102,6 @@ Options are:
10951102
return utils.NewToolResultText(fmt.Sprintf("Ready to create an issue in %s/%s. The interactive form will be displayed.", owner, repo)), nil, nil
10961103
}
10971104

1098-
title, err := OptionalParam[string](args, "title")
1099-
if err != nil {
1100-
return utils.NewToolResultError(err.Error()), nil, nil
1101-
}
1102-
11031105
// Optional parameters
11041106
body, err := OptionalParam[string](args, "body")
11051107
if err != nil {

ui/src/apps/issue-write/App.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,14 +478,18 @@ function CreateIssueApp() {
478478
const assigneeLogins = (issueData.assignees || [])
479479
.map((a: { login?: string } | string) => typeof a === 'string' ? a : a.login)
480480
.filter(Boolean) as string[];
481+
console.log("Assignees from issue data:", issueData.assignees, "-> logins:", assigneeLogins, "prefillApplied:", prefillApplied.current.assignees);
481482
if (assigneeLogins.length > 0 && !prefillApplied.current.assignees) {
483+
console.log("Setting selectedAssignees to:", assigneeLogins.map(login => ({ id: login, text: login })));
482484
setSelectedAssignees(assigneeLogins.map(login => ({ id: login, text: login })));
483485
prefillApplied.current.assignees = true;
484486
}
485487

486488
// Pre-fill issue type immediately from issue data
487489
const issueTypeName = issueData.type?.name || (typeof issueData.type === 'string' ? issueData.type : null);
490+
console.log("Issue type from issue data:", issueData.type, "-> name:", issueTypeName, "prefillApplied:", prefillApplied.current.type);
488491
if (issueTypeName && !prefillApplied.current.type) {
492+
console.log("Setting selectedIssueType to:", { id: issueTypeName, text: issueTypeName });
489493
setSelectedIssueType({ id: issueTypeName, text: issueTypeName });
490494
prefillApplied.current.type = true;
491495
}
@@ -652,7 +656,15 @@ function CreateIssueApp() {
652656
params.type = selectedIssueType.text;
653657
}
654658

659+
console.log("Submitting issue_write with params:", JSON.stringify(params, null, 2));
660+
console.log("selectedLabels:", selectedLabels);
661+
console.log("selectedAssignees:", selectedAssignees);
655662
const result = await callTool("issue_write", params);
663+
console.log("issue_write result:", result);
664+
console.log("issue_write result.content:", result.content);
665+
if (result.content?.[0]?.text) {
666+
console.log("issue_write result text:", result.content[0].text);
667+
}
656668

657669
if (result.isError) {
658670
const textContent = result.content?.find(
@@ -863,7 +875,7 @@ function CreateIssueApp() {
863875
</Box>
864876

865877
{/* Metadata section */}
866-
<Box display="flex" gap={3} mb={3} sx={{ flexWrap: "wrap" }}>
878+
<Box display="flex" gap={4} mb={3} sx={{ flexWrap: "wrap" }}>
867879
{/* Labels dropdown */}
868880
<ActionMenu>
869881
<ActionMenu.Button size="small" leadingVisual={TagIcon}>

0 commit comments

Comments
 (0)