Skip to content

feat(fix): read current Jira context on fix runs - #2247

Draft
Aliciapet11 wants to merge 3 commits into
feat/aisdlc-835-fix-jira-contextfrom
codex/aisdlc-835-fix-jira-read
Draft

Aliciapet11 wants to merge 3 commits into
feat/aisdlc-835-fix-jira-contextfrom
codex/aisdlc-835-fix-jira-read

Conversation

@Aliciapet11

@Aliciapet11 Aliciapet11 commented Dec 2, 2026 •

Copy link
Copy Markdown

Fix runs currently retain Jira origin metadata but never reload the source issue's requirements. This draft reads the managed PR/MR origin record and fetches the current description, comments and configured acceptance-criteria field on every run. Applicable requirements join review feedback within the human instruction's scope; conflicts are reported for clarification.

Stacked on #2178, with feat/aisdlc-835-fix-jira-context as the base. Keep draft until the base merges, then rebase onto main, retarget and rerun checks. Related: #1993 and AISDLC-835; this PR does not close either ticket.

The runner uses the existing read-only fullsend issues get --tracker jira command. It checks the configured site and project, and the returned issue identity. Missing, ambiguous, misplaced or invalid origin metadata never triggers a lookup. Fetch failures leave review/CI fixes available. The editable marker is not authenticated provenance; restricting reads to the configured project limits its scope but does not establish provenance.

Credential delivery and acceptance criteria

  • Remove mandatory FULLSEND_JIRA_* harness references: forge-sourced fix jobs do not receive those named Jira secrets. The built-in harness requires no Jira credentials, so unavailable access does not fail harness validation.
  • Support the existing GitHub runner-secrets channel through an opt-in, base-derived fix harness. It references only the aliases needed for the chosen authentication mode: JIRA_API_TOKEN / optional JIRA_API_EMAIL, or JIRA_API_CLIENT_ID / JIRA_API_CLIENT_SECRET. Deployment configuration is documented; this PR does not provision secrets or change managed workflows. GitLab needs equivalent runner-only host configuration.
  • Pre-fix removes aliases and canonical Jira variables through re-exec, then maps saved values into canonical names only for the trusted fetch process. Post-fix strips them before repository hooks/installers. The sandbox receives data, never the real credentials. Synthetic hook tests cover the boundary; no actual credential leak was observed.
  • Add runner-only FIX_JIRA_ACCEPTANCE_CRITERIA_FIELD, empty by default and overridden with a verified customfield_N ID in the custom harness. Use CLI --fields, preserve text/rich-text values, and report an unset/invalid/unavailable field separately while retaining description/comments. A null value does not distinguish an empty field from an inaccessible field. The example field ID is not a portable default.

Architecture question and provider alternative

Code and triage already read Jira directly using the built-in read-only provider and skills/jira-forge; Jira content reaching model context is existing behavior. The provider protects credentials with placeholders and the proxy. This draft instead stages a runner-created sidecar. The custom pre-script guide says not to stage unfiltered source content and describes a future filtered snapshot. That guidance needs reconciling with the sidecar design; it is not evidence of a universal prohibition on Jira reading or an enforced content filter in code/triage. Selecting fields and distrust instructions are not a content-injection filter.

Reusing the provider is technically possible on non-Jira runs. It needs a coordinated Fullsend change to deliver named Jira credentials to opted-in fix jobs. The runner-secrets bundle cannot simply feed the provider: validateRunnerSecretProviders rejects those references. A provider implementation would add the read-only provider and Jira read skill to the fix harness, use the origin metadata to select the issue, and replace the sidecar reader. That is a separate route from this runner-side implementation.

Before marking ready

  1. Merge chore(code): record Jira origin in PR metadata #2178, rebase and retarget to main.
  2. Agree the sidecar ingestion/provenance boundaries, or switch to the provider route with its Fullsend credential-delivery change.
  3. Configure the deployment's runner-secret aliases and verified acceptance-criteria field, then demonstrate a real fix run observing description/comment/criteria edits without restating them. No live Jira run has been performed.
  4. Resolve the remaining AISDLC-835 history scope: this supplies current content and comparisons with the implementation, not a verified description/criteria diff since PR creation. Older PRs without origin metadata are not backfilled.
  5. Complete full repository validation and rerun after rebasing.

Validation

  • Ten Python tests pass: origin validation, repeated reads, site/project/identity checks, tracker composition, unavailable access, field selection, empty/null criteria and preserved rich text.
  • Full pre-fix suite passes with GitHub and GitLab fixtures, token/email, bearer, OAuth, canonical credential compatibility, missing auth, separate criteria delivery and stale-sidecar removal. Forge-reader mocks reject inherited Jira credential variables.
  • Focused post-fix repository-hook regression passes with all canonical and alias credential variables populated using synthetic values.
  • Harness Go tests, authorization regression suite, make script-build, make check-bundle, pre-commit run --all-files, and make lint pass.
  • A fresh local make test is running; full-suite success is not yet claimed. Previous broad local runs were incomplete due tooling/environment issues and long reruns, as recorded in the draft's earlier revisions.

Signed-off-by: apetruni <apetruni@redhat.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 12:01 PM UTC · Completed 12:14 PM UTC

Commit: f3b8212 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $3.11

@fullsend-ai-review fullsend-ai-review Bot added the risk/elevated PR risk: elevated label Dec 2, 2026
@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: elevated (3/5)

Details

Elevated risk driven by modifications to 12 protected paths and CI workflow files in core fix runner scripts with high regression history and change coupling, balanced by good test coverage, clear issue alignment, and non-fatal fallback behavior.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

High

  • [secret-exposure] harness/fix.yaml:207 — When tracker.jira is configured, the new overlay puts FULLSEND_JIRA_TOKEN, FULLSEND_JIRA_EMAIL, FULLSEND_JIRA_CLIENT_ID and FULLSEND_JIRA_CLIENT_SECRET into env.runner, so both the pre-fix and post-fix scripts inherit them. Nothing in scripts/post-fix.sh, scripts/pre-fix.src.sh or scripts/pre-fix.sh removes them. post-fix.sh runs pre-commit run --files ... (lines 2466 and 2574) after installing repo tools, and both run repository-controlled code. A PR-controlled local hook can read and exfiltrate the Jira credentials even though they are not mounted into the sandbox. scripts/post-code.sh:109-125 already shows the expected pattern: it stashes the credentials and re-execs with env -u FULLSEND_JIRA_* ... before any hook runs. post-fix.sh has no equivalent.
    Remediation: Follow the post-code.sh pattern in both pre-fix and post-fix. Give the credentials only to the trusted fetch-fix-jira-context.py call, or don't give them to post-fix at all. Make sure repo-controlled installers and pre-commit hooks never see them. Add a test with a local pre-commit hook that checks the variables are absent.

Medium

  • [protected-path] agents/fix.md, harness/fix.yaml, harness/triggertest/trigger_test.go, scripts/fetch-fix-jira-context-test.py, scripts/fetch-fix-jira-context.py, scripts/lib/github-fix-ops.lib.sh, scripts/lib/gitlab-fix-ops.lib.sh, scripts/post-fix.sh, scripts/pre-fix-test.sh, scripts/pre-fix.sh, scripts/pre-fix.src.sh, skills/fix-review/SKILL.md — This PR modifies governance/infrastructure files under protected paths. The description links related issue Fix agent: automatically read the linked Jira issue in every run #1993 and explains the rationale, but human approval is always required for protected-path changes, regardless of context.

Low

  • [pattern-inconsistency] scripts/lib/gitlab-fix-ops.lib.sh:78 — forge_get_pr_context() calls _gitlab_api directly, without the subshell that sets GITLAB_TOKEN="${PUSH_TOKEN:-${GITLAB_TOKEN:-}}" and redirects 2>/dev/null. The sibling merge-request readers (forge_get_pr_head_ref, forge_get_pr_base_branch, forge_get_pr_merge_state) and the GitHub counterpart use that pattern. This is a consistency nit.
    Remediation: Use local pr_number="$1" and wrap the call in a subshell that sets GITLAB_TOKEN from PUSH_TOKEN first, with 2>/dev/null, as the sibling readers do.
  • [breaking-config] harness/fix.yaml:110 — FULLSEND_DIR: "${FULLSEND_DIR}" is now unconditional in top-level env.runner, so every fix run needs a host FULLSEND_DIR, including repos with no Jira config. In code.yaml, triage.yaml and prioritize.yaml, FULLSEND_DIR sits inside a Jira-conditional overlay, not at top level. If the fix dispatch workflow doesn't export it, harness expansion fails before the best-effort pre-script runs. I could not confirm from this repo that the workflow sets it.
    Remediation: Confirm that the fix dispatch workflow exports FULLSEND_DIR before merging, or move it into the has(config.tracker) && has(config.tracker.jira) overlay as the other harnesses do.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

Signed-off-by: apetruni <apetruni@redhat.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 12:28 PM UTC · Completed 12:37 PM UTC

Commit: 26b909a · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.76

@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: elevated (3/5)

Details

Elevated risk driven by modifications to 14 protected paths and CI workflow files across core fix runner scripts with high regression history and change coupling, balanced by strong test coverage, clear issue alignment, and non-fatal fallback behavior.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Medium

  • [protected-path] harness/fix.yaml, scripts/lib/github-fix-ops.lib.sh, scripts/lib/gitlab-fix-ops.lib.sh, scripts/post-fix.sh, scripts/post-fix.src.sh, scripts/pre-fix.sh, scripts/pre-fix.src.sh, scripts/fetch-fix-jira-context.py, the scripts/*-test.* files, agents/fix.md, skills/fix-review/SKILL.md, harness/triggertest/trigger_test.go — this PR modifies governance/infrastructure files under protected paths (agents/, harness/, scripts/, skills/). The PR links related issue Fix agent: automatically read the linked Jira issue in every run #1993 and explains the rationale, but human approval is always required for protected-path changes, regardless of context.
  • [data-exposure] scripts/fetch-fix-jira-context.py:85 — The editable PR/MR footer determines which Jira issue the runner reads with its credentials. read_origin checks the record's format and footer placement, and fetch_context checks the tenant against runner config and the returned URL/number. Nothing shows that this repository or the triggering actor may read the chosen issue. Anyone who can edit the PR body can swap in another issue key on the configured tenant, and that issue's description and comments then enter the fix sandbox. This matters when the Jira credential can read projects that repo collaborators cannot. Advisory: it needs a design decision (trusted provenance or a repo-to-project allowlist) rather than a mechanical fix.
    Remediation: Bind the origin to trusted runner-side provenance (for example a record written by the code post-script and stored outside the editable body) or enforce a trusted repository-to-Jira-project allowlist before fetching.

Low

  • [pattern-inconsistency] scripts/lib/github-fix-ops.lib.sh:54 — forge_get_pr_context passes "$1" straight to gh pr view. Sibling PR helpers in this file, and the GitLab counterpart, assign local pr_number="$1" first.
    Remediation: Declare local pr_number="$1" and use "${pr_number}"; rebuild bundles with make script-build.

Earlier findings

  • harness/fix.yaml:207, secret-exposure — resolved. pre-fix and post-fix now re-exec with the Jira credential variables removed. pre-fix hands them over through an unlinked descriptor and exports them only into the Jira fetch. This covers the direct environment path that repository hooks and installers could read. The external harness launcher was not in the reviewed tree.
  • scripts/lib/gitlab-fix-ops.lib.sh:78, pattern-inconsistency — resolved. forge_get_pr_context now uses local pr_number, an isolated token subshell and 2>/dev/null, matching forge_get_pr_head_ref.
  • harness/fix.yaml:110, breaking-config — resolved. FULLSEND_DIR is removed from the base env.runner and set only in the Jira overlay, which is its only runtime reader.

@fullsend-ai-review
fullsend-ai-review Bot dismissed their stale review December 2, 2026 12:37

Superseded by updated review

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review

Copy link
Copy Markdown

Finding threads left open (3):

  1. Thread: the explanation was posted, but the thread could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  2. Thread: the explanation was posted, but the thread could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  3. Thread: the explanation was posted, but the thread could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.

Outdated review threads left open (1):

  1. Thread: the review bot could not resolve this outdated thread. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.

@fullsend-ai-review fullsend-ai-review Bot added the requires-manual-review Review requires human judgment label Dec 2, 2026
Signed-off-by: apetruni <apetruni@redhat.com>
@fullsend-ai-review

fullsend-ai-review Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 2:19 PM UTC · Completed 2:33 PM UTC

Commit: 26823d4 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $2.52

@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: elevated (3/5)

Details

Elevated risk driven by modifications to 14 protected paths and CI workflow files across core fix runner scripts with high regression history and change coupling, balanced by strong test coverage, clear issue alignment, and non-fatal fallback behavior.

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Medium

  • [data-exposure] scripts/fetch-fix-jira-context.py:97 — The editable PR/MR origin marker still decides which issue the privileged Jira credential reads. Tenant, project, field-id and returned-identity checks narrow the exposure but do not authenticate the issue-to-PR association, so a PR author can substitute another issue in the configured project and have its description, comments and acceptance criteria staged into the fix sandbox. The PR description acknowledges this as an open provenance question.
    Remediation: Verify the association with runner-trusted provenance (persisted mapping or authenticated origin record bound to repo and PR) or use the provider route; add a regression test that editing the footer cannot fetch another issue.
  • [protected-path] harness/fix.yaml — This PR modifies protected paths (agents/fix.md, harness/fix.yaml, harness/triggertest/trigger_test.go, scripts/*, skills/fix-review/SKILL.md). The PR links related issue Fix agent: automatically read the linked Jira issue in every run #1993 and explains the rationale, but human approval is always required for protected-path changes regardless of context.

Low

  • [pattern-inconsistency] scripts/lib/github-fix-ops.lib.sh:54 — forge_get_pr_context uses $1 directly instead of local pr_number="$1", unlike sibling functions and the GitLab counterpart.
    Remediation: Assign local pr_number="$1" and pass it to gh pr view; rerun make script-build.

@fullsend-ai-review fullsend-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See the review comment for full details.

]
if field_valid:
args.extend(["--fields", field])
issue = run_json(args)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[medium] data-exposure

The PR/MR's editable origin marker still decides which issue the privileged Jira credential reads. The checks constrain the URL to the configured tenant, compare the key's project with trusted runner configuration, validate the optional custom-field identifier, and confirm the returned URL and number match the marker. None of these proves the issue belongs to this PR or that the repository is allowed to see it. A PR author can put another valid issue number from the configured project in the footer, including issues only the integration account can see, and have its description, comments and acceptance criteria staged into the fix sandbox. Project scoping narrows the exposure but does not remove it. The PR description acknowledges this as an open provenance/architecture question.

Suggested fix: Before fetching, verify the issue-to-PR association using runner-trusted provenance (a persisted mapping or an authenticated origin record bound to the repository and PR), or switch to the provider route. Add a regression test showing that editing the footer cannot fetch another issue in the configured project.

}

# Runner-only metadata for Jira context discovery.
forge_get_pr_context() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[low] pattern-inconsistency

forge_get_pr_context uses positional argument $1 directly instead of assigning local pr_number="$1", unlike sibling functions in this library and the GitLab counterpart.

Suggested fix: Assign local pr_number="$1" at the start of forge_get_pr_context() and pass it to gh pr view; rerun make script-build.

@fullsend-ai-review

Copy link
Copy Markdown

Finding threads left open (1):

  1. Thread: the explanation was posted in this older copy of a finding thread, but it could not be resolved. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.

Outdated review threads left open (2):

  1. Thread: the review bot could not resolve this outdated thread. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.
  2. Thread: the review bot could not resolve this outdated thread. Reason: FORBIDDEN: Resource not accessible by integration. Next step: resolve it manually.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-manual-review Review requires human judgment risk/elevated PR risk: elevated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant