Skip to content

(opened in error)#441

Closed
wyh0626 wants to merge 1 commit into
rohitg00:mainfrom
wyh0626:fix/434-fly-viewer-bind
Closed

(opened in error)#441
wyh0626 wants to merge 1 commit into
rohitg00:mainfrom
wyh0626:fix/434-fly-viewer-bind

Conversation

@wyh0626
Copy link
Copy Markdown
Contributor

@wyh0626 wyh0626 commented May 17, 2026

Opened by mistake. Please disregard.

The viewer hardcoded `server.listen(port, "127.0.0.1")`, so on hosting
platforms like Fly that route inbound traffic through a separate
interface (`fly-local-6pn` WireGuard mesh) the connection arrived on a
non-loopback address and got reset. Operators following the
`deploy/fly/README` "fly proxy 3113:3113" instructions saw the
`Connection reset by peer` reported in rohitg00#434.

Add `resolveViewerHost()` that reads `AGENTMEMORY_VIEWER_HOST` and falls
back to `127.0.0.1`, so the default loopback-only behaviour for local
installs — which the v0.9.12 plaintext-bearer guard relies on — is
unchanged. The Fly Dockerfile sets the env var to `::` so the viewer
also listens on the machine's `fly-local-6pn` IPv6 interface. `fly.toml`
is unchanged: port 3113 still isn't published, so the viewer remains
reachable only through `fly proxy` (mTLS WireGuard).

`test/viewer-host.test.ts` covers:

- defaults to 127.0.0.1 when the env var is unset or empty
- returns the configured value when set, trimming whitespace
- `startViewerServer` actually binds to 127.0.0.1 by default
- `startViewerServer` binds to the env-configured host (`::1`)

Signed-off-by: wyh0626 <44987669+wyh0626@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 17, 2026

@wyh0626 is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e439e24c-8469-4b4b-8d90-a762629d2226

📥 Commits

Reviewing files that changed from the base of the PR and between 3a3f866 and 4b35165.

📒 Files selected for processing (4)
  • deploy/fly/Dockerfile
  • deploy/fly/README.md
  • src/viewer/server.ts
  • test/viewer-host.test.ts

📝 Walkthrough

Walkthrough

This PR fixes the Fly deployment proxy issue by making the viewer server host configurable. It adds an AGENTMEMORY_VIEWER_HOST environment variable that allows the server to bind to addresses beyond the default 127.0.0.1, enabling Fly's WireGuard interface to reach the viewer for fly proxy connections.

Changes

Viewer host binding configuration

Layer / File(s) Summary
Host resolution function and server binding
src/viewer/server.ts, test/viewer-host.test.ts
resolveViewerHost() reads AGENTMEMORY_VIEWER_HOST with fallback to 127.0.0.1 and trims whitespace. Server binding updated to use the resolved host instead of hardcoded address. Tests verify function behavior and confirm server binds to the configured host.
Fly deployment configuration and documentation
deploy/fly/Dockerfile, deploy/fly/README.md
Dockerfile sets AGENTMEMORY_VIEWER_HOST=:: so viewer binds to IPv6 unspecified address. README documents that this binding enables fly proxy access via the WireGuard interface instead of failing on loopback-only binding.

Possibly related PRs

  • rohitg00/agentmemory#405: Both PRs modify src/viewer/server.ts's viewer server startup behavior (this PR adds host configuration via environment variable, while the linked PR changes port retry behavior when ports are in use).

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 A little viewer that bound too tight, / Could only hear from loopback's night. / With :: whispers through WireGuard's door, / Now fly proxy connects forevermore! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: allowing the viewer to bind to non-loopback addresses via the AGENTMEMORY_VIEWER_HOST environment variable, which is the core fix.
Linked Issues check ✅ Passed The PR successfully addresses issue #434 by implementing the ability to configure the viewer bind host via AGENTMEMORY_VIEWER_HOST environment variable, resolving the Fly deployment proxy connection reset issue.
Out of Scope Changes check ✅ Passed All changes are directly related to the objective of fixing Fly deployment proxy connectivity: environment variable support in Docker/README, host resolution logic in viewer server, and comprehensive test coverage for the new functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@wyh0626 wyh0626 closed this May 17, 2026
@wyh0626 wyh0626 changed the title fix(viewer): allow non-loopback bind via AGENTMEMORY_VIEWER_HOST (closed — opened in error, please disregard) May 17, 2026
@wyh0626 wyh0626 deleted the fix/434-fly-viewer-bind branch May 17, 2026 08:35
@wyh0626 wyh0626 changed the title (closed — opened in error, please disregard) (opened in error) May 17, 2026
@wyh0626 wyh0626 restored the fix/434-fly-viewer-bind branch May 17, 2026 08:52
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.

1 participant