fix: a failed prompt leaves no workspace verdict, and the workspace telemetry review's follow-ups
Issue for this PR
Closes #1698
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
- A failed prompt leaves no workspace verdict. A failed attachment cleared the turn's workspace while others still ran, and a ranged file still in its symbol lookup could resolve it again for the next prompt-less loop (summarize, resume). Now every attachment settles first.
- An onboarding first-job mark uses the credential of the tool's own turn. The trigger site notes the turn's credential by call id for that call's plugins, and the hook claims under it, so a tenant switch mid-turn or a late return can't drop the other tenant's row. The plugin hook input is unchanged.
- Tests: the first-events loop test runs with the workspace feature on, and the telemetry event list has
first_prompt_sentandfirst_job_completed. - One comment no longer names a branch.
- The workspace kill switch stops a saved link's first events. With
ALTIMATE_DISABLE_WORKSPACEset, a project linked before the switch was set sends nofirst_prompt_sentorfirst_job_completedfor that workspace, and an onboarding session's own rows name no workspace. Nothing is marked, so the workspace's first rows are sent once the switch is off. Other rows still name the link, as before; the docs say so.
How did you verify your code works?
Each fix's new test fails without it: a missing directory with a slower ranged file, a late return after a tenant switch, a switch mid-turn in a real loop, and the kill switch in a linked turn, an onboarding turn and the onboarding hook. With the feature on, the first-events loop file passes 15/15 and the pinned and turn-boundary files 15/15; each logs one unhandled "All fibers interrupted" error, as on main. test/altimate/telemetry, workspace and plugin pass (1,622 tests). Typecheck and Marker Guard pass.
Cost side effects
None. A failed prompt waits for its other attachments before it reports the error.
Screenshots / recordings
Not a UI change.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
- I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"
š¤ Generated with Claude Code
https://claude.ai/code/session_01VEmKQswEEpkYFmMEngESx8
Summary by cubic
Fixes a bug where a failed prompt could leave a stale workspace verdict for the next loop to take, and makes the first-job mark use the credential of the turn that ran the tool.
Bug Fixes
- Now every attachment settles before a failure is rethrown; a new test in
pinned-workspace-loop.test.tscovers the race. - The first-job mark now claims under the turn's credential, noted per call id, so a tenant switch mid-turn or a late return doesn't drop the other tenant's row.
Follow-ups from the workspace telemetry review
- With
ALTIMATE_DISABLE_WORKSPACEset, no first event names the saved link: a project linked before the switch was set sends nofirst_prompt_sentorfirst_job_completed, onboarding rows name no workspace, and nothing is marked, so the workspace's first rows are sent once the switch is off. All other rows still name the link. - The first-events loop test runs with the workspace feature on and clears any pin from the runner's environment.
- The telemetry event-type list adds both first-event types.
Summary by CodeRabbit
-
Bug Fixes
- Workspace attribution for onboarding completion events now follows the workspace resolved for the tool call, avoiding incorrect attribution when a project link differs from the active workspace.
- Disabling workspace features now suppresses workspace first-event telemetry and removes workspace attribution from onboarding-session rows. Other turn telemetry continues to include the cached project link.
- Prompt processing now waits for all parts to finish before reporting a failure, helping prevent incomplete workspace binding after an error.
-
Tests
- Expanded coverage for workspace attribution, telemetry suppression, and prompt failure scenarios.