Skip to content

Copilot needs trust#738

Draft
Soph wants to merge 2 commits intomainfrom
soph/copilot-e2e
Draft

Copilot needs trust#738
Soph wants to merge 2 commits intomainfrom
soph/copilot-e2e

Conversation

@Soph
Copy link
Collaborator

@Soph Soph commented Mar 19, 2026

Turns out v1.0.8 of copilot changed:

Repo-level hooks are loaded only after folder trust is confirmed

For interactive E2E tests we handled this but for -p direct prompt execution hooks did not fire anymore.

And it also adds scaling to E2E checkpoint polling timeouts by each agent's TimeoutMultiplier, and bump Copilot CLI from 1.5x to 2.5x (15s → 37.5s)


Note

Medium Risk
Touches E2E harness behavior and mutates user-level Copilot config (~/.copilot/config.json), which could affect developer/CI environments and change test timing characteristics.

Overview
Fixes Copilot CLI non-interactive (-p) E2E runs by pre-adding the repo directory to Copilot’s trusted_folders in ~/.copilot/config.json so repo-level hooks load reliably on v1.0.8+.

Increases copilot-cli’s TimeoutMultiplier and updates E2E tests to use a new RepoState.CheckpointTimeout() helper, so checkpoint polling/idle waits scale per agent instead of using a hardcoded 15s.

Written by Cursor Bugbot for commit 8dd64d4. Configure here.

The hardcoded 15s checkpoint polling timeout was too short for slower
agents like Copilot CLI. Add RepoState.CheckpointTimeout() that scales
the base 15s by each agent's TimeoutMultiplier, and bump Copilot CLI
from 1.5x to 2.5x.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: e6d21f633a5a
@Soph Soph requested a review from a team as a code owner March 19, 2026 20:44
Copilot AI review requested due to automatic review settings March 19, 2026 20:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the E2E harness to accommodate Copilot CLI v1.0.8+ requiring folder trust before repo-level hooks load (notably in -p non-interactive mode), and makes checkpoint polling timeouts scale with each agent’s speed.

Changes:

  • Add RepoState.CheckpointTimeout() and update E2E tests to use it instead of a hard-coded 15s.
  • Increase the Copilot CLI agent timeout multiplier and pre-seed Copilot’s trusted folder config before -p prompts.
  • Replace several checkpoint wait calls across E2E tests to use the new scaled timeout helper.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
e2e/testutil/repo.go Adds CheckpointTimeout() helper to scale polling timeouts by agent multiplier.
e2e/agents/copilot-cli.go Ensures Copilot folder trust for -p mode, increases multiplier, and adds config-writing helper.
e2e/tests/subagent_commit_flow_test.go Uses s.CheckpointTimeout() for checkpoint polling.
e2e/tests/stash_workflows_test.go Uses s.CheckpointTimeout() for checkpoint polling/advance waits.
e2e/tests/split_commits_test.go Uses s.CheckpointTimeout() for checkpoint polling/advance waits.
e2e/tests/single_session_test.go Uses s.CheckpointTimeout() for checkpoint polling.
e2e/tests/session_lifecycle_test.go Uses s.CheckpointTimeout() for checkpoint polling/advance waits.
e2e/tests/rewind_test.go Uses s.CheckpointTimeout() for checkpoint polling/advance waits.
e2e/tests/resume_test.go Uses s.CheckpointTimeout() for checkpoint polling/advance waits.
e2e/tests/resume_remote_test.go Uses s.CheckpointTimeout() for checkpoint polling.
e2e/tests/multi_session_test.go Uses s.CheckpointTimeout() for checkpoint polling.
e2e/tests/mid_turn_commit_test.go Uses s.CheckpointTimeout() for checkpoint polling.
e2e/tests/interactive_test.go Uses s.CheckpointTimeout() for checkpoint polling.
e2e/tests/external_agent_test.go Uses s.CheckpointTimeout() for checkpoint polling.
e2e/tests/existing_files_test.go Uses s.CheckpointTimeout() for checkpoint polling and session-idle wait.
e2e/tests/edge_cases_test.go Uses s.CheckpointTimeout() for checkpoint polling and manual deadline loop.
e2e/tests/deleted_files_test.go Uses s.CheckpointTimeout() for checkpoint polling.
e2e/tests/checkpoint_metadata_test.go Uses s.CheckpointTimeout() for checkpoint polling.
e2e/tests/attribution_test.go Uses s.CheckpointTimeout() for checkpoint polling/advance waits.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Race condition on shared config file in concurrent tests
    • Added a sync.Mutex (copilotTrustMu) to serialize the read-modify-write cycle in ensureCopilotTrust, preventing concurrent goroutines from overwriting each other's trusted_folders entries.

Create PR

Or push these changes by commenting:

@cursor push e3a5d8c319
Preview (e3a5d8c319)
diff --git a/e2e/agents/copilot-cli.go b/e2e/agents/copilot-cli.go
--- a/e2e/agents/copilot-cli.go
+++ b/e2e/agents/copilot-cli.go
@@ -9,6 +9,7 @@
 	"os/exec"
 	"path/filepath"
 	"strings"
+	"sync"
 	"syscall"
 	"time"
 )
@@ -186,10 +187,15 @@
 	return s, nil
 }
 
+var copilotTrustMu sync.Mutex
+
 // ensureCopilotTrust adds dir to ~/.copilot/config.json trusted_folders if not
 // already present. Copilot CLI v1.0.8+ requires folder trust before loading
 // repo-level hooks; without this, hooks silently don't fire in -p mode.
 func ensureCopilotTrust(dir string) error {
+	copilotTrustMu.Lock()
+	defer copilotTrustMu.Unlock()
+
 	absDir, err := filepath.Abs(dir)
 	if err != nil {
 		return err

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Copilot CLI v1.0.8 changed hook loading to require folder trust
confirmation before loading repo-level hooks. In non-interactive (-p)
mode there is no trust dialog, so hooks silently never fire. Pre-add
the test repo directory to ~/.copilot/config.json trusted_folders
before invoking copilot -p.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 44debfa7ba4f
@Soph Soph force-pushed the soph/copilot-e2e branch from 8dd64d4 to 684282d Compare March 19, 2026 20:57
@Soph
Copy link
Collaborator Author

Soph commented Mar 19, 2026

It's not working, back to draft.

@Soph Soph marked this pull request as draft March 19, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants