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 — fix(server): honor off spellings of MEMMACHINE_CONFIG_API by deshmukh-viraj · Pull Request #1930 · MemMachine/MemMachine

Conversation

@deshmukh-viraj

@deshmukh-viraj deshmukh-viraj commented Nov 5, 2026

Copy link
Copy Markdown

What does this PR do?

MEMMACHINE_CONFIG_API=0, =false and =no all mounted the configuration management API, because the variable was read with plain truthiness (bool(os.getenv(...))): any non-empty string is on. Since that API can change the running server's configuration (and rewrite the config file with its secrets, per #1752), an operator writing the common off spellings got the opposite of what they asked for.

This adds a small _env_flag helper that treats unset, empty, 0, false, no, off (case-insensitive, surrounding whitespace tolerated) as off, and uses it at both read sites: the module-level MemMachineAPI construction and the single-worker router include in start_http(). --with-config-api still works, since it sets the variable to 1.

Related Issue

Fixes #1926

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Changes Made

  • packages/server/src/memmachine_server/server/app.py: new _env_flag helper; both MEMMACHINE_CONFIG_API read sites now use it
  • packages/server/server_tests/memmachine_server/server/test_env_flag.py: 16 parametrized cases covering unset, empty, off spellings (with case and whitespace variants) and on spellings

How to Test

  1. uv sync then uv run pytest packages/server/server_tests/memmachine_server/server/test_env_flag.py -v - 16 passed
  2. uv run pytest packages/server/server_tests/memmachine_server/server/ -q - 299 passed, no regressions
  3. uv run ruff check and uv run ruff format --check on the touched files - clean

Manual check: start the server with MEMMACHINE_CONFIG_API=0, then GET /api/v2/config/resources no longer routes.

Sorry, something went wrong.

Uh oh!

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

All reactions
@deshmukh-viraj
fix(server): honor off spellings of MEMMACHINE_CONFIG_API
3aa986e
MEMMACHINE_CONFIG_API was read with plain truthiness, so 0, false, no
and off all mounted the configuration management API, which can change
the running server's configuration. Parse the value case-insensitively
and treat the common off spellings as off, matching what an operator
writing those values expects.
@deshmukh-viraj deshmukh-viraj mentioned this pull request Nov 5, 2026
[Bug]: MEMMACHINE_CONFIG_API=0 (or false) turns the configuration API on #1926
Open

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

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.

[Bug]: MEMMACHINE_CONFIG_API=0 (or false) turns the configuration API on

Uh oh!

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

1 participant

@deshmukh-viraj
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 01402520 — 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.