Skip to content

fix(daemon): un-pinned @mention wakes respect the agent's pinned cwd - #485

Open
ChenNima wants to merge 1 commit into
developfrom
fix/mention-wake-respect-pinned-cwd
Open

fix(daemon): un-pinned @mention wakes respect the agent's pinned cwd#485
ChenNima wants to merge 1 commit into
developfrom
fix/mention-wake-respect-pinned-cwd

Conversation

@ChenNima

Copy link
Copy Markdown
Contributor

Summary

Brings the un-pinned mentioned wake onto the same residual cwd-resolution ladder as task_assigned so an @mention of an agent lands where that idea's conversation already lives, or on the target agent's owner-pinned project cwd — instead of a random online cwd. This also fixes agent→agent return-wakes (agent B @mentions the assigner A on completion), which ride the same path.

Idea e40f2b2c (Chorus 0.16.1), proposal 972f919f. Research + fix, driven via the AI-DLC pipeline.

Audit finding (corrected the proposal's premise)

An un-pinned @mention was not raw online-first: mention.service already pre-resolves, at notification-creation time, the direct-idea instance pin and the mentioner-owner's project-fixed cwd (threaded as HARD pins). The genuine residual gaps were the idea session-origin upgrade for mentioned and a target-agent-owner project-pin fallback. The fix is therefore purely additive — it fires only when selection would otherwise be online_first.

Implementation

Adds RESIDUAL_CWD_UPGRADE_TRIGGERS (= IDEA_SESSION_ORIGIN_UPGRADE_TRIGGERS ∪ {"mentioned"}) and switches the step-4 (idea session-origin upgrade) and step-4a (agent-owner project-pin fallback) gates to it. human_instruction / resource_resumed remain excluded; explicit-pin mentions still short-circuit as HARD pins. No schema, migration, permission bit, endpoint, or new transport.

Changed files

File Change
src/services/notification-turn.ts RESIDUAL_CWD_UPGRADE_TRIGGERS + both upgrade gates use it
src/services/__tests__/notification-turn.test.ts 5 new mention tests + 1 updated (flipped-invariant) test
openspec/changes/mention-wake-respect-pinned-cwd/** OpenSpec change (proposal, design incl. audit correction, 2 spec deltas)

Test plan

  • pnpm test wake-service suites (notification-turn/listener/service): 202 passed
  • npx tsc --noEmit: clean
  • proposal / T1 / T2 / idea code-review gateways: all PASS (no blockers)
  • Live Codex e2e (task 3) — pending, runs after this is deployed: separate daemon serving Claude+Codex, pin Codex, verify assignee/@mention/return-wake land on the pinned cwd

Note: full-suite cli/__tests__/daemon-*.test.mjs failures are pre-existing (reproduce on base with this change stashed); this change touches 0 cli/ files. The OpenSpec change is intentionally left un-archived until task 3 is verified.

🤖 Generated with Claude Code

Bring the un-pinned `mentioned` wake onto the same residual cwd-resolution
ladder as `task_assigned`: add RESIDUAL_CWD_UPGRADE_TRIGGERS (the autonomous
idea-anchored family plus `mentioned`) and gate the step-4 idea-session-origin
upgrade and step-4a agent-owner project-pin fallback on it. The additions fire
only on the residual online_first case — mention.service already pre-resolves
explicit / direct-idea-instance / mentioner-owner pins at creation time — so an
un-pinned @mention (incl. an agent->agent return-@mention) lands where that
idea's conversation lives or on the target agent's owner-pinned cwd instead of a
random online cwd. human_instruction / resource_resumed stay excluded;
explicit-pin mentions still short-circuit as HARD pins.

Idea e40f2b2c (Chorus 0.16.1). Confined to notification-turn.ts; no schema,
migration, permission, endpoint, or new transport. 202 wake-service tests green,
tsc clean. Live Codex e2e (task 3) handed to human (needs merge+deploy).

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

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 96.94% (🎯 95%) 4320 / 4456
🟢 Statements 95.84% (🎯 95%) 4770 / 4977
🟢 Functions 97.37% (🎯 93%) 853 / 876
🟢 Branches 88.58% (🎯 85%) 3314 / 3741
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/services/notification-turn.ts 97.54% 94.55% 100% 98.16% 502-506, 522
Generated in workflow #1181 for commit 84c7aa0 by the Vitest Coverage Report Action

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.

1 participant