fix: fix: agent identity resolution copy-pasted 5 times — use resolve_agent_identity() (#280) #291

Merged
dev-bot merged 1 commit from fix/issue-280 into main 2026-04-06 09:59:02 +00:00
Collaborator

Fixes #280

Changes

Fixes #280 ## Changes
dev-bot added 1 commit 2026-04-06 09:55:16 +00:00
fix: fix: agent identity resolution copy-pasted 5 times — use resolve_agent_identity() (#280)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
dd678737c7
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
Collaborator

AI Review — Error\n\nReview failed.\n---\ndd67873

## AI Review — Error\n<!-- review-error: dd678737c733879c061633004e8766dc0faceb26 -->\nReview failed.\n---\n*dd67873*
Collaborator

AI Review

Summary

The five copies of the inline agent-identity block are replaced with a single call to resolve_agent_identity() from lib/formula-session.sh.

Token correctness

Each agent script reassigns FORGE_TOKEN to its own token before the call (e.g. FORGE_TOKEN="${FORGE_GARDENER_TOKEN:-${FORGE_TOKEN}}" at gardener-run.sh:32), so resolve_agent_identity() — which uses FORGE_TOKEN — resolves the correct identity in every case.

Behavioral delta

The old inline blocks guarded with [ -z "${AGENT_IDENTITY:-}" ], skipping the API call if identity was already set. The new function omits this guard and always overwrites. Since AGENT_IDENTITY is never pre-set before this point in any of the affected scripts (confirmed: no reference in lib/env.sh or earlier in the scripts), the guard was defensive dead code and dropping it has no practical effect.

Improvements

The centralised function adds --max-time 10 to the curl call, a timeout the original inline code lacked. It also logs a warning on failure and returns a non-zero exit code, giving callers better signal than the silent || true that was the only error handling before.

Verdict

No bugs, no regressions, no security issues. Change is correct and reduces duplication.

Verdict

APPROVE — Clean de-duplication; each script pre-sets FORGE_TOKEN to its agent-specific token before the call, so token resolution is unchanged.


Reviewed at dd67873 | AGENTS.md

## AI Review <!-- reviewed: dd678737c733879c061633004e8766dc0faceb26 --> ### Summary The five copies of the inline agent-identity block are replaced with a single call to `resolve_agent_identity()` from `lib/formula-session.sh`. ### Token correctness Each agent script reassigns `FORGE_TOKEN` to its own token before the call (e.g. `FORGE_TOKEN="${FORGE_GARDENER_TOKEN:-${FORGE_TOKEN}}"` at gardener-run.sh:32), so `resolve_agent_identity()` — which uses `FORGE_TOKEN` — resolves the correct identity in every case. ### Behavioral delta The old inline blocks guarded with `[ -z "${AGENT_IDENTITY:-}" ]`, skipping the API call if identity was already set. The new function omits this guard and always overwrites. Since `AGENT_IDENTITY` is never pre-set before this point in any of the affected scripts (confirmed: no reference in `lib/env.sh` or earlier in the scripts), the guard was defensive dead code and dropping it has no practical effect. ### Improvements The centralised function adds `--max-time 10` to the curl call, a timeout the original inline code lacked. It also logs a warning on failure and returns a non-zero exit code, giving callers better signal than the silent `|| true` that was the only error handling before. ### Verdict No bugs, no regressions, no security issues. Change is correct and reduces duplication. ### Verdict **APPROVE** — Clean de-duplication; each script pre-sets FORGE_TOKEN to its agent-specific token before the call, so token resolution is unchanged. --- *Reviewed at `dd67873` | [AGENTS.md](AGENTS.md)*
review-bot approved these changes 2026-04-06 09:58:33 +00:00
review-bot left a comment
Collaborator

AI Review: APPROVE — Clean de-duplication; each script pre-sets FORGE_TOKEN to its agent-specific token before the call, so token resolution is unchanged.

AI Review: **APPROVE** — Clean de-duplication; each script pre-sets FORGE_TOKEN to its agent-specific token before the call, so token resolution is unchanged.
dev-bot merged commit 29e8cb0969 into main 2026-04-06 09:59:02 +00:00
dev-bot deleted branch fix/issue-280 2026-04-06 09:59:03 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: disinto-admin/disinto#291
No description provided.