- Most recent work: implemented the env-derived Deepgram key persistence fix and verified it with tests and typecheck.
- User prompts:
- "impliment it"
- Changes made:
- Removed the
session_startcode path inextensions/voice.tsthat copiedprocess.env.DEEPGRAM_API_KEYinto config and saved it to global settings. - Added
getSessionStartPersistedConfig()inextensions/voice/config.tsso startup-triggered saves keep stored keys but strip env-only keys. - Added regression tests in
tests/config.test.tsfor env-only vs stored-key startup persistence. - Bumped package version to
5.0.5and added a changelog entry.
- Removed the
- Verification performed:
bun test tests/config.test.tspassedbun test tests/onboarding.test.tspassedpnpm typecheckpassedbun testpassed: 79 tests, 0 failures
- Most recent work: wrote and reviewed an ExecPlan for fixing the env-derived Deepgram key persistence bug.
- User prompts:
- "but the env can be added directly when using pi and so it saves it in env.secrets - how would be a better implimentation?"
- "build a implimentation plan and cross review it"
- Artifacts:
- Plan saved to
docs/superpowers/plans/2026-03-26-deepgram-env-runtime-only.md
- Plan saved to
- Review conclusion:
- Preferred implementation is the smallest fix: remove the
session_startenv-to-config mutation inextensions/voice.ts. - A helper should stay optional and only be added if needed for testing or clarity.
- Explicit onboarding saves to
~/.env.secrets/~/.zshrcshould remain.
- Preferred implementation is the smallest fix: remove the
- Most recent work: verified the reported
DEEPGRAM_API_KEYpersistence bug inpi-listenwithout changing runtime code. - User prompts:
- "Summary ... Suggested fix ... - is it true?"
- Verification performed:
- Read
extensions/voice.tsstartup flow and confirmed env-derivedDEEPGRAM_API_KEYis copied into config, then saved to global settings whenconfigSource === "global"at lines 1807-1810. - Read the onboarding auto-activation path and confirmed first-run/default
startup also persists config through
saveConfig(...)at line 1828 when a Deepgram key is present via env. - Read
extensions/voice/config.tsand confirmed serialization only stripsdeepgramApiKeyfor project scope; global saves keep the key. - Read
extensions/voice/deepgram.tsand confirmed runtime resolution already prefersprocess.env.DEEPGRAM_API_KEYbefore stored config. - Read changelog and tests confirming 5.0.1 fixed only project-scope leakage, not global-scope persistence.
- Read
- Conclusion:
- The report is true in substance.
- The env-derived Deepgram key is still persisted into
~/.pi/agent/settings.json. - The likely-cause note is slightly incomplete because there are two write
paths: direct global save on
session_startfor global config sources, and onboarding migration save on first-run/default startup.
- Most recent work: full bug audit of the
pi-voicecodebase with code evidence, test evidence, and official documentation checks, followed by fixes for the confirmed runtime issues. - User prompts:
- "I want you to audit entire code for bugs and possible errors"
- "I want you to audit entire code for bugs and possible errors verify with evidence and official documentations"
- Verification performed:
bun test --run tests/sherpa-engine.test.tspassed after adding the regression for odd-offset PCM buffersbun test --runpassed: 77 tests, 0 failuresbun run typecheckfailed in this environment because Bun reported its postinstall script was not run; this looked like a local toolchain issue, not a repo type error proven from source- Local repros run for:
- Node WebSocket upgrade request headers
- TypedArray misalignment crash (
Int16Arraywith oddbyteOffset)
- Main fixes applied:
- Deepgram stop now waits for socket close or a short finalize timeout after
CloseStream - Deepgram streaming errors now go through a single close-and-report path
pcmToFloat32()now handles oddBuffer.byteOffsetvalues safelypackage.jsonversion bumped to5.0.4CHANGELOG.mdupdated with the patch release entry
- Deepgram stop now waits for socket close or a short finalize timeout after
- Useful references gathered:
- Deepgram finalize docs
- Deepgram CloseStream docs
- WHATWG WebSocket spec on
errorthenclose - Node Buffer docs
- TypedArray docs for byte-offset alignment