Skip to content

fix: --schedule-seed no longer silently overridden by per-file git-remote detection#31101

Merged
pelikhan merged 4 commits intomainfrom
copilot/fix-schedule-seed-overriding
May 9, 2026
Merged

fix: --schedule-seed no longer silently overridden by per-file git-remote detection#31101
pelikhan merged 4 commits intomainfrom
copilot/fix-schedule-seed-overriding

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

Bug Fix

What was the bug?

gh aw compile --schedule-seed owner/repo had no effect. setupRepositoryContext set the slug correctly, but compileWorkflowFile and CompileWorkflowWithValidation both called compiler.SetRepositorySlug(fileRepoSlug) unconditionally for each file, overwriting it with the per-file git-remote-detected value. Fork checkouts always produced scatter values derived from the fork slug instead of the upstream slug.

How did you fix it?

Added a lock to the Compiler so an explicit --schedule-seed cannot be clobbered by per-file detection:

  • pkg/workflow/compiler_types.go — added repositorySlugLocked bool field and three new methods:

    • LockRepositorySlug() — marks the slug as authoritative
    • IsRepositorySlugLocked() bool — introspection
    • SetRepositorySlugIfUnlocked(slug string) — delegates to SetRepositorySlug when unlocked, no-op when locked; used by per-file detection paths
  • pkg/cli/compile_compiler_setup.gosetupRepositoryContext calls LockRepositorySlug() immediately after applying a valid --schedule-seed

  • pkg/cli/compile_workflow_processor.go and pkg/cli/compile_validation.go — changed SetRepositorySlugSetRepositorySlugIfUnlocked in the per-file detection block; logging now distinguishes between a slug being applied vs. ignored due to the lock

Per-file detection continues to work unchanged when --schedule-seed is absent (e.g. compiling a workflow that lives in a different repo than CWD). Only a valid, non-empty seed engages the lock; the invalid-format warning path does not.

// setupRepositoryContext — now locks after honoring --schedule-seed
compiler.SetRepositorySlug(config.ScheduleSeed)
compiler.LockRepositorySlug()  // ← prevents per-file detection from winning

// compileWorkflowFile — per-file detection respects the lock
compiler.SetRepositorySlugIfUnlocked(fileRepoSlug)  // no-op if seed was explicit

Testing

  • pkg/workflow/compiler_repository_slug_test.go — unit tests for the three new Compiler methods covering locked/unlocked transitions
  • pkg/cli/compile_compiler_setup_test.go — tests that setupRepositoryContext locks on a valid seed, does not lock on an invalid/empty seed, and that the locked slug survives a subsequent SetRepositorySlugIfUnlocked call

Copilot AI and others added 2 commits May 8, 2026 23:56
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…ction

- Add repositorySlugLocked bool field to Compiler struct
- Add LockRepositorySlug(), IsRepositorySlugLocked(), SetRepositorySlugIfUnlocked() methods
- setupRepositoryContext calls LockRepositorySlug() after valid --schedule-seed
- compileWorkflowFile uses SetRepositorySlugIfUnlocked() for per-file slug
- CompileWorkflowWithValidation uses SetRepositorySlugIfUnlocked() for per-file slug
- Add tests in pkg/workflow and pkg/cli

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix bug where --schedule-seed is overridden by git-remote detection fix: --schedule-seed no longer silently overridden by per-file git-remote detection May 9, 2026
Copilot AI requested a review from pelikhan May 9, 2026 00:01
@pelikhan pelikhan marked this pull request as ready for review May 9, 2026 00:07
Copilot AI review requested due to automatic review settings May 9, 2026 00:07
Copy link
Copy Markdown
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

Fixes gh aw compile --schedule-seed owner/repo being overridden by per-file git-remote detection by introducing a “locked” repository slug state in the workflow compiler, and updating per-file detection codepaths to respect that lock.

Changes:

  • Added repository slug lock state + helper methods on workflow.Compiler to prevent per-file overrides when --schedule-seed is explicitly provided.
  • Updated CLI compilation/validation flows to use SetRepositorySlugIfUnlocked for per-file git-remote detection.
  • Added unit tests covering locked/unlocked behavior and the setupRepositoryContext integration.
  • Updated a large set of workflow .lock.yml files with additional outputs/env and firewall config fields (not described in the PR text).
Show a summary per file
File Description
pkg/workflow/compiler_types.go Adds repositorySlugLocked state and methods to lock/introspect/conditionally set the repo slug.
pkg/workflow/compiler_repository_slug_test.go Unit tests for the new lock/conditional-set behavior.
pkg/cli/compile_compiler_setup.go Locks the compiler repo slug after applying a valid --schedule-seed.
pkg/cli/compile_workflow_processor.go Switches per-file slug detection to SetRepositorySlugIfUnlocked.
pkg/cli/compile_validation.go Switches per-file slug detection to SetRepositorySlugIfUnlocked.
pkg/cli/compile_compiler_setup_test.go Tests that setupRepositoryContext locks on valid seed and doesn’t lock on invalid/empty.
.github/workflows/video-analyzer.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/test-workflow.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/test-project-url-default.lock.yml Updates workflow outputs/env and threat-detection error handling.
.github/workflows/smoke-opencode.lock.yml Updates workflow outputs/env and threat-detection error handling.
.github/workflows/smoke-gemini.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/smoke-crush.lock.yml Updates workflow outputs/env and threat-detection error handling.
.github/workflows/smoke-ci.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/release.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/poem-bot.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/jsweep.lock.yml Updates workflow outputs/env and threat-detection error handling.
.github/workflows/issue-triage-agent.lock.yml Updates workflow outputs/env and threat-detection error handling.
.github/workflows/hippo-embed.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/gpclean.lock.yml Updates workflow outputs/env and threat-detection error handling.
.github/workflows/firewall.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/example-permissions-warning.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/dev.lock.yml Updates workflow outputs/env and threat-detection error handling.
.github/workflows/daily-malicious-code-scan.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/copilot-token-optimizer.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/codex-github-remote-mcp-test.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/code-simplifier.lock.yml Updates workflow outputs/env and threat-detection error handling.
.github/workflows/changeset.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/brave.lock.yml Updates workflow outputs/env and threat-detection error handling.
.github/workflows/bot-detection.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/ai-moderator.lock.yml Updates workflow outputs/env and firewall JSON config payload.
.github/workflows/ace-editor.lock.yml Updates workflow outputs/env and firewall JSON config payload.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 70/223 changed files
  • Comments generated: 5

Comment on lines 90 to 94
fileRepoSlug := getRepositorySlugFromRemoteForPath(resolvedFile)
if fileRepoSlug != "" {
compiler.SetRepositorySlug(fileRepoSlug)
compiler.SetRepositorySlugIfUnlocked(fileRepoSlug)
compileWorkflowProcessorLog.Printf("Repository slug for file set: %s", fileRepoSlug)
}
Comment on lines +33 to 38
// Uses SetRepositorySlugIfUnlocked so that an explicit --schedule-seed flag is never overridden.
fileRepoSlug := getRepositorySlugFromRemoteForPath(filePath)
if fileRepoSlug != "" {
compiler.SetRepositorySlug(fileRepoSlug)
compiler.SetRepositorySlugIfUnlocked(fileRepoSlug)
compileValidationLog.Printf("Repository slug for file set: %s", fileRepoSlug)
}
Comment on lines +294 to +300
// SetRepositorySlugIfUnlocked sets the repository slug only when it has not been
// locked via LockRepositorySlug. This is the method per-file git-remote detection
// should call so that an explicit --schedule-seed flag is never overridden.
func (c *Compiler) SetRepositorySlugIfUnlocked(slug string) {
if !c.repositorySlugLocked {
c.repositorySlug = slug
}
Comment thread pkg/cli/compile_compiler_setup_test.go Outdated
Comment on lines +37 to +39
// TestSetupRepositoryContext_InvalidScheduleSeedDoesNotLock verifies that an
// invalid --schedule-seed value is silently ignored and the slug is NOT locked,
// allowing per-file git-remote detection to set the slug later.
Comment on lines 345 to 349
agentic_engine_timeout: ${{ steps.detect-copilot-errors.outputs.agentic_engine_timeout || 'false' }}
checkout_pr_success: ${{ steps.checkout-pr.outputs.checkout_pr_success || 'true' }}
effective_tokens: ${{ steps.parse-mcp-gateway.outputs.effective_tokens }}
effective_tokens_rate_limit_error: ${{ steps.parse-mcp-gateway.outputs.effective_tokens_rate_limit_error || 'false' }}
has_patch: ${{ steps.collect_output.outputs.has_patch }}
@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented May 9, 2026

@copilot review all comments

- SetRepositorySlugIfUnlocked now delegates to SetRepositorySlug to
  avoid drift if SetRepositorySlug gains side effects later
- Log correctly reflects when a per-file remote slug is ignored due to
  a locked --schedule-seed vs when it is applied (both processor and
  validation paths)
- Fix test comment: invalid --schedule-seed emits a warning (not silent)
  before falling back to git remote detection
- Revert 217 unrelated .lock.yml changes that were accidentally included
  in the initial plan commit

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 9, 2026

@copilot review all comments

All four review findings addressed in a0cd623 → latest commit:

  1. Misleading log in compile_workflow_processor.go — now logs distinctly when a per-file slug is ignored due to a locked --schedule-seed vs when it is applied.
  2. Misleading log in compile_validation.go — same fix applied.
  3. SetRepositorySlugIfUnlocked direct field assignment — now delegates to SetRepositorySlug(slug) inside the unlocked branch to avoid drift.
  4. Incorrect test comment ("silently ignored") — updated to say the invalid value triggers a warning before falling back to git remote detection.

Also removed 217 unrelated .lock.yml changes that were accidentally included in the initial plan commit.

@pelikhan pelikhan merged commit 30246e9 into main May 9, 2026
@pelikhan pelikhan deleted the copilot/fix-schedule-seed-overriding branch May 9, 2026 00:48
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.

Bug: --schedule-seed is silently overridden by per-file git-remote detection during compile

3 participants