GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add timeout for file watcher subscribe to address hangs on Rosetta x86 emulation by matthewijordan · Pull Request #5350 · anomalyco/opencode

Conversation

@matthewijordan

@matthewijordan matthewijordan commented Dec 10, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Summary

  • Fixes file watcher hanging indefinitely on x86 emulation via Rosetta on macOS (InotifyBackend hungs forever when inotify_init1 returns error parcel-bundler/watcher#159)
  • If timeout occurs, automatic detection of git branch switches and external file changes will not work. An error is logged when this happens.

Minimal Reproduction Steps

Environment

  • macOS with Apple Silicon (M1/M2/M3)
  • Docker Desktop with Rosetta emulation enabled
  • x86_64 Linux container running under Rosetta

Dockerfile

FROM --platform=linux/amd64 ubuntu:22.04

RUN apt-get update && apt-get install -y curl ca-certificates git && rm -rf /var/lib/apt/lists/*
RUN useradd -m -s /bin/bash testuser
RUN curl -fsSL https://opencode.ai/install | bash
RUN mv /root/.opencode/bin/opencode /usr/local/bin/opencode
RUN mkdir -p /work/repo && cd /work/repo && git init && echo '{"name":"test"}' > package.json && chown -R testuser:testuser /work/repo

WORKDIR /work/repo
USER testuser
CMD ["bash"]

Steps to Reproduce

# Build and start container
docker build --platform=linux/amd64 -t opencode-repro .
docker run --platform=linux/amd64 -d --name opencode-test opencode-repro sleep infinity

# Start opencode (first time - works)
docker exec -d opencode-test bash -c "opencode serve --port=4096 > /tmp/opencode.log 2>&1"
sleep 5

# Create a session
docker exec opencode-test curl -s -X POST http://localhost:4096/session -H 'Content-Type: application/json' -d '{}'

# Restart container
docker restart opencode-test
sleep 2

# Start opencode again (second time - HANGS)
docker exec -d opencode-test bash -c "opencode serve --port=4096 > /tmp/opencode.log 2>&1"
sleep 10

# This will timeout
docker exec opencode-test curl -s --max-time 10 http://localhost:4096/session
# Returns nothing - server is hung

Root Cause

@parcel/watcher's subscribe() function hangs under Rosetta x86_64 emulation. When inotify_init1() fails or behaves unexpectedly under Rosetta, the watcher's Backend::run blocks forever instead of propagating the error (see parcel-bundler/watcher#159).

This blocks the event loop, causing all subsequent async operations to hang - including file reads needed to load session data.

Verified

Environment Result
Native ARM64 Ubuntu container ✅ Works
x64 Ubuntu container under Rosetta ❌ Hangs
x64 container with timeout fix ✅ Works

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@matthewijordan
Add timeout for file watcher subscribe on Rosetta x86 emulation
b4f9b8a
@matthewijordan matthewijordan changed the title Add timeout for file watcher subscribe on Rosetta x86 emulation Add timeout for file watcher subscribe to address hangs on Rosetta x86 emulation Dec 10, 2025
@rekram1-node

rekram1-node commented Dec 11, 2025

Copy link
Copy Markdown
Member

/review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

github-actions[bot]
github-actions Bot reviewed Dec 11, 2025
View reviewed changes
Comment thread packages/opencode/src/file/watcher.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

rekram1-node and others added 3 commits December 10, 2025 19:38
@rekram1-node @github-actions
Update packages/opencode/src/file/watcher.ts
5138362
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@rekram1-node
Merge branch 'dev' into fix-rosetta-watcher-timeout
5f38254
@rekram1-node
fix
55a681d
@rekram1-node

rekram1-node commented Dec 11, 2025

Copy link
Copy Markdown
Member

/review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

lgtm

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Jan 17, 2026
fix(memory): Fix timeout, interval, and subscription cleanup #9148
Closed
2 tasks done
@thdxr
thdxr force-pushed the dev branch from cbab81f to 2d3c7a0 Compare January 30, 2026 04:50
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 00637c0 to 71e0ba2 Compare January 30, 2026 14:32
@thdxr
thdxr force-pushed the dev branch 3 times, most recently from f1ae801 to 08fa7f7 Compare January 30, 2026 14:37
@github-actions

github-actions Bot commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@github-actions github-actions[bot] github-actions[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@matthewijordan @rekram1-node
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.