kelos-dev / kelos-dev/kelos

Bug: Jira source {{.Body}} always empty — description field not fetched from API

Open
#990 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

actor/kelos generated-by-kelos kind/bug priority/important-soon triage-accepted
Dominant language
Go
Stars
331
Forks
40
Avg merge
1d 21h
Merged PRs (30d)
70

Description

🤖 Kelos User Agent @gjkim42

Problem

The Jira source implementation never fetches the issue description from the Jira API, so `{{.Body}}` silently evaluates to an empty string in all Jira-based prompt templates — even though both the documentation and the official example use it.

Documentation says it works

integration.md (example prompt):
```yaml
promptTemplate: |
Fix the following Jira issue:

{{.Title}}

{{.Body}}
branch: "jira-{{.ID}}"
```

integration.md template variable table:

Variable Jira
`{{.Body}}` Issue description
Code shows it doesn't

internal/source/jira.go:163 — `description` is absent from the `fields` query parameter:
```go
params.Set("fields", "summary,status,labels,comment,issuetype")
```

internal/source/jira.go:47-53 — `jiraIssueFields` struct has no `Description` field:
```go
type jiraIssueFields struct {
Summary string `json:"summary"`
Status *jiraStatus `json:"status,omitempty"`
Labels []string `json:"labels"`
Comment *jiraComments `json:"comment,omitempty"`
IssueType *jiraIssueType `json:"issuetype,omitempty"`
}
```

internal/source/jira.go:96-104 — `WorkItem.Body` is never set when building the result:
```go
items = append(items, WorkItem{
ID: issue.Key,
Number: number,
Title: issue.Fields.Summary,
URL: fmt.Sprintf(...),
Labels: issue.Fields.Labels,
Comments: comments,
Kind: kind,
// Body is never set — always ""
})
```

Impact

Any Jira-triggered task that includes `{{.Body}}` in its prompt template silently drops the issue description. Agents receive only the title and comments, missing the full context needed to do the work correctly.

Suggested Fix

  1. Add `description` to the `fields` request parameter:
    ```go
    params.Set("fields", "summary,status,labels,comment,issuetype,description")
    ```

  2. Add a `Description` field to `jiraIssueFields`:
    ```go
    type jiraIssueFields struct {
    Summary string `json:"summary"`
    Description interface{} `json:"description,omitempty"` // string or ADF object
    Status *jiraStatus `json:"status,omitempty"`
    Labels []string `json:"labels"`
    Comment *jiraComments `json:"comment,omitempty"`
    IssueType *jiraIssueType `json:"issuetype,omitempty"`
    }
    ```
    Note: Jira Cloud returns descriptions as Atlassian Document Format (ADF) objects (same as comment bodies) while Jira Data Center/Server returns plain strings — the existing `commentBodyToString` helper already handles this distinction.

  3. Populate `WorkItem.Body` in `Discover`:
    ```go
    items = append(items, WorkItem{
    // ...
    Body: commentBodyToString(issue.Fields.Description),
    // ...
    })
    ```

  4. Add a test covering the `Body` field for both Jira Cloud (ADF description) and Jira Data Center (plain string description).

/kind bug

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in internal/source/jira.go, reading jiraIssueFields, the fields query in Discover, and the WorkItem construction. Reuse the existing commentBodyToString handling for both Jira Cloud ADF and Data Center plain descriptions. Add coverage for both description formats and verify that {{.Body}} contains the Jira description.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.