fix: feat(20g): migrate all remaining agents to .profile + remove ops repo journal dirs (#90)
This commit is contained in:
parent
efe57a02c9
commit
fef058081f
8 changed files with 128 additions and 27 deletions
|
|
@ -27,6 +27,8 @@ source "$(dirname "$0")/../lib/env.sh"
|
|||
source "$(dirname "$0")/../lib/ci-helpers.sh"
|
||||
source "$(dirname "$0")/../lib/worktree.sh"
|
||||
source "$(dirname "$0")/../lib/agent-sdk.sh"
|
||||
# shellcheck source=../lib/formula-session.sh
|
||||
source "$(dirname "$0")/../lib/formula-session.sh"
|
||||
|
||||
# Auto-pull factory code to pick up merged fixes before any logic runs
|
||||
git -C "$FACTORY_ROOT" pull --ff-only origin main 2>/dev/null || true
|
||||
|
|
@ -56,6 +58,14 @@ if [ -f "$LOGFILE" ] && [ "$(stat -c%s "$LOGFILE" 2>/dev/null || echo 0)" -gt 10
|
|||
mv "$LOGFILE" "$LOGFILE.old"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# RESOLVE AGENT IDENTITY FOR .PROFILE REPO
|
||||
# =============================================================================
|
||||
if [ -z "${AGENT_IDENTITY:-}" ] && [ -n "${FORGE_TOKEN:-}" ]; then
|
||||
AGENT_IDENTITY=$(curl -sf -H "Authorization: token ${FORGE_TOKEN}" \
|
||||
"${FORGE_URL:-http://localhost:3000}/api/v1/user" 2>/dev/null | jq -r '.login // empty' 2>/dev/null || true)
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# MEMORY GUARD
|
||||
# =============================================================================
|
||||
|
|
@ -180,6 +190,11 @@ else
|
|||
log "WARN: build-graph.py failed — continuing without structural analysis"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# LOAD LESSONS FROM .PROFILE REPO (PRE-SESSION)
|
||||
# =============================================================================
|
||||
formula_prepare_profile_context
|
||||
|
||||
# =============================================================================
|
||||
# BUILD PROMPT
|
||||
# =============================================================================
|
||||
|
|
@ -193,6 +208,7 @@ FORMULA=$(cat "${FACTORY_ROOT}/formulas/review-pr.toml")
|
|||
"$PR_BODY" "$FILES" "$DNOTE" "$DIFF"
|
||||
[ -n "$PREV_CONTEXT" ] && printf '%s\n' "$PREV_CONTEXT"
|
||||
[ -n "$GRAPH_SECTION" ] && printf '%s\n' "$GRAPH_SECTION"
|
||||
[ -n "$LESSONS_INJECTION" ] && printf '\n## Lessons learned\n%s\n\n' "$LESSONS_INJECTION"
|
||||
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"
|
||||
printf 'NEVER echo the actual token — always reference ${FORGE_TOKEN} or ${FORGE_REVIEW_TOKEN}.\n'
|
||||
|
|
@ -298,4 +314,7 @@ case "$VERDICT" in
|
|||
;;
|
||||
esac
|
||||
|
||||
# Write journal entry post-session
|
||||
profile_write_journal "review-${PR_NUMBER}" "Review PR #${PR_NUMBER} (${VERDICT})" "${VERDICT,,}" "" || true
|
||||
|
||||
log "DONE: ${VERDICT} (re-review: ${IS_RE_REVIEW})"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue