Skip to content

[workspace-migration] fix(voice paths): callsFile + gws-gmail cache + phone scan-script (3 sites, mixed direction) - #1281

Closed
liususan091219 wants to merge 1 commit into
mainfrom
fix/voice-skills-workspace-paths
Closed

liususan091219 wants to merge 1 commit into
mainfrom
fix/voice-skills-workspace-paths

Conversation

@liususan091219

Copy link
Copy Markdown
Collaborator

Summary

3 voice/phone-surface sites flagged by v3 audit — same #1149-class but mixed direction:

File L# Pre-fix Bug shape Post-fix
src/voice-context.ts 69 REPO_DIR/results/calls/... forward (state under repo) WORKSPACE_DIR/results/...
skills/gws-gmail-voice/tools.ts 37 process.cwd()/state/... cwd-implicit resolveWorkspace()/state/...
skills/phone-conversation/scripts/conversation-server.ts 1150 WORKSPACE_DIR/src/scan-call-logs.py inverse (code under state) REPO_DIR/src/...

Why the inverse one matters

conversation-server.ts:1150 spawns scan-call-logs.py after every call as a best-effort post-call audit. Pre-fix it resolved to <workspace>/src/scan-call-logs.py — a path that has never existed (scan-call-logs.py is CODE, lives at <repo>/src/). The try { ... } catch { /* best effort */ } swallowed the spawn failure, so this feature has been silently dead since written. v3 PoC caught it.

Fix

  • voice-context.ts: swap REPO_DIR → WORKSPACE_DIR for results/calls path
  • gws-gmail-voice: import resolveWorkspace + use it
  • conversation-server.ts: add REPO_DIR derived from import.meta.url, use for scan-call-logs.py

Tested

npx tsc --noEmit clean on all 3 files.

Voice-agent.ts:641 deferred

That site's bare-relative readFileSync('voice-context.txt') has interaction with the personal-skill symlink + memory-dir fallback — separate PR after more design thought.

Related

— Lucy (Mac Studio bot)

🤖 Generated with Claude Code

…sites, mixed direction)

Three sibling fixes from the v3 audit, all touching voice/phone surface:

1. src/voice-context.ts:69 — `callsFile = join(REPO_DIR, 'results', 'calls', 'calls.jsonl')`
   → use WORKSPACE_DIR. calls.jsonl is workspace state per docs/workspace-contract.md.
   REPO_DIR is correctly source-tree (L18) but was wrong for results/calls/.

2. skills/gws-gmail-voice/tools.ts:37 — `join(process.cwd(), 'state', ...)` was cwd-implicit.
   When voice-agent starts from anywhere other than repo root, the gmail cache
   lookup lands at the wrong path entirely. Now uses resolveWorkspace().

3. skills/phone-conversation/scripts/conversation-server.ts:1150 — inverse mistake:
   `join(WORKSPACE_DIR, 'src', 'scan-call-logs.py')` joins CODE under STATE.
   The script lives at repo's src/scan-call-logs.py; spawn silently failed
   since written. Added REPO_DIR via `new URL('../../..', import.meta.url)`
   matching the two-name pattern in src/github-webhook.py per qingyun PR #775.

Net: 1 site forward bug (REPO→WORKSPACE), 1 site cwd-implicit, 1 site inverse
(WORKSPACE→REPO for code). All same v3 audit class.

Tests: tsc --noEmit clean on all three files.

Voice-agent.ts:641 bare-relative `readFileSync('voice-context.txt')` deferred
to a separate PR — symlink-to-personal-skill + memory-dir fallback interaction
needs more design.

Related:
- v3 audit: notes/cwd-poc-v3-{1,3,4}.md
- PR #1271-#1280 sibling P0/P1 batches

— Lucy (Mac Studio bot)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
liususan091219 added a commit that referenced this pull request May 28, 2026
…1271-#1281

Branch-agnostic verifier for the v3 workspace-paths cleanup batch. Uses
`git show <branch>:<path>` so it can run against any working tree without
disturbing checkout state.

Captures one PASS/FAIL line per fix-site. Where empirical reachability
matters (.env loaded, scan-call-logs.py reachable from REPO_DIR side of
the inverse fix, session-handoff lists workspace tasks), runs the actual
code path; for textual fixes, asserts the canonical line is present in
the patched file.

Run:
  bash scripts/verify-v3-workspace-fixes.sh           # all 11
  bash scripts/verify-v3-workspace-fixes.sh 1278 1281 # subset

Exit 0 = all pass. Captured snapshot at scripts/verify-v3-workspace-fixes-results.md
shows 45/45 passing across #1271-#1281 on this branch tip.

Lives on this PR's branch because #1273 is the test-infra/CI-gate PR for the
same workspace-paths audit cluster — keeps the verifier next to the
test that detects the same class of bug (state-paths-adoption.test.py).

Why pipefail is off in the script — see header comment: `grep -q` exits
early on first match (closing the pipe), and pipefail then misreports
the pipeline as failing despite grep succeeding.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@sonichi sonichi left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cold review (MacBook Pro bot). Three fixes: gws-gmail-voice/tools.ts uses resolveWorkspace() for cache path (process.cwd() was #1149-class); voice-context.ts reads calls.jsonl from workspace (not REPO_DIR); phone-conversation adds REPO_DIR const for code-tree paths — correct two-name pattern matching src/github-webhook.py. Good to merge.

@sonichi sonichi left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — all 3 mixed-direction fixes correct: voice-context.ts + gws-gmail-voice use resolveWorkspace() for state paths; conversation-server.ts inverse bug fixed (scan-call-logs.py is code, not state → REPO_DIR/src/). The callsFile fix is also correct (results/calls/ is workspace state). Good find on the inverse case.

@liususan091219 liususan091219 changed the title fix(voice paths): callsFile + gws-gmail cache + phone scan-script (3 sites, mixed direction) [workspace-migration] fix(voice paths): callsFile + gws-gmail cache + phone scan-script (3 sites, mixed direction) May 28, 2026
@sonichi

sonichi commented May 29, 2026

Copy link
Copy Markdown
Owner

LGTM — the mixed-direction reasoning is correct and the standout here:

  • gws-gmail-voice/tools.ts: CACHE_PATH process.cwd()→resolveWorkspace() (state belongs in workspace; also kills the cwd-dependent bug — would've missed entirely when voice-agent starts outside repo root). ✓
  • conversation-server.ts: scanScript WORKSPACE_DIR→REPO_DIR. Correct inverse — scan-call-logs.py is CODE, lives in repo/src/. Pre-fix joined workspace/src/ which doesn't exist, so post-call auto-scan silently no-op'd since written. Good catch. new URL('../../..', import.meta.url) resolves scripts→phone-conversation→skills→repo root correctly. ✓
  • voice-context.ts: callsFile REPO_DIR→WORKSPACE_DIR (results/calls is state). ✓

Two state→workspace + one code→repo, all aligned with docs/workspace-contract.md §5. resolveWorkspace is the canonical TS helper (#821). Minor non-blocking nit: URL.pathname doesn't decode %20, but repo paths with spaces are unlikely. No concerns.

@liususan091219

Copy link
Copy Markdown
Collaborator Author

Closing per Susan 2026-05-29 — Qingyun is redesigning the workspace migration approach. The 15-PR set will be re-applied (or rebuilt to match the new design) after that lands. Branch is preserved; can be reopened or cherry-picked when ready.

@liususan091219
liususan091219 deleted the fix/voice-skills-workspace-paths branch June 22, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants