Skip to content

Fix initialize forgeapp streaming - #3

Closed
joseluisll wants to merge 22 commits into
mainfrom
fix-initialize-forgeapp-streaming
Closed

joseluisll wants to merge 22 commits into
mainfrom
fix-initialize-forgeapp-streaming

Conversation

@joseluisll

Copy link
Copy Markdown
Owner

No description provided.

Repository owner deleted a comment from openhands-ai Bot Feb 15, 2026
@joseluisll

Copy link
Copy Markdown
Owner Author

@OpenHands please fix the errors reported by the failing check.

@joseluisll joseluisll closed this Feb 15, 2026
@joseluisll joseluisll reopened this Feb 15, 2026
@openhands-ai

openhands-ai Bot commented Feb 15, 2026

Copy link
Copy Markdown

I'm on it! joseluisll can track my progress at all-hands.dev

Capture streaming_service in a local variable before defining closures
to satisfy mypy's type narrowing for StreamingService | None.

Co-authored-by: openhands <openhands@all-hands.dev>
@openhands-ai

openhands-ai Bot commented Feb 15, 2026

Copy link
Copy Markdown

Summary

I fixed the failing CI check for PR #3 "Fix initialize forgeapp streaming". The issue was a mypy type error in skyvern/forge/forge_app.py:

skyvern/forge/forge_app.py:271: error: Item "None" of "StreamingService | None" has no attribute "start_monitoring"  [union-attr]
skyvern/forge/forge_app.py:275: error: Item "None" of "StreamingService | None" has no attribute "stop_monitoring"  [union-attr]

Root Cause

The STREAMING_SERVICE attribute is typed as StreamingService | None. Even though the code checked if app.STREAMING_SERVICE: before defining the inner closure functions, mypy couldn't infer that app.STREAMING_SERVICE would still be non-None when the closures are eventually called.

Fix

Captured the streaming service in a local variable before defining the closures, allowing mypy to properly narrow the type:

if app.STREAMING_SERVICE:
    # Capture the streaming service in a local variable for the closures
    streaming_service = app.STREAMING_SERVICE

    async def _startup_event(fastapi_app: FastAPI) -> None:
        streaming_service.start_monitoring()  # Now uses local variable

    async def _shutdown_event() -> None:
        await streaming_service.stop_monitoring()  # Now uses local variable

Verification

  • ✅ mypy check passes locally
  • ✅ Changes are minimal and focused on fixing the type error
  • ✅ Pushed to the fix-initialize-forgeapp-streaming branch

The fix has been pushed and should trigger a new CI run that passes the pre-commit hooks.

View full conversation

@joseluisll joseluisll closed this Aug 31, 2026
@joseluisll
joseluisll deleted the fix-initialize-forgeapp-streaming branch October 1, 2026 23:08
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.

2 participants