Skip to content

fix(automation): recheck agent ownership before prompting - #352

Merged
wzz6423 merged 1 commit into
mainfrom
fix/agent-prompt-scope
Dec 5, 2026
Merged

wzz6423 merged 1 commit into
mainfrom
fix/agent-prompt-scope

Conversation

@wzz6423

@wzz6423 wzz6423 commented Dec 5, 2026

Copy link
Copy Markdown
Owner

Summary

Revalidate the caller, target project, pane, session and agent identity after preparing a review snapshot and before sending an agent prompt. A pane moved to another project or replaced during that suspension now rejects the prompt instead of receiving stale input; successful responses describe current ownership.

GitHub Project

  • Project: zshell Development
  • Start date: 2026-12-04
  • Target date: 2026-12-05

PR Type

  • Type: fix

Validation

  • Status: passed

  • Command: python3 -B mac/tests/test_agent_prompt_scope.py

  • Result: 67 scenarios passed. The same tests against b291210 produce 194 failed assertions, including cross-project input. Coverage includes caller and target moves, closed or replaced sessions, reused UUIDs, aliases, agent identity and state changes, and successful prompts.

  • Status: passed

  • Command: make run DERIVED_DATA=<temporary-build>; ZSHELL_TEST_DERIVED_DATA=<temporary-build> python3 -B mac/tests/test_automation_events.py

  • Result: Full macOS Debug build and launch passed. Both Alacritty and Ghostty passed real PTY, authenticated socket and CLI checks. The new production regression moves a pane during review preparation, verifies rejection without writing input, then restores ownership and verifies exactly one accepted prompt.

  • Status: passed

  • Command: make format; xcrun swift-format lint --strict --configuration .swift-format mac/tests/AutomationEventTests.swift mac/tests/AgentPromptScopeTests.swift mac/zshell/ZshellAutomationRouter.swift; git diff --check; bash .github/scripts/check-repository-hygiene.sh

  • Result: Formatting, whitespace and repository hygiene checks passed. Independent review found no remaining blocking issue.

  • Status: not run

  • Reason: CI is not awaited for this maintainer-authorized change.

Risk and Rollback

  • Risk: A guarded prompt is rejected if ownership or agent identity changes during preparation. Checks and terminal input execute together on the main actor after the suspension. Existing project-bound automation semantics are preserved.
  • Rollback: Revert this pull request.

Related Issue

None

AI Attribution

Co-authored-by: Codex <noreply@openai.com>
@coderabbitai

coderabbitai Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@wzz6423
wzz6423 marked this pull request as ready for review December 5, 2026 03:24
@wzz6423
wzz6423 merged commit e9d190d into main Dec 5, 2026
26 checks passed
@wzz6423
wzz6423 deleted the fix/agent-prompt-scope branch December 5, 2026 03:24
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