Repository navigation
ci: isolate per-run agent state for triage and PR review #5885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -326,12 +326,20 @@ jobs: | |
| pull-requests: 'write' | ||
| issues: 'write' | ||
| steps: | ||
| # Self-hosted runners reuse the workspace, so an interrupted review can | ||
| # leave a stale `.qwen/tmp/review-pr-*` worktree or `qwen-review/*` branch | ||
| # that trips the checkout below. Prune defensively; never fail the job. | ||
| - name: 'Clean stale review worktrees' | ||
| # Self-hosted runners reuse $HOME, /tmp and the workspace, so a prior run | ||
| # can bleed into this one: its agent session/memory (under QWEN_HOME), | ||
| # leftover draft comments (/tmp/stage-*.md, which survive `git clean`), or | ||
| # a stale `.qwen/tmp/review-pr-*` worktree / `qwen-review/*` branch from an | ||
| # interrupted review. Reset all three per run; never fail the job. | ||
| - name: 'Clean stale agent state' | ||
| run: |- | ||
| set -uo pipefail | ||
| # Fresh per-run agent home (must match QWEN_HOME on the Qwen step | ||
| # below) + drop any leftover stage drafts. | ||
| QWEN_HOME="${RUNNER_TEMP:?}/qwen-home" | ||
| rm -rf "$QWEN_HOME" 2>/dev/null || true | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] If isolation of session and memory is the goal, consider targeted cleanup: rm -rf "$QWEN_HOME/projects" "$QWEN_HOME/sessions" 2>/dev/null || trueThis preserves — qwen3.7-max via Qwen Code /review |
||
| mkdir -p "$QWEN_HOME" | ||
| rm -f /tmp/stage-*.md 2>/dev/null || true | ||
| # `.git` is a directory in a normal checkout but a gitlink file in a | ||
| # worktree; -e covers both, and a missing .git (first run) too. | ||
| if [ ! -e .git ]; then | ||
|
|
@@ -409,6 +417,10 @@ jobs: | |
| PR_NUMBER: '${{ steps.context.outputs.pr_number }}' | ||
| REVIEW_MODE: '${{ steps.context.outputs.review_mode }}' | ||
| TIMEOUT_MINUTES: '${{ steps.context.outputs.timeout_minutes }}' | ||
| # Per-run agent home so this review's session/memory cannot leak into | ||
| # the next on the reused self-hosted workspace (reset in "Clean stale | ||
| # agent state"). Must match the QWEN_HOME computed there. | ||
| QWEN_HOME: '${{ runner.temp }}/qwen-home' | ||
| run: |- | ||
| set -euo pipefail | ||
| fail() { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion] QWEN_HOME path coupling relies only on comments. The cleanup step computes
QWEN_HOME="${RUNNER_TEMP:?}/qwen-home"as a shell variable that evaporates when therun:block exits, while the qwen step uses${{ runner.temp }}/qwen-homeas an independent GitHub Actions expression. The string literalqwen-homeis duplicated in 4 locations across 2 files with only "must match" comments as coupling.Consider using step outputs to make the coupling mechanical:
Then in the Qwen step env:
— qwen3.7-max via Qwen Code /review