Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
706b558
feat(retro): add Jira support to the retro agent
andrewevansrh Nov 13, 2026
f44c5b3
fix(retro): address review feedback on Jira support
andrewevansrh Nov 13, 2026
392e456
fix(retro): address review feedback on origin tokens and Jira allowlist
andrewevansrh Nov 13, 2026
e44a8e3
Merge branch 'main' into feat/retro-jira-support
andrewevansrh Nov 13, 2026
0f4fcd3
fix(retro): tolerate unset forge tokens during token masking
andrewevansrh Nov 13, 2026
f14adb1
docs(retro): clarify Jira dispatch setup
andrewevansrh Nov 13, 2026
7595f85
fix(retro): address review feedback on Jira allowlist, preflight, and…
andrewevansrh Nov 13, 2026
c1ea98b
fix(retro): address review feedback on duplicate search, GitLab host,…
andrewevansrh Nov 13, 2026
2cb8ceb
Merge branch 'main' into feat/retro-jira-support
andrewevansrh Nov 13, 2026
a6506c7
fix(retro): resolve conflicts with main
andrewevansrh Nov 17, 2026
9c00301
docs(retro): clarify Jira comment number mapping
andrewevansrh Nov 17, 2026
df38b5f
Merge branch 'main' into feat/retro-jira-support
andrewevansrh Nov 17, 2026
81a441a
fix(retro): address unresolved Jira review feedback
andrewevansrh Nov 18, 2026
bad4d0f
Merge branch 'main' into feat/retro-jira-support
andrewevansrh Nov 18, 2026
0b0a784
fix(retro): address remaining Jira review findings
andrewevansrh Nov 18, 2026
640ebc8
test(retro): tighten Jira review regressions
andrewevansrh Nov 18, 2026
6450b35
Merge branch 'main' into feat/retro-jira-support
andrewevansrh Nov 19, 2026
cf13ce7
fix(retro): address Jira review findings
andrewevansrh Nov 19, 2026
accf221
test(retro): reject incomplete Jira CLI help output
andrewevansrh Nov 19, 2026
1c7f751
fix(retro): correct Jira CLI preflight and gate token masks
andrewevansrh Nov 19, 2026
e24f612
fix(retro): mint Jira client-credentials tokens on demand
andrewevansrh Nov 19, 2026
f43a688
docs(retro): correct forge-originated Jira and rerun claims
andrewevansrh Nov 19, 2026
6af9dcb
fix(retro): mint and route Jira REST once per run
andrewevansrh Nov 19, 2026
25216d8
test(retro): cover untested Jira branches
andrewevansrh Nov 19, 2026
12aa474
docs(retro): correct FULLSEND_DIR and Jira-originated run claims
andrewevansrh Nov 19, 2026
57aa5f1
Merge branch 'main' into feat/retro-jira-support
andrewevansrh Nov 19, 2026
b9eb599
Merge branch 'main' into feat/retro-jira-support
andrewevansrh Nov 19, 2026
e8a66f4
Merge branch 'main' into feat/retro-jira-support
andrewevansrh Nov 20, 2026
f60bbce
fix(retro): decide Jira labels from edit metadata and keep the summary
andrewevansrh Nov 20, 2026
f004ab8
fix(retro): cap Jira issue bodies at the CLI's 32 KiB limit
andrewevansrh Nov 20, 2026
a0f7f37
test(retro): cover RETRO_MODE on the forge tracker
andrewevansrh Nov 20, 2026
2ff437b
fix(retro): cap the Jira summary comment in bytes, not characters
andrewevansrh Nov 20, 2026
a7f77bf
feat(retro): add agent-side Jira-originated retrospective support
andrewevansrh Nov 20, 2026
0d39ecd
Merge branch 'main' into feat/retro-jira-support
waynesun09 Nov 21, 2026
b194ca1
Merge branch 'main' into feat/retro-jira-support
andrewevansrh Nov 23, 2026
8044e9a
fix(retro): address Jira review findings on mount, dedupe, and docs
andrewevansrh Nov 23, 2026
71f7f08
fix(retro): validate context size bounds and cache REST root in pre-r…
andrewevansrh Nov 23, 2026
e3dd031
fix(retro): normalize Jira summaries and fail closed on context write
andrewevansrh Nov 23, 2026
475545d
fix(retro): reject blank Jira titles before filing any proposal
andrewevansrh Nov 23, 2026
efea22c
fix(retro): harden Jira context and comment handling from review
andrewevansrh Nov 23, 2026
69cd0e5
Merge branch 'main' into feat/retro-jira-support
andrewevansrh Nov 23, 2026
d96d2ce
fix(retro): exempt reporter from the Jira createmeta preflight
andrewevansrh Nov 23, 2026
016bc42
fix(retro): reject a relative Jira context path and drop a dead alias
andrewevansrh Nov 23, 2026
c497b65
fix(retro): scope the permission word match to Jira targets
andrewevansrh Nov 23, 2026
38e5f34
test(retro): drain the mocked OAuth token request body
andrewevansrh Nov 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion agents/retro.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@ You are a retrospective analyst. You examine agent workflows — completed, reje
## Inputs

- `ORIGINATING_URL` — HTML URL of the PR or issue that triggered this retro.
This is a GitHub PR/issue or GitLab MR/issue URL, or, for a Jira-originated
run, a Jira issue URL (`https://<site>.atlassian.net/browse/PROJ-123`).
- `RETRO_JIRA_CONTEXT` — Jira-originated runs only: path to the issue and
comments the host pre-script fetched (`/sandbox/workspace/jira-origin.json`).
The sandbox has no Atlassian route or Jira credential, so this file is the
only Jira data available; see the `retro-analysis-jira` skill.
- `RETRO_COMMENT` — (optional) The human's `/fs-retro` comment, if this was triggered on-demand. This is high-signal context: the human is telling you what to focus on. Read it carefully.
- `REPO_FULL_NAME` — The source repository (owner/repo).
- `FULLSEND_FORGE` — the forge type (`github` or `gitlab`). Set by the harness forge section.
- `FULLSEND_FORGE` — the forge type (`github` or `gitlab`) whose repos and
agent runs you trace. Set by the harness forge section, and independent of
the tracker that receives proposals.
- `FULLSEND_OUTPUT_DIR` — Directory where you must write output files.

## Your role
Expand Down Expand Up @@ -50,6 +58,13 @@ These are defaults. If RETRO_COMMENT provides different focus areas, prioritize

Use the `retro-analysis` skill for detailed workflow tracing recipes.

**Jira-originated runs** (`ORIGINATING_URL` is a Jira issue URL): read
`RETRO_JIRA_CONTEXT` first — the host pre-script wrote the issue and its
comments there, and the sandbox has no route to Atlassian or Jira credential.
Use `retro-analysis-jira` for that file's layout, and trace the agent side
with the forge recipes as usual. If the file is missing, record the gap in
`summary` instead of guessing.

**Discover the agents repo from the run log.** Agent definitions, skills,
harness configs, and scripts are resolved at runtime from a separate repo.
Extract it from the workflow run log — see the `retro-analysis` skill's
Expand Down
188 changes: 177 additions & 11 deletions docs/retro.md

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions harness/retro.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,22 @@ host_files:
- src: ${GCP_OIDC_TOKEN_FILE}
dest: /sandbox/workspace/.gcp-oidc-token
optional: true
# A Jira-originated run cannot read its work item from the sandbox: there is
# no Atlassian route and no Jira credential. pre-retro fetches the issue and
# its comments on the host into the path named by RETRO_JIRA_CONTEXT_FILE,
# which is mounted read-only here and read by the agent as
# RETRO_JIRA_CONTEXT. The src is ${VAR}-expanded because fullsend refuses a
# literal absolute path in a harness loaded from a URL or used as a `base:`
# (resolveBaseHostFiles -> validateBaseRelPath), and the documented overlay
# is exactly that. An unset value skips the mount, so a forge-originated run
# uploads nothing and pre-retro refuses a Jira-originated run without it.
- src: ${RETRO_JIRA_CONTEXT_FILE}
dest: /sandbox/workspace/jira-origin.json
optional: true

skills:
- skills/retro-analysis
- skills/retro-analysis/jira
- skills/finding-agent-runs
- skills/agent-scaffolding
- skills/autonomy-readiness
Expand All @@ -68,6 +81,9 @@ env:
ORIGINATING_URL: "${ORIGINATING_URL}"
RETRO_COMMENT: "${RETRO_COMMENT}"
REPO_FULL_NAME: "${REPO_FULL_NAME}"
# Read-only copy of the originating Jira issue and its comments, written
# by pre-retro and mounted by host_files above. Absent on forge runs.
RETRO_JIRA_CONTEXT: /sandbox/workspace/jira-origin.json

validation_loop:
script: scripts/validate-output-schema.sh
Expand Down
17 changes: 17 additions & 0 deletions scripts/jira-auth-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ run_case() {
env -u FULLSEND_JIRA_TOKEN -u FULLSEND_JIRA_EMAIL -u FULLSEND_JIRA_CLIENT_ID \
-u FULLSEND_JIRA_CLIENT_SECRET -u JIRA_TOKEN -u JIRA_USER_EMAIL -u JIRA_API_URL \
PATH="${MOCK_BIN}:${PATH}" LOG_DIR="${CASE_DIR}" EXPECTED_SECRET="${SECRET}" \
GITHUB_ACTIONS="${TEST_GITHUB_ACTIONS-1}" \
TEST_SECRET="${SECRET}" TEST_CLIENT_ID="${CLIENT_ID}" TEST_API_URL="${API_URL}" \
FAKE_MINT="${FAKE_MINT:-ok}" FAKE_EXPIRES_IN="${FAKE_EXPIRES_IN:-3600}" \
bash -c "set -euo pipefail; source '${LIB}'; ${body}" \
Expand Down Expand Up @@ -245,6 +246,22 @@ else
fi
assert_secret_hidden "client"

# Outside GitHub Actions the mask line is not emitted: ::add-mask:: would be
# ordinary log output there and would print the token.
TEST_GITHUB_ACTIONS="" run_case client-no-gha '
export JIRA_API_URL="${TEST_API_URL}"
jira_auth_select "" TEST_CLIENT_ID TEST_SECRET
jira_auth_mint
echo "minted=$([[ -n "${_JIRA_AUTH_ACCESS_TOKEN}" ]] && echo yes || echo no)"
'
if [[ "${CASE_RC}" -eq 0 ]] && grep -qx "minted=yes" "${CASE_OUT}" \
&& ! grep -qF "::add-mask::" "${CASE_OUT}" "${CASE_ERR}" \
&& ! grep -qF "minted-token" "${CASE_OUT}" "${CASE_ERR}"; then
pass "client-no-gha-emits-no-mask"
else
fail "client-no-gha-emits-no-mask" "rc=${CASE_RC}; $(cat "${CASE_OUT}" "${CASE_ERR}" 2>/dev/null)"
fi

# xtrace on: the mint still prints no secret.
run_case client-xtrace '
export JIRA_API_URL="${TEST_API_URL}"
Expand Down
34 changes: 26 additions & 8 deletions scripts/lib/github-retro-ops.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,45 @@ source "${BASH_SOURCE[0]%/*}/github-host.lib.sh"

# --- URL handling ---

forge_validate_originating_url() {
_forge_validate_originating_url() {
local path
if ! path=$(_github_url_path "${ORIGINATING_URL}") \
|| [[ ! "${path}" =~ ^[a-zA-Z0-9._-]+/[a-zA-Z0-9._-]+/(issues|pull)/[0-9]+$ ]]; then
echo "ERROR: ORIGINATING_URL does not match expected pattern: $(_gha_sanitize "${ORIGINATING_URL}")" >&2
return 1
fi
}
forge_validate_originating_url() {
Comment thread
andrewevansrh marked this conversation as resolved.
Resolved
_forge_validate_originating_url
}

forge_parse_originating_url() {
_forge_parse_originating_url() {
# shellcheck disable=SC2034 # ORIGINATING_REPO consumed by callers after function returns
ORIGINATING_REPO=$(_github_url_path "${ORIGINATING_URL}" | sed -E 's#/(issues|pull)/.*##')
# shellcheck disable=SC2034 # ORIGINATING_NUMBER consumed by callers after function returns
ORIGINATING_NUMBER=$(basename "${ORIGINATING_URL}")
}
forge_parse_originating_url() {
_forge_parse_originating_url
}

# --- Token handling ---

forge_mask_token() {
if [[ -n "${GITHUB_ACTIONS:-}" ]]; then
echo "::add-mask::${GH_TOKEN}"
_forge_mask_token() {
if [[ -n "${GITHUB_ACTIONS:-}" && -n "${GH_TOKEN:-}" ]]; then
_gha_mask "${GH_TOKEN}"
fi
}
forge_mask_token() {
_forge_mask_token
}

forge_require_token() {
_forge_require_token() {
: "${GH_TOKEN:?GH_TOKEN is required}"
}
forge_require_token() {
_forge_require_token
}

# --- Config workspace ---

Expand All @@ -57,9 +69,12 @@ forge_get_config_workspace() {

# --- Comment limits ---

forge_get_comment_max_len() {
_forge_get_comment_max_len() {
echo "65000"
}
forge_get_comment_max_len() {
_forge_get_comment_max_len
}

# --- Labels ---

Expand All @@ -83,9 +98,12 @@ forge_create_issue() {

# --- Comments ---

forge_post_comment() {
_forge_post_comment() {
local repo="$1" number="$2" body="$3"
jq -nc --arg body "${body}" '{body: $body}' | gh api \
"repos/${repo}/issues/${number}/comments" \
--input - 2>&1
}
forge_post_comment() {
_forge_post_comment "$@"
}
34 changes: 26 additions & 8 deletions scripts/lib/gitlab-retro-ops.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ _gitlab_api() {

# --- URL handling ---

forge_validate_originating_url() {
_forge_validate_originating_url() {
if [[ ! "${ORIGINATING_URL}" =~ ^https://[a-zA-Z0-9._-]+(/[a-zA-Z0-9._-]+){2,}/-/(issues|merge_requests)/[0-9]+$ ]]; then
echo "ERROR: ORIGINATING_URL does not match expected GitLab pattern: $(_gha_sanitize "${ORIGINATING_URL}")" >&2
return 1
Expand All @@ -50,8 +50,11 @@ forge_validate_originating_url() {
host=$(echo "${ORIGINATING_URL}" | sed -E 's#^https://([^/:]+)/.*#\1#')
_validate_gitlab_host "${host}" || return 1
}
forge_validate_originating_url() {
_forge_validate_originating_url
}

forge_parse_originating_url() {
_forge_parse_originating_url() {
# Extract host, project path, resource type, and number from URL.
# e.g., https://gitlab.com/group/subgroup/project/-/issues/42
# e.g., https://gitlab.com/group/project/-/merge_requests/10
Expand All @@ -70,19 +73,28 @@ forge_parse_originating_url() {
ORIGINATING_RESOURCE="issues"
fi
}
forge_parse_originating_url() {
_forge_parse_originating_url
}

# --- Token handling ---

forge_mask_token() {
_forge_mask_token() {
# ::add-mask:: is GHA-only; on non-GHA runners the echo would leak the token.
if [[ -n "${GITHUB_ACTIONS:-}" ]]; then
echo "::add-mask::${GITLAB_TOKEN}"
if [[ -n "${GITHUB_ACTIONS:-}" && -n "${GITLAB_TOKEN:-}" ]]; then
_gha_mask "${GITLAB_TOKEN}"
fi
}
forge_mask_token() {
_forge_mask_token
}

forge_require_token() {
_forge_require_token() {
: "${GITLAB_TOKEN:?GITLAB_TOKEN is required}"
}
forge_require_token() {
_forge_require_token
}

# --- Config workspace ---

Expand All @@ -92,9 +104,12 @@ forge_get_config_workspace() {

# --- Comment limits ---

forge_get_comment_max_len() {
_forge_get_comment_max_len() {
echo "1000000"
}
forge_get_comment_max_len() {
_forge_get_comment_max_len
}

# --- Labels ---

Expand Down Expand Up @@ -139,7 +154,7 @@ forge_create_issue() {

# Requires ORIGINATING_RESOURCE (set by forge_parse_originating_url) to
# resolve the correct GitLab notes endpoint (merge_requests vs issues).
forge_post_comment() {
_forge_post_comment() {
: "${ORIGINATING_RESOURCE:?forge_parse_originating_url must be called before forge_post_comment}"
local repo="$1" number="$2" body="$3"
local repo_encoded body_file rc=0
Expand All @@ -151,3 +166,6 @@ forge_post_comment() {
rm -f "${body_file}"
return "${rc}"
}
forge_post_comment() {
_forge_post_comment "$@"
}
45 changes: 31 additions & 14 deletions scripts/lib/jira-auth.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@
[[ -n "${JIRA_AUTH_SH_LOADED:-}" ]] && return 0
JIRA_AUTH_SH_LOADED=1

# Emit a GitHub Actions masking command for a secret. Defined here rather
# than in a caller's library so every bundle that sources Jira auth can mask
# a minted token, whatever the agent. Percent signs, CR and LF are escaped
# because an unescaped line break would end the workflow command.
_jira_auth_gha_mask() {
local value="$1"
value="${value//%/%25}"
value="${value//$'\r'/%0D}"
value="${value//$'\n'/%0A}"
printf '::add-mask::%s\n' "${value}"
}

# Selected mode: "token", "client", or "none". Empty until jira_auth_select.
JIRA_AUTH_MODE=""
_JIRA_AUTH_CLIENT_ID=""
Expand Down Expand Up @@ -190,24 +202,29 @@ _jira_auth_mint_now() {
token="$(printf '%s' "${body}" | jq -r '.access_token // empty' 2>/dev/null)" || token=""
expires_in="$(printf '%s' "${body}" | jq -r '.expires_in // empty' 2>/dev/null)" || expires_in=""
# Atlassian access tokens are JWTs. Anything outside this charset could
# break or inject into the ::add-mask:: line, so it is refused unprinted.
# break or inject into the workflow command, so it is refused unprinted.
if [[ ! "${token}" =~ ^[A-Za-z0-9._~+/=-]+$ ]]; then
echo "ERROR: Jira OAuth token response has no usable access_token" >&2
return 1
fi
# In the script's own shell the mask goes to stdout. In a subshell, such
# as a command substitution, stdout may be captured, so it goes to the
# main shell's current stdout through /proc when that is a pipe or a
# terminal (the runner log), else to stderr. A file or /dev/null there
# means the caller redirected stdout around the call.
local main_out="/proc/$$/fd/1"
if (( BASH_SUBSHELL == 0 )); then
printf '::add-mask::%s\n' "${token}"
elif [[ -w "${main_out}" ]] && [[ -p "${main_out}" || -c "${main_out}" ]] \
&& ! [[ "${main_out}" -ef /dev/null ]]; then
printf '::add-mask::%s\n' "${token}" >> "${main_out}"
else
printf '::add-mask::%s\n' "${token}" >&2
# ::add-mask:: is a GitHub Actions workflow command. On any other runner
# the line is ordinary log output and would print the token, so the mask
# is emitted only when GITHUB_ACTIONS is set.
if [[ -n "${GITHUB_ACTIONS:-}" ]]; then
Comment thread
andrewevansrh marked this conversation as resolved.
Resolved
# In the script's own shell the mask goes to stdout. In a subshell, such
# as a command substitution, stdout may be captured, so it goes to the
# main shell's current stdout through /proc when that is a pipe or a
# terminal (the runner log), else to stderr. A file or /dev/null there
# means the caller redirected stdout around the call.
local main_out="/proc/$$/fd/1"
if (( BASH_SUBSHELL == 0 )); then
_jira_auth_gha_mask "${token}"
elif [[ -w "${main_out}" ]] && [[ -p "${main_out}" || -c "${main_out}" ]] \
&& ! [[ "${main_out}" -ef /dev/null ]]; then
_jira_auth_gha_mask "${token}" >> "${main_out}"
else
_jira_auth_gha_mask "${token}" >&2
fi
fi
[[ "${expires_in}" =~ ^[0-9]+$ ]] || expires_in=3600
_JIRA_AUTH_ACCESS_TOKEN="${token}"
Expand Down
Loading
Loading