fix: use shared formula_lessons_block() to avoid duplicate detection CI failure
Some checks failed
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline failed

This commit is contained in:
Agent 2026-04-01 14:25:43 +00:00
parent fef058081f
commit 1697ab3b3e
6 changed files with 16 additions and 17 deletions

View file

@ -114,10 +114,7 @@ You have full shell access and --dangerously-skip-permissions.
Fix what you can. File vault items for what you cannot. Do NOT ask permission — act first, report after. Fix what you can. File vault items for what you cannot. Do NOT ask permission — act first, report after.
## Project context ## Project context
${CONTEXT_BLOCK}${LESSONS_INJECTION:+## Lessons learned ${CONTEXT_BLOCK}$(formula_lessons_block)
${LESSONS_INJECTION}
}
${SCRATCH_CONTEXT:+${SCRATCH_CONTEXT} ${SCRATCH_CONTEXT:+${SCRATCH_CONTEXT}
} }
## Result file ## Result file

View file

@ -362,6 +362,17 @@ formula_prepare_profile_context() {
LESSONS_INJECTION="${LESSONS_CONTEXT:-}" LESSONS_INJECTION="${LESSONS_CONTEXT:-}"
} }
# formula_lessons_block
# Returns a formatted lessons block for prompt injection.
# Usage: LESSONS_BLOCK=$(formula_lessons_block)
# Expects: LESSONS_INJECTION to be set by formula_prepare_profile_context.
# Returns: formatted block or empty string.
formula_lessons_block() {
if [ -n "${LESSONS_INJECTION:-}" ]; then
printf '\n## Lessons learned (from .profile/knowledge/lessons-learned.md)\n%s' "$LESSONS_INJECTION"
fi
}
# profile_write_journal ISSUE_NUM ISSUE_TITLE OUTCOME [FILES_CHANGED] # profile_write_journal ISSUE_NUM ISSUE_TITLE OUTCOME [FILES_CHANGED]
# Post-session: writes a reflection journal entry after work completes. # Post-session: writes a reflection journal entry after work completes.
# Returns 0 on success, 1 on failure. # Returns 0 on success, 1 on failure.

View file

@ -95,10 +95,7 @@ build_sdk_prompt_footer "
PROMPT="You are the strategic planner for ${FORGE_REPO}. Work through the formula below. PROMPT="You are the strategic planner for ${FORGE_REPO}. Work through the formula below.
## Project context ## Project context
${CONTEXT_BLOCK}${MEMORY_BLOCK}${LESSONS_INJECTION:+## Lessons learned ${CONTEXT_BLOCK}${MEMORY_BLOCK}$(formula_lessons_block)
${LESSONS_INJECTION}
}
${GRAPH_SECTION} ${GRAPH_SECTION}
${SCRATCH_CONTEXT:+${SCRATCH_CONTEXT} ${SCRATCH_CONTEXT:+${SCRATCH_CONTEXT}
} }

View file

@ -91,10 +91,7 @@ Use WebSearch for external signal scanning — be targeted (project dependencies
and tools only, not general news). Limit to 3 web searches per run. and tools only, not general news). Limit to 3 web searches per run.
## Project context ## Project context
${CONTEXT_BLOCK}${LESSONS_INJECTION:+## Lessons learned ${CONTEXT_BLOCK}$(formula_lessons_block)
${LESSONS_INJECTION}
}
${GRAPH_SECTION} ${GRAPH_SECTION}
${SCRATCH_CONTEXT:+${SCRATCH_CONTEXT} ${SCRATCH_CONTEXT:+${SCRATCH_CONTEXT}
} }

View file

@ -208,7 +208,7 @@ FORMULA=$(cat "${FACTORY_ROOT}/formulas/review-pr.toml")
"$PR_BODY" "$FILES" "$DNOTE" "$DIFF" "$PR_BODY" "$FILES" "$DNOTE" "$DIFF"
[ -n "$PREV_CONTEXT" ] && printf '%s\n' "$PREV_CONTEXT" [ -n "$PREV_CONTEXT" ] && printf '%s\n' "$PREV_CONTEXT"
[ -n "$GRAPH_SECTION" ] && printf '%s\n' "$GRAPH_SECTION" [ -n "$GRAPH_SECTION" ] && printf '%s\n' "$GRAPH_SECTION"
[ -n "$LESSONS_INJECTION" ] && printf '\n## Lessons learned\n%s\n\n' "$LESSONS_INJECTION" formula_lessons_block
printf '\n## Formula\n%s\n\n## Environment\nREVIEW_OUTPUT_FILE=%s\nFORGE_API=%s\nPR_NUMBER=%s\nFACTORY_ROOT=%s\n' \ printf '\n## Formula\n%s\n\n## Environment\nREVIEW_OUTPUT_FILE=%s\nFORGE_API=%s\nPR_NUMBER=%s\nFACTORY_ROOT=%s\n' \
"$FORMULA" "$OUTPUT_FILE" "$API" "$PR_NUMBER" "$FACTORY_ROOT" "$FORMULA" "$OUTPUT_FILE" "$API" "$PR_NUMBER" "$FACTORY_ROOT"
printf 'NEVER echo the actual token — always reference ${FORGE_TOKEN} or ${FORGE_REVIEW_TOKEN}.\n' printf 'NEVER echo the actual token — always reference ${FORGE_TOKEN} or ${FORGE_REVIEW_TOKEN}.\n'

View file

@ -100,10 +100,7 @@ Fix what you can. File vault items for what you cannot. Do NOT ask permission
${PREFLIGHT_OUTPUT} ${PREFLIGHT_OUTPUT}
## Project context ## Project context
${CONTEXT_BLOCK}${LESSONS_INJECTION:+## Lessons learned ${CONTEXT_BLOCK}$(formula_lessons_block)
${LESSONS_INJECTION}
}
${SCRATCH_CONTEXT:+${SCRATCH_CONTEXT} ${SCRATCH_CONTEXT:+${SCRATCH_CONTEXT}
} }
Priority order: P0 memory > P1 disk > P2 stopped > P3 degraded > P4 housekeeping Priority order: P0 memory > P1 disk > P2 stopped > P3 degraded > P4 housekeeping