Skip to content

[plan] Filter Chmod events in watch mode to reduce noise #5177

Closed

Description

@github-actions

Objective

Filter out fsnotify.Chmod events in the watch mode event handler to reduce processing noise from file indexing tools, backup software, and other system utilities.

Context

The current implementation in pkg/cli/compile_command.go:866-910 processes all file system events. However, Chmod events (permission/attribute changes) are rarely useful for detecting workflow changes and create unnecessary noise in logs and processing.

Approach

In the event handling switch statement, add filtering to skip Chmod events before other processing:

case event, ok := <-watcher.Events:
    if !ok {
        return fmt.Errorf("watcher channel closed")
    }

    // Filter out Chmod events (noisy and usually not useful)
    if event.Has(fsnotify.Chmod) {
        continue
    }

    // Only process markdown files and ignore lock files
    if !strings.HasSuffix(event.Name, ".md") {
        continue
    }
    // ... rest of event processing

Files to Modify

  • Update: pkg/cli/compile_command.go (lines ~866-910, event handling loop)

Testing

  1. Run gh aw compile --watch in a workflows directory
  2. Trigger Chmod events (e.g., chmod +x workflow.md or file indexing by Spotlight/Windows Search)
  3. Verify that these events don't trigger recompilation or log spam
  4. Verify that actual Write/Create/Remove events still work correctly

Acceptance Criteria

  • Chmod events are filtered out before other event processing
  • Write, Create, and Remove events continue to work as expected
  • Watch mode logs are quieter (no unnecessary event processing)
  • Code follows existing patterns in the event handler

AI generated by Plan Command for discussion #5175

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions