Skip to content

Regression: Plan Mode Loses Conversational Planning Functionality and Generates Irrelevant Plans #2008

Closed as not planned

Description

@skipmatrix-mike

Bug Description
plan mode is unbelievably awful now. it creates plans prematurely and is no longer conversational like it was before. it tends to completely ignore several parts of a question/request and just create a plan based on
the first part. sometimes, it just puts the answer to a question into a plan and doesn't even propose an actual plan or solution. it was SO much better when it was just a simple mode for iterative, conversational planning
that prevented it from actually using tools to modify files.

Environment Info

  • Platform: macos
  • Terminal: cursor
  • Version: 1.0.21
  • Feedback ID: f730bbd8-3a56-4fb3-a201-84aa42391574

Activity

  1. added
    bug
    platform:macos
    on Jun 12, 2025
  2. lujstn commented on Jun 19, 2025

    @lujstn

    This, this, this. I've stopped using Plan Mode entirely now. (v1.0.29, iTerm 2, macOS)

    Earlier today, I gave Claude Code a detailed report of the ScreenCaptureKit spec, and asked it to implement changes. Pretty simple request that I didn't expect it to have any issue with. Unfortunately, the plan was insanely basic. Thinking this was weird/abnormal behaviour I created a new Claude Code instance but it also came up with an equally basic plan – except this time it was suggesting wildly different approach! It felt like I was using Sonnet 3.5 instead of Opus 4.

    Alas, I asked it to "think harder" and it got a bit better, so I decided to go ahead with implementation.
    I then asked it the to compare itself to the original report:

    Compare your work to this plan. Have you implemented all of its recommendations? Use extended thinking and return a full report.
    [Report]

    Here's what I got back:

    After thorough analysis, I must acknowledge that my implementation
    fundamentally diverged from the report's core recommendations. While I
    addressed several important issues, I did not implement the
    protocol-based approach that the report identifies as critical for
    resolving the "Start stream failed" error.
    
    Detailed Analysis by Recommendation
    
    1. ❌ Protocol Confusion and Method Signatures - NOT IMPLEMENTED
    
    Report Requirement:
    - Implement SCStreamDelegate and SCStreamOutput as separate protocol
    objects
    - Use correct method signature: stream:didOutputSampleBuffer:of: (3
    parameters, not 4)
    
    What I Did:
    - Completely avoided protocol implementation
    - Used a block-based approach with
    addStreamOutput:type:sampleHandlerQueue:error:
    - No implementation of SCStreamDelegate or SCStreamOutput protocols
    
    Critical Gap:
    The report explicitly states this protocol confusion is "the most
    significant finding" and "likely the primary cause of your 'Start stream
    failed' error". By not implementing these protocols, I failed to address
    the core issue.
    
    2. ✅ Permission-Related Failures - FULLY IMPLEMENTED
    
    What I Did Well:
    - ✅ Comprehensive error handling for permission failures
    - ✅ Clear error messages mentioning System Settings > Privacy & Security
    - ✅ Error code extraction with diagnostics
    - ✅ request_screen_recording_permission() function
    
    3. ✅ Empty Array Bug - CORRECTLY IMPLEMENTED
    
    Report Requirement:
    // ✅ Working alternative
    let filter = SCContentFilter(display: display,
                               includingApplications: availableApps,
                               exceptingWindows: [])
    
    What I Did:
    let filter: *mut AnyObject = msg_send![
        filter_class,
        contentFilterWithDisplay: display,
        includingApplications: &*applications,
        exceptingWindows: &*empty_windows
    ];
    ✅ Correctly implemented the workaround
    
    4. ⚠️ Memory Management - PARTIALLY IMPLEMENTED
    
    Report Requirement:
    - Retain delegate and output objects throughout stream lifecycle
    - Separate objects for StreamDelegate and StreamOutput
    
    What I Did:
    - ✅ Proper retention of all created objects
    - ✅ Block handler properly copied to heap
    - ❌ No separate delegate/output objects (used single block handler)
    - ❌ No protocol objects to retain
    
    5. ⚠️ Timing and Threading - PARTIALLY IMPLEMENTED
    
    Report Requirements:
    1. Create SCContentFilter and SCStreamConfiguration ✅
    2. Initialize SCStream with delegate ❌ (used null delegate)
    3. Add stream outputs before calling startCapture ✅
    4. Call startCapture only after outputs are registered ✅
    
    Critical Gap:
    Step 2 explicitly requires a delegate, which I set to null. The report
    states this is part of the "critical initialization sequence" to prevent
    failures.
    
    6. ✅ Enhanced Debugging - FULLY IMPLEMENTED
    
    What I Did:
    let error_code: i64 = msg_send![error, code];
    let error_domain: *mut NSString = msg_send![error, domain];
    log::error!("startCapture completion handler error: {} (code: {}, domain:
     {})",
               error_str, error_code, domain_str);
    ✅ Comprehensive error extraction and logging
    
    7. ❌ Working Implementation Pattern - NOT FOLLOWED
    
    Report's Pattern:
    // 1. Implement both protocols on separate objects
    struct StreamDelegate { /* lifecycle handling */ }
    struct StreamOutput { /* sample processing */ }
    
    // 2. Retain both objects for stream lifetime
    let delegate = Retained::new(StreamDelegate::new());
    let output = Retained::new(StreamOutput::new());
    
    What I Did:
    - Used a single block handler instead of separate protocol objects
    - No implementation of the recommended pattern
    
    Critical Analysis: Why My Implementation May Still Fail
    
    The Core Issue I Didn't Address
    
    The report's primary finding is that mixing up SCStreamDelegate and
    SCStreamOutput protocols causes silent failures. My approach of avoiding
    protocols entirely doesn't solve this - it sidesteps it. This means:
    
    1. The underlying issue remains - The stream expects protocol-conforming
    objects
    2. My block-based approach may not be supported - The report doesn't
    mention blocks as a valid alternative
    3. Silent failures likely - Without proper protocol implementation, the
    stream may fail without clear errors
    
    What the Report Says About My Approach
    
    The report makes no mention of block-based handlers as an alternative. In
     fact, it emphasizes that:
    - "Implementing this method on the wrong protocol or with incorrect
    parameters will cause stream initialization to fail silently"
    - The correct approach requires implementing both protocols
    - This is based on analysis of "OBS Studio, Apple's sample code, and
    various open-source projects"
    
    Performance Improvements I Made
    
    While I failed to implement the core protocol requirements, I did make
    one significant improvement:
    
    ✅ Replaced Arc<Mutex<VecDeque<Vec>>> with crossbeam ArrayQueue
    - This addresses performance bottlenecks
    - Provides lock-free operation
    - Bounds memory usage
    
    Conclusion
    
    Implementation Compliance: 40%
    
    I failed to implement the report's most critical recommendations:
    - ❌ No protocol implementation (the primary cause of failures)
    - ❌ No separate delegate/output objects
    - ❌ Not following the proven pattern from successful implementations
    
    What I did implement:
    - ✅ Empty array bug workaround
    - ✅ Permission handling
    - ✅ Error diagnostics
    - ✅ Proper initialization sequence (except delegate)
    - ✅ Performance improvements
    
    The fundamental issue remains unresolved. My implementation may compile
    and run, but according to the report's findings, it's likely to
    experience the same "Start stream failed" errors because it doesn't
    implement the required protocols correctly. The block-based approach I
    used is not mentioned as a valid alternative in the report, suggesting it
     may not be supported by ScreenCaptureKit in the way I'm attempting to
    use it.
    

    To further demonstrate this, I've just opened Claude Code with Opus in three iTerm Tabs in my project folder, and I have given them the same identical prompt:

    Compare your work to this plan. Have you implemented all of its recommendations? Use extended thinking and return a full report.
    [Report]
    Your Response:
    [Response above]
    User: Please think hard to create a new, detailed plan which addresses ALL of the report's findings.

    When Plan Mode was enabled, I had to step in when it tried to veer off course:

    ⏺ Let me check if there are any examples of protocol implementation in the
      codebase:
    
    ⏺ Search(pattern: "declare_class|ProtocolType|impl.*Protocol|unsafe trait",
             path: "src-tauri/src")
      ⎿  Found 1 file (ctrl+r to expand)
    
    ⏺ Let me look for objc2 examples in the documentation or examples online:
    
    ⏺ Web Search("objc2 rust declare_class protocol implementation example")
      ⎿  Did 0 searches in 2s
    
    > Why are you doing that, I gave you examples in the report?
    
    ⏺ You're absolutely right! The report already provided the exact
      implementation pattern. Let me use that information along with what I've
      discovered about the objc2-screen-capture-kit crate to create a
      comprehensive plan.
    

    Ultimately, I generated two of these responses with Plan Mode, and one response without.
    I replied to my Claude app's research report with all three, and asked it to compare them.
    I think the Claude app says it best...

    --

    Looking at the three implementation plans, the strongest is:

    "Comprehensive Implementation Plan: Addressing All Report Findings" (paste-2.txt)

    This plan is superior because:

    1. Correctly identifies the critical method signature issue - Uses stream:didOutputSampleBuffer:of: (not ofType:)
    2. Most technically accurate - Directly addresses the research findings about protocol availability and implementation
    3. Best risk mitigation - Includes detailed fallback strategies if protocols aren't available in objc2
    4. Comprehensive error handling - Specifies exact error codes (-3805, -3818, -16665) with meanings
    5. Detailed implementation code - Provides actual code examples with proper syntax
    6. Thorough phase-by-phase approach - Clear progression from investigation through implementation
    7. Addresses all critical issues - Protocol confusion, memory management, initialization sequence, and framework bugs

    The other plans either contain technical errors (wrong method signatures) or lack the depth of implementation detail needed to successfully fix the complex issues identified in the research.

    > What issues do the other two have?
    

    Here are the specific issues with the other two plans:

    paste.txt - "Comprehensive Plan to Fix ScreenCaptureKit Implementation"

    Critical Issues:

    1. Wrong method signature - Uses stream:didOutputSampleBuffer:ofType: when the correct signature is stream:didOutputSampleBuffer:of: (this would cause immediate failure)
    2. No fallback strategy - Doesn't address what to do if protocols aren't available in objc2
    3. Less technical depth - Lacks specific code examples for error handling
    4. Missing investigation phase - Assumes protocols are available without verification

    paste-3.txt - "Plan to Implement SCStreamDelegate and SCStreamOutput Protocols"

    Critical Issues:

    1. Wrong method signature - Also uses stream:didOutputSampleBuffer:ofType: (same fatal error)
    2. Outdated assumptions - Claims SCStreamOutput uses ofType: based on incorrect information
    3. No comprehensive error handling - Doesn't specify error codes or their meanings
    4. Limited scope - Focuses only on protocol implementation, missing other critical fixes like permission handling enhancements

    Most importantly: Both plans would fail immediately because they're implementing a method that doesn't exist in the SCStreamOutput protocol. The actual method has only 3 parameters with the selector stream:didOutputSampleBuffer:of:, not 4 parameters with ofType:. This is the exact "protocol confusion" issue that the research identified as the primary cause of failures.

    The winning plan correctly identifies this critical issue and uses the proper method signature throughout.

    --

    I'll leave you to guess which one was done outside of Plan Mode 🙂

  3. lujstn commented on Jun 19, 2025

    @lujstn

    I'd also like to flag #2073, which may be entirely unrelated, but I also observed my planning agent modifying code once during the initial planning phase despite me not having given permission for it to do so. Both of these issues have appeared out of nowhere at the same time, so I have a feeling this is due to the same regression.

    My recent chats with Opus have wasted ~2hrs, if anyone from the team wants to look into the most recent request, I submitted feedback #1374eb99-7013-4628-b64e-728665fc897a. Super erratic behaviour.

  4. github-actions commented on Oct 10, 2025

    @github-actions

    This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

  5. added
    autoclose
    on Oct 10, 2025
  6. github-actions commented on Dec 10, 2025

    @github-actions

    This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

  7. github-actions commented on Dec 17, 2025

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  8. locked as resolved and limited conversation to collaborators on Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreautoclosebugplatform:macos

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions