Skip to content

feat: add in-flight guard and attach hook scoping#15

Merged
chriswritescode-dev merged 4 commits into
mainfrom
forge/loop-restart-permissions
May 14, 2026
Merged

feat: add in-flight guard and attach hook scoping#15
chriswritescode-dev merged 4 commits into
mainfrom
forge/loop-restart-permissions

Conversation

@chriswritescode-dev
Copy link
Copy Markdown
Owner

Summary

  • Add in-flight guard to prevent concurrent loop execution, rejecting duplicate prompts when a prior agent session is still running.
  • Scope the attach hook to support loop inline plan and execution attach cleanup, improving cross-project session resolution and preventing stale state propagation.

Changes

New files:

  • src/loop/in-flight-guard.ts — Concurrent prompt detection via a shared Map tracking per-loop in-flight sessions; throws ConcurrentPromptError on conflicts.
  • test/loop/in-flight-guard.test.ts — Unit tests for the guard logic (mark/clear/assert lifecycle).
  • test/loop/runtime.test.ts, test/services/execution-in-flight-guard.test.ts, test/services/execution-attach-cleanup.test.ts — Integration tests exercising the full runtime path.

Modified files:

  • src/hooks/forge-session-attach.ts — Refactored attach-scoping to align with loop inline plan state.
  • src/loop/runtime.ts — Integrated in-flight guard checks before prompt dispatch.
  • src/services/execution.ts — Enhanced execution pipeline to invoke the guard.
  • src/utils/tui-client.ts — Updated TUI client hooks to reflect scoped cleanup signals.
  • Various test files — Updated or added tests covering audit permissions, loop status tool, and warp flow edge cases.

All tests pass locally via vitest.

Checklist

  • Branch is up-to-date with origin/main
  • Tests pass
  • Reviewers assigned (pending)

@chriswritescode-dev chriswritescode-dev merged commit c7de8d7 into main May 14, 2026
1 check passed
@chriswritescode-dev chriswritescode-dev deleted the forge/loop-restart-permissions branch May 14, 2026 21:52
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