.claude/skills/openclaw-stale-session-and-identity-mismatch/SKILL.md
Fix OpenClaw agent repeatedly claiming a Google account "isn't authenticated" or failing with auth errors even though GWS tokens are valid. Use when: (1) GWS CLI works manually (`gws gmail users messages list --account X`) but OpenClaw agent says auth is missing, (2) Agent uses wrong email format (e.g., missing dots in Gmail address), (3) Agent keeps repeating stale beliefs about auth status despite fixes. Covers identity mismatch across config files and stale session cache clearing.
npx skillsauth add Dbochman/dotfiles openclaw-stale-session-and-identity-mismatchInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
OpenClaw agent fails to use Google services (Gmail, Calendar, Drive) for a specific account,
claiming authentication is missing. The actual GWS CLI works fine when tested manually with
the correct --account flag. The root cause is typically a wrong email format in
OpenClaw's identity/config files combined with stale session history that preserves
the agent's incorrect belief.
[email protected] instead of [email protected])gws gmail users messages list --params '{"userId":"me","q":"is:unread","maxResults":1}' --account [email protected]GWS does strict email matching against its encrypted credentials. Gmail treats
[email protected] and [email protected] as the same mailbox, but
GWS stores credentials under the exact email used during OAuth. If any OpenClaw config
file has the wrong version, the agent will pass the wrong email to --account.
The wrong email can propagate across multiple files:
| File | What it affects |
|------|-----------------|
| ~/.openclaw/workspace/USER.md | Agent's identity context for contacts |
| ~/.openclaw/workspace/memory/*.md | Accumulated knowledge from past sessions |
| ~/.openclaw/cron/jobs.json | Scheduled tasks that use the email |
| ~/.openclaw/skills/gws-gmail/SKILL.md | Skill file with account examples |
| ~/.openclaw/skills/gws-calendar/SKILL.md | Skill file with account examples |
OpenClaw sessions are persistent JSONL files. Once the agent encounters an auth error, that failure becomes part of the conversation history. Even after fixing the email, the agent's compacted session context retains the "not authenticated" belief.
ssh dylans-mac-mini 'gws gmail users messages list --params "{\"userId\":\"me\",\"q\":\"is:unread\",\"maxResults\":1}" --account [email protected]'
ssh dylans-mac-mini 'gws auth list'
If this shows empty, test with an actual API call — the JS wrapper may use a stale cached binary.
# Find all files with the wrong email (exclude session .jsonl and .log files)
ssh dylans-mac-mini 'grep -rl "juliajoyjennings" ~/.openclaw/ 2>/dev/null | grep -v ".jsonl" | grep -v ".log"'
# Fix each file
ssh dylans-mac-mini 'sed -i "" "s/[email protected]/[email protected]/g" <files>'
Find the session ID for the affected contact:
ssh dylans-mac-mini "python3 -c '
import json
with open(\"/Users/dbochman/.openclaw/agents/main/sessions/sessions.json\") as f:
data = json.load(f)
for key, val in data.items():
if \"+1XXXXXXXXXX\" in key: # Replace with contact phone number
print(\"Key:\", key)
print(\"SessionId:\", val.get(\"sessionId\"))
print(\"File:\", val.get(\"sessionFile\"))
'"
Delete the session file and remove from sessions.json:
# Delete session file
ssh dylans-mac-mini 'rm ~/.openclaw/agents/main/sessions/<sessionId>.jsonl'
# Remove from sessions.json
ssh dylans-mac-mini "python3 -c '
import json
path = \"/Users/dbochman/.openclaw/agents/main/sessions/sessions.json\"
with open(path) as f:
data = json.load(f)
key = \"agent:main:imessage:dm:+1XXXXXXXXXX\"
if key in data:
del data[key]
with open(path, \"w\") as f:
json.dump(data, f, indent=2)
print(\"Removed\", key)
'"
Have the contact send a new message. The agent will create a fresh session and read the corrected email from the skill files.
exec tool calls with correct emailgws auth login.~/.config/gws/ — per-account files
named credentials.<base64>.enc. The .encryption_key file must also be present..encryption_key + accounts.json to Mini.gws auth logout without --account <email> nukes ALL accounts.development
Search the web for current information, news, facts, and answers. Use when asked questions about current events, needing to look something up, finding websites, researching topics, or when you need up-to-date information beyond your training data.
development
Summarize any URL, YouTube video, podcast, PDF, or file into concise text. Use when asked to read an article, summarize a link, get the gist of a video or podcast, extract content from a URL, or when you need to understand what a web page or document contains.
development
Play music via Spotify and control Google Home speakers. Use when asked to play music, songs, artists, playlists, podcasts, or control speakers/volume/audio.
testing
Create new OpenClaw skills, modify and improve existing skills, and measure skill performance with evals. Use when users want to create a skill from scratch, update or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. Also use when asked to "make a skill", "turn this into a skill", "improve this skill", or "test this skill".