Submit Workflow
Automates the post-implementation submission pipeline: quality enforcement, commit, PR creation, changelog, and push.
Parameters
- jira_key (optional): JIRA issue key (e.g.,
BA-1234). Auto-detected from branch name if pattern BA-\d+ exists.
- changelog_type (optional): One of
breaking, feature, enhance, deprecation, fix, doc, deps, misc, test. If omitted, infer from the most significant change.
- changelog_message (optional): One-line English summary for the news fragment. If omitted, generate from PR description.
- base_branch (optional): Target branch for PR. Defaults to
main.
Workflow
Phase 1: Pre-flight
Detect JIRA key
- Check if user provided
jira_key
- Otherwise extract from current branch name (pattern:
BA-\d+)
- If not found, ask user
Review changes
git status to see all changed/untracked files
git diff and git diff --staged to review content
git log {base_branch}..HEAD to see existing commits on branch
- Summarize changes to user before proceeding
Phase 2: Quality Enforcement (Local)
MANDATORY - never skip.
Run sequentially, stop on first failure:
pants fmt ::
pants fix ::
pants lint --changed-since=origin/{base_branch}
- If
fmt or fix produce changes, stage them automatically
- If
lint fails, fix the issues and re-run
- After all pass, continue to next phase
Note: Type checking (pants check) and tests (pants test) are enforced by CI only. Do NOT run them locally — they consume excessive resources when multiple workers run concurrently.
Phase 3: Commit
Stage changes
git add specific files (avoid -A to prevent accidental inclusion of secrets)
- Never stage
.env, credentials, or other sensitive files
Generate commit message
- Use conventional commit style:
type(BA-XXXX): description
- Types:
fix, feat, refactor, test, doc, ci, chore, perf
- When a JIRA key is available, ALWAYS use it as the conventional commit scope. Never use component names like
manager, client, client-sdk as the scope.
- Example:
fix(BA-1234): resolve session cleanup race condition
- Keep first line under 80 characters
- Add detailed body if multiple significant changes
Create commit
- Present draft message to user for approval
- Commit with approved message
Phase 4: PR Creation
Push branch
git push -u origin {branch_name}
Generate PR content
- Title: Conventional commit style with JIRA key as scope
- Format:
type(BA-XXXX): description
- Example:
fix(BA-1234): resolve session cleanup race condition
- See
changes/KNOWLEDGE.md for the category-to-prefix/changelog-type mapping, including same-release fixes (chore, not fix)
- Body: Use this template:
## Summary
<1-3 bullet points describing what changed and why>
## Test plan
- [ ] <test items>
Resolves BA-XXXX
Decide backport targets (before creating the PR — the trailer lives in the PR body)
Backporting is automatic. There is no milestone to set; the target release branches are
decided from the PR title prefix, the PR body and the labels.
The title prefix picks the default; a Backport: line in the PR body replaces it.
| Situation |
What to do |
fix: PR going to every maintained version |
Nothing |
| Any PR going to particular versions |
Add Backport: 26.8, 26.4 to the PR body — comma- or space-separated |
fix: PR that must NOT be backported |
Add Backport: none to the PR body |
Non-fix: PR that stays on main |
Nothing |
| A target realized only after the merge |
Comment /backport <version> on the merged PR |
- Valid versions are exactly the entries of
.github/maintained-versions.yml — read that file
rather than guessing. A trailer naming anything else fails the backport job and backports
nothing, so get it right or leave the trailer out.
- Writing a
Backport: trailer is a release decision: ask the user before adding one.
Create PR
gh pr create --title "..." --body "..."
Extract PR number from gh pr create output
Phase 5: Changelog (News Fragment)
Determine changelog type (if not provided) — see changes/KNOWLEDGE.md for valid types and the category mapping
Generate changelog message (if not provided)
- Single-line English sentence
- Imperative/commanding form: "Fix XXX", "Add YYY", "Support ZZZ"
- Or complete sentence: "Now it does ZZZ"
- Focus on what the change means to users/developers, not implementation details
Create file
- Path:
changes/{pr_number}.{changelog_type}.md
- Content: single-line changelog message
- Show draft to user for approval
Commit and push
git add changes/{pr_number}.{changelog_type}.md
git commit -m "changelog: add news fragment for PR #{pr_number}"
git push
Phase 6: Summary
Report final status:
Submission Complete
PR: #{pr_number} - {title}
URL: https://github.com/lablup/backend.ai/pull/{pr_number}
JIRA: BA-XXXX
Branch: {branch_name}
Changelog: changes/{pr_number}.{changelog_type}.md
Quality checks: All passed
Commits: {count} commit(s)
Error Handling
Quality check failure
Quality check failed at: {step}
Error:
{error_output}
Options:
1. Fix issues and re-run /submit
2. Address specific failures manually
No changes to commit
No changes detected.
Working tree is clean. Nothing to submit.
PR creation failure
PR creation failed: {error}
Possible causes:
- Branch not pushed (will auto-push)
- PR already exists for this branch
- Authentication issue with gh CLI
Check: gh auth status
Branch has no JIRA key
No JIRA issue key found.
Options:
1. Provide JIRA key: /submit BA-1234
2. Continue without JIRA key (not recommended)
Examples
Basic usage (auto-detect everything)
User: /submit
Agent: [Detects BA-1234 from branch, runs quality checks, commits, creates PR, generates changelog]
With explicit JIRA key
User: /submit BA-5678
Agent: [Uses BA-5678, runs full workflow]
With all parameters
User: /submit BA-5678 --type=fix --message="Fix session cleanup race condition when agent disconnects"
Agent: [Uses provided parameters, runs full workflow]
Related Skills
/test-guide - Scenario-first testing (run before /submit)
Implementation Notes
- Local quality checks (
fmt, fix, lint) use --changed-since=origin/{base_branch} to cover all PR changes, not just the last commit
- Type checking and tests run in CI only — do not run them locally
- Changelog follows towncrier format configured in
pyproject.toml
- PR number is only available after
gh pr create, so changelog is always a second commit
- A single PR may have multiple news fragments (e.g., both
feature and fix)
- News fragment content should be a single-line sentence per
changes/README.md guidelines
1---2name: submit3description: Complete submission workflow - quality checks, commit, PR creation, changelog generation, and final push. Use after finishing implementation work.4---56# Submit Workflow78Automates the post-implementation submission pipeline: quality enforcement, commit, PR creation, changelog, and push.910## Parameters1112- **jira_key** (optional): JIRA issue key (e.g., `BA-1234`). Auto-detected from branch name if pattern `BA-\d+` exists.13- **changelog_type** (optional): One of `breaking`, `feature`, `enhance`, `deprecation`, `fix`, `doc`, `deps`, `misc`, `test`. If omitted, infer from the most significant change.14- **changelog_message** (optional): One-line English summary for the news fragment. If omitted, generate from PR description.15- **base_branch** (optional): Target branch for PR. Defaults to `main`.1617## Workflow1819### Phase 1: Pre-flight20211. **Detect JIRA key**22 - Check if user provided `jira_key`23 - Otherwise extract from current branch name (pattern: `BA-\d+`)24 - If not found, ask user25262. **Review changes**27 - `git status` to see all changed/untracked files28 - `git diff` and `git diff --staged` to review content29 - `git log {base_branch}..HEAD` to see existing commits on branch30 - Summarize changes to user before proceeding3132### Phase 2: Quality Enforcement (Local)3334**MANDATORY - never skip.**3536Run sequentially, stop on first failure:3738```bash39pants fmt ::40pants fix ::41pants lint --changed-since=origin/{base_branch}42```4344- If `fmt` or `fix` produce changes, stage them automatically45- If `lint` fails, fix the issues and re-run46- After all pass, continue to next phase4748**Note:** Type checking (`pants check`) and tests (`pants test`) are enforced by CI only. Do NOT run them locally — they consume excessive resources when multiple workers run concurrently.4950### Phase 3: Commit51521. **Stage changes**53 - `git add` specific files (avoid `-A` to prevent accidental inclusion of secrets)54 - Never stage `.env`, credentials, or other sensitive files55562. **Generate commit message**57 - Use conventional commit style: `type(BA-XXXX): description`58 - Types: `fix`, `feat`, `refactor`, `test`, `doc`, `ci`, `chore`, `perf`59 - **When a JIRA key is available, ALWAYS use it as the conventional commit scope. Never use component names like `manager`, `client`, `client-sdk` as the scope.**60 - Example: `fix(BA-1234): resolve session cleanup race condition`61 - Keep first line under 80 characters62 - Add detailed body if multiple significant changes63643. **Create commit**65 - Present draft message to user for approval66 - Commit with approved message6768### Phase 4: PR Creation69701. **Push branch**71 - `git push -u origin {branch_name}`72732. **Generate PR content**74 - **Title**: Conventional commit style with JIRA key as scope75 - Format: `type(BA-XXXX): description`76 - Example: `fix(BA-1234): resolve session cleanup race condition`77 - See `changes/KNOWLEDGE.md` for the category-to-prefix/changelog-type mapping, including same-release fixes (`chore`, not `fix`)78 - **Body**: Use this template:7980 ```markdown81 ## Summary82 <1-3 bullet points describing what changed and why>8384 ## Test plan85 - [ ] <test items>8687 Resolves BA-XXXX88 ```89903. **Decide backport targets** (before creating the PR — the trailer lives in the PR body)9192 Backporting is automatic. There is no milestone to set; the target release branches are93 decided from the PR title prefix, the PR body and the labels.9495 The title prefix picks the default; a `Backport:` line in the PR body replaces it.9697 | Situation | What to do |98 |---|---|99 | `fix:` PR going to every maintained version | Nothing |100 | Any PR going to particular versions | Add `Backport: 26.8, 26.4` to the PR body — comma- or space-separated |101 | `fix:` PR that must NOT be backported | Add `Backport: none` to the PR body |102 | Non-`fix:` PR that stays on `main` | Nothing |103 | A target realized only after the merge | Comment `/backport <version>` on the merged PR |104105 - Valid versions are exactly the entries of `.github/maintained-versions.yml` — read that file106 rather than guessing. A trailer naming anything else fails the backport job and backports107 nothing, so get it right or leave the trailer out.108 - Writing a `Backport:` trailer is a release decision: ask the user before adding one.1091104. **Create PR**111 ```bash112 gh pr create --title "..." --body "..."113 ```1141155. **Extract PR number** from `gh pr create` output116117### Phase 5: Changelog (News Fragment)1181191. **Determine changelog type** (if not provided) — see `changes/KNOWLEDGE.md` for valid types and the category mapping1201212. **Generate changelog message** (if not provided)122 - Single-line English sentence123 - Imperative/commanding form: "Fix XXX", "Add YYY", "Support ZZZ"124 - Or complete sentence: "Now it does ZZZ"125 - Focus on what the change means to users/developers, not implementation details1261273. **Create file**128 - Path: `changes/{pr_number}.{changelog_type}.md`129 - Content: single-line changelog message130 - Show draft to user for approval1311324. **Commit and push**133 ```bash134 git add changes/{pr_number}.{changelog_type}.md135 git commit -m "changelog: add news fragment for PR #{pr_number}"136 git push137 ```138139### Phase 6: Summary140141Report final status:142143```144Submission Complete145146 PR: #{pr_number} - {title}147 URL: https://github.com/lablup/backend.ai/pull/{pr_number}148 JIRA: BA-XXXX149 Branch: {branch_name}150 Changelog: changes/{pr_number}.{changelog_type}.md151152Quality checks: All passed153Commits: {count} commit(s)154```155156## Error Handling157158### Quality check failure159```160Quality check failed at: {step}161162Error:163{error_output}164165Options:1661. Fix issues and re-run /submit1672. Address specific failures manually168```169170### No changes to commit171```172No changes detected.173174Working tree is clean. Nothing to submit.175```176177### PR creation failure178```179PR creation failed: {error}180181Possible causes:182- Branch not pushed (will auto-push)183- PR already exists for this branch184- Authentication issue with gh CLI185186Check: gh auth status187```188189### Branch has no JIRA key190```191No JIRA issue key found.192193Options:1941. Provide JIRA key: /submit BA-12341952. Continue without JIRA key (not recommended)196```197198## Examples199200### Basic usage (auto-detect everything)201```202User: /submit203Agent: [Detects BA-1234 from branch, runs quality checks, commits, creates PR, generates changelog]204```205206### With explicit JIRA key207```208User: /submit BA-5678209Agent: [Uses BA-5678, runs full workflow]210```211212### With all parameters213```214User: /submit BA-5678 --type=fix --message="Fix session cleanup race condition when agent disconnects"215Agent: [Uses provided parameters, runs full workflow]216```217218## Related Skills219220- `/test-guide` - Scenario-first testing (run before /submit)221222## Implementation Notes223224- Local quality checks (`fmt`, `fix`, `lint`) use `--changed-since=origin/{base_branch}` to cover all PR changes, not just the last commit225- Type checking and tests run in CI only — do not run them locally226- Changelog follows [towncrier](https://github.com/twisted/towncrier) format configured in `pyproject.toml`227- PR number is only available after `gh pr create`, so changelog is always a second commit228- A single PR may have multiple news fragments (e.g., both `feature` and `fix`)229- News fragment content should be a single-line sentence per `changes/README.md` guidelines