When
Debugging a CLI call that works interactively but fails in an Agent subprocess, a collaborator's skill set, or a request that sees the wrong resources.
Three identities
| Identity | Typical carrier | Use |
|---|---|---|
| Interactive user | Logto access token (cohub auth login) | Humans in CLI/UI |
| Execution grant | COHUB_EXECUTION_TOKEN | Agent/tool/run_command work inside a turn |
| Work/App runtime | Work session or preview cookie | Published App or workspace preview |
The API resolves principals in rough order: execution grant -> preview session -> Work/App session -> Logto user.
Rules of thumb
- In Agent tool shells, use the injected execution token; do not assume
~/.config/cohub/auth.jsonexists in the Sandbox. COHUB_EXECUTION_TOKENin a laptop shell overrides stored Logto auth until it is unset.- An execution token is not an OIDC session and cannot be refreshed with
cohub auth refresh. - Execution grants remain bound to their Space and optional session/turn.
- Since v2.29, scoped execution permissions are additive with the actor's own account access. They do not replace it; filtering and direct checks use the same union.
- User-config skills enter the system prompt only when
actorUserId === spaceOwnerUserId. Project, Mod, and platform skills still apply to collaborators. - Token values are redacted from tool output; do not diagnose a missing token by copying secrets into logs.
Playbook
- Identify the auth source: ``
bash cohub auth whoami env | rg "COHUB_EXECUTION_TOKEN|COHUB_USER_UUID|COHUB_SPACE_ID"`` - For human CLI operations, unset the execution token and use the interactive session: ``
bash unset COHUB_EXECUTION_TOKEN cohub auth login`` - For Agent automation, use platform-injected turn credentials and keep them out of files.
- If visibility differs, compare the target Space, session/turn binding, and the additive permission union before changing application code.
- If collaborators lack personal skills, check ownership; this is an intentional system-prompt boundary.
Done when
- [ ] The failing request's principal and target Space are known
- [ ] No local execution token is shadowing intended Logto auth
- [ ] Account access and execution scopes are interpreted as a union
- [ ] Owner/member skill expectations match the actor identity
Avoid
- Committing execution tokens
- Assuming the Sandbox has a laptop login session
- Treating an execution grant as a general-purpose user token
- Expecting members to receive the owner's
/configs/userskills