Survive the console this will actually be run from
The report prints an arrow between the old and new word counts, and it prints the memories themselves, which are model-written prose. A Windows console defaults to cp1252 and cannot encode either, so the run dies on UnicodeEncodeError partway through — after some memories have been rewritten and committed, which is the worst place to stop. STATUS already carries the same warning for tools/dbmeter.py. stdout is reconfigured to UTF-8 with errors="replace" instead, so the report degrades a character at a time rather than failing. The usage notes were also written for a POSIX shell, and this project is developed in PowerShell, where `VAR=x command` is not a thing. Both docs now give the PowerShell form first, via Read-Host so the Neon URL and the secret stay out of the history file, and name the venv's Python. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tqgupw5CZGjSZrUTNUd4fW
This commit is contained in:
+6
-2
@@ -145,10 +145,14 @@ people's stories and each adventure is summarized with its owner's key, so `--em
|
||||
a shell on Render — the image copies `backend/app` alone, so `tools/` is not on the box:
|
||||
|
||||
```
|
||||
AIDND_DATABASE_URL=<Neon URL, direct endpoint> AIDND_SECRET_KEY=<the web service's value> \
|
||||
python -m tools.rewrite_memories --email you@example.com
|
||||
$env:AIDND_DATABASE_URL = Read-Host 'Neon URL' # direct endpoint, not -pooler
|
||||
$env:AIDND_SECRET_KEY = Read-Host 'Secret key' # the web service's value
|
||||
.venv/Scripts/python.exe -m tools.rewrite_memories --email you@example.com
|
||||
```
|
||||
|
||||
`Read-Host` keeps both out of the PowerShell history file. Use the venv's Python: the
|
||||
system one on this machine is 3.10 and has none of the dependencies.
|
||||
|
||||
`AIDND_SECRET_KEY` is not optional there: stored API keys are encrypted with it, and
|
||||
with the wrong one `decrypt_secret` returns "" and every adventure is reported as having
|
||||
no key — a run that looks fine and does nothing. Hand-written memories, and memories whose actions have been deleted, are left
|
||||
|
||||
Reference in New Issue
Block a user