Skip to content

fix: add deterministic mock AI provider for local/demo use#194

Open
rajsingh1301 wants to merge 5 commits into
AnkanMisra:mainfrom
rajsingh1301:feat/mock-ai-provider
Open

fix: add deterministic mock AI provider for local/demo use#194
rajsingh1301 wants to merge 5 commits into
AnkanMisra:mainfrom
rajsingh1301:feat/mock-ai-provider

Conversation

@rajsingh1301

@rajsingh1301 rajsingh1301 commented Jun 4, 2026

Copy link
Copy Markdown

Description

This PR adds a local/demo-only mock AI provider that allows running the payment and summarization flow completely offline without external AI keys (OpenRouter) or an active Ollama instance.

Changes

Mock Provider: Implemented MockProvider returning a deterministic summary.
Gateway: Updated configuration validation and health checks (/readyz) to bypass API key checks when AI_PROVIDER=mock.
Tests: Added unit tests in provider_test.go and integration tests in main_test.go verifying the end-to-end mock flow. All tests pass successfully.
Docs: Updated .env.example and gateway/README.md to document the new mock option.

fix : #177

Summary by CodeRabbit

  • New Features

    • Added a "mock" AI provider option and surfaced it in health checks.
  • Bug Fixes

    • Ensured caching and provider selection treat the mock provider distinctly.
    • Adjusted local health probing to reach local AI services from containers.
  • Documentation

    • Updated README(s) and .env.example to document the mock provider and startup/config notes.
  • Tests

    • Added tests covering provider selection, readiness, config validation, and mock summary flows.
  • Chores

    • Exposed AI-related env vars and host mapping in docker-compose for local/demo runs.

- Implement MockProvider that returns deterministic mock summary
- Wire mock provider in NewProvider and handle readyz health checks
- Update CacheMiddleware to handle mock provider cache keys
- Add unit and integration tests covering the mock provider
- Update README and .env.example with mock provider documentation
@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

@rajsingh1301 is attempting to deploy a commit to the ankanmisra's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@rajsingh1301, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 45 minutes and 5 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2a565966-60c0-4489-8e48-64a96da9bd86

📥 Commits

Reviewing files that changed from the base of the PR and between 77f42b5 and f03518a.

📒 Files selected for processing (4)
  • gateway/config_test.go
  • gateway/internal/ai/provider.go
  • gateway/internal/ai/provider_test.go
  • gateway/main.go
📝 Walkthrough

Walkthrough

Adds a deterministic local/demo MockProvider, wires it into NewProvider() with environment gating, updates cache keying and readyz, rewrites local Ollama URL for Docker, adds unit and integration tests for mock flows, and updates docs, .env.example, and docker-compose to expose mock.

Changes

Mock Provider Feature

Layer / File(s) Summary
Mock Provider Implementation
gateway/internal/ai/mock.go
MockProvider type with NewMockProvider() constructor and deterministic Generate(ctx, text) method that returns a fixed summary string and checks context cancellation.
Provider Factory Integration
gateway/internal/ai/provider.go
NewProvider() adds AI_PROVIDER=mock case with NODE_ENV/APP_ENV whitelist and ALLOW_MOCK_PROVIDER gating; returns errors when disabled.
Config validation, readyz, Ollama Docker URL
gateway/main.go, gateway/internal/ai/ollama.go
validateConfig() enforces mock gating; handleReadyz reports mock as ok; Ollama URL is rewritten to host.docker.internal when running in Docker.
Cache Integration
gateway/cache.go
Cache middleware's model selection adds explicit mock branch setting cache-key model to "mock".
Unit tests: provider and config
gateway/internal/ai/provider_test.go, gateway/config_test.go
Extends TestNewProvider with mock cases and TestMockProvider; adds TestValidateConfig_MockProvider covering allowed/disallowed env combos and per-test env setup/reset.
Integration tests: readyz & summarize
gateway/main_test.go
Adds TestHandleReadyz_MockProvider and TestHandleSummarize_MockProvider exercising health checks, verifier 402 challenge, signed retry flow, and X-402-Receipt assertions; isolates package globals.
Configuration and Documentation
.env.example, gateway/README.md, README.md, docker-compose.yml
Documents mock as an AI_PROVIDER option, updates diagrams and README, and exposes AI_PROVIDER, OLLAMA_URL, OLLAMA_MODEL in docker-compose.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Suggested labels

level:intermediate

Suggested reviewers

  • AnkanMisra

Poem

🐰 I hopped in with a tiny mock,
A steady reply from a cozy rock.
Health checks green, no keys to seek,
Tests pass tidy, demo looks sleek.
Small hops, big smiles — a rabbit's cheek.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.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
Title check ✅ Passed The title clearly and accurately summarizes the main change: adding a deterministic mock AI provider for local/demo use, which is reflected throughout the changeset.
Description check ✅ Passed The description provides a clear summary of changes and addresses most template sections, though it omits Type of Change checkboxes, Verification commands, and detailed contributor checklist items.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

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

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@gateway/internal/ai/mock.go`:
- Around line 14-15: Update MockProvider.Generate to honor context cancellation:
check ctx.Err() before returning the deterministic string and if ctx.Err() is
non-nil return "", ctx.Err(); additionally, if the function does any blocking or
simulated work, periodically check ctx.Err() and return it on cancellation so
MockProvider.Generate mirrors real provider timeout/cancellation semantics.

In `@gateway/main_test.go`:
- Around line 675-682: This test overwrites package-level aiProvider and receipt
store state without restoring them; save the current aiProvider and current
receipt store state before calling ai.NewProvider() and initReceiptStore(), then
restore them in a deferred teardown (e.g., capture prevProvider := aiProvider
and prevStore := receiptStore or the package symbol used for the store, then
defer restoring aiProvider = prevProvider and receiptStore = prevStore) so
subsequent tests see the original globals just like the other tests in this
file.
- Around line 662-665: The verifier stub (the httptest.NewServer handler
assigned to verifier) currently accepts any request and the test request only
includes signature/nonce/timestamp, so update the test to send a full X402
payment context (include recipient, amount, token, chain_id, signature, nonce,
timestamp) and change the verifier handler to parse and assert the outbound
request body contains those exact fields and values (verify signature, nonce,
timestamp, recipient, amount, token, chain_id match expected test values),
returning the successful JSON only if assertions pass; also extend the test to
cover a signed retry path by sending a retry request and asserting the verifier
sees identical bound fields on the retry (use the same expected values) so the
test fails if binding is lost.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 80527b72-51b6-472f-9aa9-b5e63637adb7

📥 Commits

Reviewing files that changed from the base of the PR and between 8004749 and 4541224.

📒 Files selected for processing (8)
  • .env.example
  • gateway/README.md
  • gateway/cache.go
  • gateway/internal/ai/mock.go
  • gateway/internal/ai/provider.go
  • gateway/internal/ai/provider_test.go
  • gateway/main.go
  • gateway/main_test.go

Comment thread gateway/internal/ai/mock.go Outdated
Comment thread gateway/main_test.go
Comment thread gateway/main_test.go
@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
microai-paygate Ready Ready Preview, Comment Jun 7, 2026 12:36pm

@AnkanMisra

Copy link
Copy Markdown
Owner

@codex review

@AnkanMisra AnkanMisra added enhancement New feature or request good first issue Good for newcomers go Pull requests that update go code level:beginner Small, well-scoped work suitable for newer contributors. type:feature New user-facing or API-facing capability. type:testing Tests, coverage, fixtures, or validation-only work. labels Jun 4, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4541224a67

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread gateway/README.md
| --- | --- | --- |
| `PORT` | `3000` | Gateway listen port. |
| `AI_PROVIDER` | `openrouter` | Supported values: `openrouter`, `ollama`. |
| `AI_PROVIDER` | `openrouter` | Supported values: `openrouter`, `ollama`, `mock` (local/demo only). |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document mock in root setup docs

When readers follow the root README instead of gateway/README.md, the env table still says AI_PROVIDER is only openrouter by default or ollama for local experiments (README.md:319), so the newly added local/demo mock path is not discoverable from the main setup flow. Please update the root README alongside this gateway-specific entry to keep the documented supported providers aligned. Nice addition overall; this just avoids setup confusion.

Useful? React with 👍 / 👎.

Comment thread gateway/main_test.go
// Environment
t.Setenv("AI_PROVIDER", "mock")
t.Setenv("VERIFIER_URL", verifier.URL)
t.Setenv("SERVER_WALLET_PRIVATE_KEY", "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reset cached receipt key state in mock flow test

Setting SERVER_WALLET_PRIVATE_KEY here is not enough because getServerPrivateKey is guarded by serverPrivateKeyOnce, and earlier receipt tests can cache a missing-key error before this test runs. With shuffled test order (go test -shuffle=1780551100980941842 .), this mock-provider integration test returns 500 during receipt generation instead of 200; use the existing reset helper or reset the key globals around this test so it is order-independent. Nice coverage addition, but this needs isolation to keep CI reliable.

Useful? React with 👍 / 👎.

Comment thread .env.example

# AI Service Configuration
# AI provider selection: "openrouter" (default) or "ollama"
# AI provider selection: "openrouter" (default), "ollama", or "mock" (local/demo only)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass AI_PROVIDER through Compose

When a local/demo user copies this env template, sets AI_PROVIDER=mock, and starts the stack with Docker Compose, the gateway container still will not see the setting because docker-compose.yml only lists the variables that get placed in the container environment and omits AI_PROVIDER; Docker’s Compose docs describe the environment attribute as what sets container environment variables. In that scenario the gateway falls back to openrouter and fails startup without OPENROUTER_API_KEY, so please add AI_PROVIDER (and any provider-specific mock/ollama variables as needed) to the gateway service environment.

Useful? React with 👍 / 👎.

@AnkanMisra AnkanMisra left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR

@rajsingh1301 rajsingh1301 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AnkanMisra ,

I've made the requested changes to the PR. Could you please review it again when you get a chance?

Thank you!

@AnkanMisra AnkanMisra left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the go lint ci failed, read tests to prevent the bug

@AnkanMisra

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 454bf7d479

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread gateway/README.md
| --- | --- | --- |
| `PORT` | `3000` | Gateway listen port. |
| `AI_PROVIDER` | `openrouter` | Supported values: `openrouter`, `ollama`. |
| `AI_PROVIDER` | `openrouter` | Supported values: `openrouter`, `ollama`, `mock` (local/demo only). |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update root provider docs for mock mode

Adding mock here leaves the top-level README's architecture/configuration sections still describing only OpenRouter/Ollama (README.md lines 69 and 319-322), so users following the main setup docs won't discover the new offline provider or that an OpenRouter key is unnecessary in mock mode. Since this PR changes the supported gateway configuration, please update the root docs alongside this gateway-specific table.

Useful? React with 👍 / 👎.

Comment thread .env.example

# AI Service Configuration
# AI provider selection: "openrouter" (default) or "ollama"
# AI provider selection: "openrouter" (default), "ollama", or "mock" (local/demo only)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass AI_PROVIDER through Compose

When a developer follows this new AI_PROVIDER=mock option with docker-compose up, Compose still only passes OPENROUTER_API_KEY and OPENROUTER_MODEL into the gateway (docker-compose.yml lines 18-20), so the container never sees AI_PROVIDER=mock, defaults back to OpenRouter, and fails startup without an OpenRouter key. Please add AI_PROVIDER to the gateway environment passthrough so the documented offline/demo mode works in the Compose stack too.

Useful? React with 👍 / 👎.

Comment on lines +28 to +29
case "mock":
return NewMockProvider(), nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Block mock provider in production

Because mock is described as local/demo-only but is accepted unconditionally here, a production deployment with AI_PROVIDER=mock will start cleanly, /readyz reports the AI provider as ok, and paid summarize requests return the canned mock response instead of contacting an AI provider. Please gate this provider to development/test environments (or fail startup when production mode selects it) so a misconfigured paid gateway cannot charge users for fake summaries.

Useful? React with 👍 / 👎.

@AnkanMisra

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f58ba120f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docker-compose.yml Outdated
- METRICS_PATH=${METRICS_PATH:-/metrics}
# Pass through from .env file
- AI_PROVIDER
- OLLAMA_URL

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Set a Docker-safe Ollama endpoint

When the Compose stack is run with AI_PROVIDER=ollama and OLLAMA_URL is left unset, this newly exposed provider path falls back to http://localhost:11434 from NewOllamaProvider (gateway/internal/ai/ollama.go), but inside the gateway container localhost is the container itself rather than the host running Ollama. That makes /readyz report the AI provider as unreachable and signed summarize requests fail unless users know to override the URL; consider giving Compose a container-safe default or documenting/adding the required host mapping for this mode.

Useful? React with 👍 / 👎.

Comment on lines +28 to +29
case "mock":
return NewMockProvider(), nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Block mock provider in production

Because the mock provider is documented as local/demo-only but this branch accepts AI_PROVIDER=mock unconditionally, any production deploy that carries this env var (for example from a copied demo .env) will pass startup and /readyz while serving the deterministic fake summary for paid requests. Consider rejecting mock when NODE_ENV=production or requiring an explicit dev-only override so this test provider cannot be enabled accidentally in a real deployment.

Useful? React with 👍 / 👎.

Comment thread docker-compose.yml
- OLLAMA_URL
- OLLAMA_MODEL
- OPENROUTER_API_KEY
- OPENROUTER_MODEL

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass through the OpenRouter URL override

This Compose env list now exposes the provider knobs, but it still omits OPENROUTER_URL, even though NewOpenRouterProvider reads that variable and .env.example documents it for custom OpenRouter-compatible endpoints. In Docker runs that set OPENROUTER_URL in .env, the gateway container will silently fall back to the public OpenRouter endpoint, breaking local/stubbed providers; add OPENROUTER_URL alongside the other OpenRouter settings.

Useful? React with 👍 / 👎.

@AnkanMisra AnkanMisra left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow Codex review

@AnkanMisra AnkanMisra left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest Codex-requested changes were not fully applied. The current PR head still leaves several of those requested fixes unresolved, so this is not ready to merge yet.

[P1] Mock provider is still allowed without any safety gate
File: gateway/internal/ai/provider.go:28-29
Problem: The code still accepts AI_PROVIDER=mock unconditionally with return NewMockProvider(), nil.
Impact: A production or misconfigured deployment can silently serve fake summaries instead of a real AI provider. This is the main correctness/safety issue Codex asked to fix, and it is still present.
Fix: Reject mock outside an explicit local/dev/demo mode, or require a dedicated allow flag before enabling it.

[P2] Docker Compose still does not provide a Docker-safe Ollama configuration
File: docker-compose.yml:20
Problem: Passing through OLLAMA_URL does not solve the container networking issue. If OLLAMA_URL is set to http://localhost:11434, the gateway container will try to call itself, not the host machine running Ollama.
Impact: The documented Docker/local demo flow can still fail even though the PR now presents Ollama mode as supported. This was another Codex concern and it remains unresolved.
Fix: Document and wire a Docker-safe host value such as host.docker.internal, or otherwise provide a compose-safe default for containerized runs.

[P2] OPENROUTER_URL is still not passed through Compose
File: docker-compose.yml:18-23
Problem: The gateway service now forwards OPENROUTER_API_KEY and OPENROUTER_MODEL, but OPENROUTER_URL is still missing.
Impact: Docker runs cannot use a custom OpenRouter-compatible endpoint even though non-Docker runs can, so the environment contract is still inconsistent. Codex explicitly asked for this and it was not done.
Fix: Add OPENROUTER_URL to the gateway environment passthrough list in docker-compose.yml.

Also, there is no new commit after the latest Codex review on commit 0f58ba120f2b63624e2bf289e915b83a0226323b, so the “I’ve made the requested changes” comment does not match the current code state.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@gateway/config_test.go`:
- Around line 478-537: The subtests in TestValidateConfig_MockProvider leave
ambient env vars that can leak from the host/CI; update each subtest (inside
TestValidateConfig_MockProvider) to explicitly set/reset APP_ENV, CACHE_ENABLED,
and RECIPIENT_ADDRESS via t.Setenv (e.g. t.Setenv("APP_ENV",""),
t.Setenv("CACHE_ENABLED","false"), t.Setenv("RECIPIENT_ADDRESS","")) so
validateConfig runs hermetically; ensure these t.Setenv calls are added
alongside the existing t.Setenv calls in each of the four t.Run blocks that call
validateConfig.

In `@gateway/internal/ai/provider.go`:
- Around line 29-41: Normalize environment variables before comparing: in
gateway/internal/ai/provider.go convert NODE_ENV and APP_ENV to lowercase
trimmed values (nodeEnv, appEnv) and evaluate production as prefixes like "prod"
(e.g., startsWith "prod") and allowed dev-like environments via exact lowercase
checks; also normalize ALLOW_MOCK_PROVIDER (allowMock) by lowercasing and
treating "true", "1", "yes" as truthy. Update the same logic in gateway/main.go
validateConfig so startup validation uses the same normalized checks and
consistent gating across runtime and startup.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 44d682a4-07cb-4179-8a29-3ec7f8ea90ab

📥 Commits

Reviewing files that changed from the base of the PR and between 0f58ba1 and 77f42b5.

📒 Files selected for processing (7)
  • docker-compose.yml
  • gateway/config_test.go
  • gateway/internal/ai/ollama.go
  • gateway/internal/ai/provider.go
  • gateway/internal/ai/provider_test.go
  • gateway/main.go
  • gateway/main_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • gateway/internal/ai/provider_test.go
  • gateway/main_test.go

Comment thread gateway/config_test.go
Comment thread gateway/internal/ai/provider.go Outdated
@rajsingh1301 rajsingh1301 removed their assignment Jun 5, 2026
@rajsingh1301

Copy link
Copy Markdown
Author

Hi,

I accidentally unassigned myself while working on this issue. I have already started working on the fix. Could I be reassigned to this issue if possible?

Thank you.

@rajsingh1301 rajsingh1301 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AnkanMisra ,
I have made the requested changes. Could you please review my PR?
Thank you.

@AnkanMisra

Copy link
Copy Markdown
Owner

@codex review

@AnkanMisra AnkanMisra left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Update branch
  2. fix bugs that codex gave

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f03518a872

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docker-compose.yml
- METRICS_ENABLED=${METRICS_ENABLED:-true}
- METRICS_PATH=${METRICS_PATH:-/metrics}
# Pass through from .env file
- AI_PROVIDER

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pass the mock-enabling environment into Compose

When a user follows the Docker Compose quick start and sets AI_PROVIDER=mock in the copied .env, the gateway container receives AI_PROVIDER but none of NODE_ENV, APP_ENV, or ALLOW_MOCK_PROVIDER. Docker documents that values from .env are used for interpolation and only enter the container through an explicit environment/env_file entry (Docker Docs); consequently IsMockAllowed sees three empty values and the gateway exits during startup. Forward at least NODE_ENV=${NODE_ENV:-development} (and preferably the two override variables) so the advertised offline Compose setup works.

Useful? React with 👍 / 👎.

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

Labels

enhancement New feature or request go Pull requests that update go code good first issue Good for newcomers level:beginner Small, well-scoped work suitable for newer contributors. type:feature New user-facing or API-facing capability. type:testing Tests, coverage, fixtures, or validation-only work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a deterministic mock AI provider for local demos

2 participants