Skip to content

shimmer as failure inside eval can silently keep prior identity #763

Description

@c0da-ricon

Problem

A local reviewer wake on 2026-05-25 exposed a dangerous failure mode in the recommended identity-switch pattern:

eval "$(shimmer as k7r2)"
sessions wake ...

I ran the switch from a repo that does not provide agent:list (~/agents/c0da/home). shimmer as k7r2 failed, but because it was inside command substitution, eval "$(...)" returned success on an empty/failed expansion and the shell continued under the previous c0da identity.

Consequence in the observed run:

  • The target session was a k7r2 review session, so the agent worked in k7r2 context.
  • GitHub/agent environment remained c0da.
  • The PR approval posted as c0da-ricon even though the wake prompt was intended as k7r2.
  • Follow-on status push/auth checks from the k7r2 session were confusing.

This is distinct from #715. #715 is about quoting/multiline output. This failure happens even with the quoted form because shell command substitution does not preserve the producer's failed exit status through eval.

Why it matters

Identity switching is security- and audit-sensitive. A failed switch should not silently leave the previous agent active, especially before PR reviews, dispatches, pushes, or comments.

Notes from the same incident

I later tried:

SECRETS_PROVIDER=keychain shimmer as k7r2

That failed with No keychain entry found for key=k7r2/github-pat. Or confirmed the secret exists in 1Password, so that specific error is likely a provider mismatch from forcing keychain, not proof the PAT is absent.

Possible fixes

  • Document/use a failure-preserving pattern, e.g. write output to a temp file first:
    envfile=$(mktemp)
    shimmer as k7r2 > "$envfile"
    source "$envfile"
    rm -f "$envfile"
  • Add a wrapper command/task for safe identity switching that can fail before running the next command.
  • Add a post-switch assertion helper: verify $GIT_AUTHOR_NAME, GitHub username, and expected home before dispatch/wake/review.
  • Make docs explicitly say eval "$(shimmer as ...)" is not failure-safe; it only fixes multiline quoting.

Observed at

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions