feat(claw): derive a blank watch credential from the matching account

A repo watch row carries no account link: its only credentials were the
token stored on the row and the forge's environment variable, so a
watch added without either polled — and replied — anonymously. Against
a private repository that is a 404 on every pass, and nothing ever
lands: no dispatch, no reply, only a per-pass warning in the logs.

The watch credential now resolves in three tiers: the row's token,
then the env var, then the token-kind account identity of the same
forge — instance-scoped on a self-hosted forge (the gitea watch of
git.example borrows the gitea account saved with that base URL). A
password-kind account is skipped, never borrowed. ForgeSource and the
ClawHandler resolve through the same chain and key their client caches
on the resolved value, so the reply authenticates as the identity the
poll did — and a rotation or a later-saved account is a new client on
the next pass, no restart.
This commit is contained in:
vhaudiquet committed 2026-10-19 19:44:39 +02:00
1 parent 7c707e7a09
commit 1cdc2e8648
4 files changed
+226 -23

No files matched your search

+3 -1
View File
@@ -193,7 +193,9 @@ for a UI catching up after a reload) — and the human answers through
The secret travels once, from the answer into the agent accounts; the
tool wakes with the account id, never the secret, and a denial or a
15-minute silence comes back in-band so the turn can say so and move
on. Acting with a stored account is `identity_exec`: it runs one shell
on. A watch with no token of its own polls — and replies — as the
matching saved account: the same forge, and on a self-hosted forge the
same base URL. Acting with a stored account is `identity_exec`: it runs one shell
command in the session workspace with the secret injected —
`ACCOUNT_SECRET` plus the service's own `GITHUB_TOKEN`/`GITEA_TOKEN`/
`GITLAB_TOKEN`, and a git credential helper — so `git clone` and API