Skip to content

Исправить project_id Gemini из ADC#2500

Merged
ideav merged 3 commits into
mainfrom
issue-2499-e82742a9df59
May 10, 2026
Merged

Исправить project_id Gemini из ADC#2500
ideav merged 3 commits into
mainfrom
issue-2499-e82742a9df59

Conversation

@konard
Copy link
Copy Markdown
Collaborator

@konard konard commented May 10, 2026

Fixes #2499

Problem

Gemini is the default AI provider and uses the Vertex AI OpenAI-compatible endpoint with {project_id}. The server only looked for that project id in explicit provider settings or env variables, so a valid ADC setup with project_id in GOOGLE_APPLICATION_CREDENTIALS_JSON or the credentials file still failed with {"error":"Не указан Google Cloud project_id для Gemini"}.

Solution

  • Read projectId, project_id, or googleProjectId from the merged provider config before falling back to saved profile settings.
  • Keep existing env support and add CLOUDSDK_CORE_PROJECT.
  • Discover the project id from ADC JSON, ADC credentials files, and GCE metadata (project/project-id).
  • Add a regression experiment covering direct provider config, ADC JSON, and ADC credentials file cases.
  • Remove the generated .gitkeep placeholder from the PR diff.
  • Merge the latest origin/main into this branch after PR Добавить подсказку к полю проверки уникальности #2498 landed.

Reproduce

Before this change, php experiments/test-issue-2499-gemini-project-id.php fails with the reported Gemini project_id error even when ADC JSON contains project_id.

After this change, the Gemini endpoint is prepared with /projects/<id>/... and no {project_id} placeholder remains.

Tests

  • php experiments/test-issue-2499-gemini-project-id.php
  • node experiments/test-issue-2483-ai-chat-server.js
  • node experiments/test-issue-2481-ai-providers.js
  • node experiments/test-issue-2491-ai-chat-current-db.js
  • node experiments/test-issue-2495-unique-key-ui.js
  • node experiments/test-issue-2486-ai-chat-local-storage.js
  • node experiments/test-issue-2471-ai-chat.js
  • node experiments/test-issue-2474-ai-chat-global.js
  • node experiments/test-issue-2488-ai-chat-button-border.js
  • node --check js/ai-chat.js
  • php -l index.php
  • php -l experiments/test-issue-2499-gemini-project-id.php
  • git diff --check origin/main...HEAD

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #2499
@konard konard self-assigned this May 10, 2026
@konard konard changed the title [WIP] https://github.com/ideav/crm/pull/2492 Исправь ошибку Исправить project_id Gemini из ADC May 10, 2026
@konard konard marked this pull request as ready for review May 10, 2026 20:43
@konard
Copy link
Copy Markdown
Collaborator Author

konard commented May 10, 2026

Working session summary

Implemented and pushed the fix to PR 2500: #2500

Changed index.php so Gemini can resolve project_id from merged provider config, env, ADC JSON, ADC credentials files, or GCE metadata. Added regression coverage in experiments/test-issue-2499-gemini-project-id.php.

Verified with the AI chat/provider tests, PHP syntax checks, the new regression test, and git diff --check origin/main...HEAD. The branch is clean, includes latest origin/main, PR is ready for review, and GitHub reports no configured status checks/runs for this branch.


This summary was automatically extracted from the AI working session output.

@konard
Copy link
Copy Markdown
Collaborator Author

konard commented May 10, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: GPT-5.5
  • Provider: OpenAI
  • Public pricing estimate: $5.607788

📊 Context and tokens usage:

  • 142.1K / 1.1M (14%) input tokens, 20.6K / 128K (16%) output tokens

Total: (142.1K + 3.3M cached) input tokens, 20.6K output tokens, $5.607788 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-5.5
  • Model: GPT-5.5 (gpt-5.5)

📎 Log file uploaded as Gist (24166KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Collaborator Author

konard commented May 10, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • No CI/CD checks are configured for this repository
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@ideav ideav merged commit 7d42e66 into main May 10, 2026
@ideav ideav deleted the issue-2499-e82742a9df59 branch May 10, 2026 20:58
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.

https://github.com/ideav/crm/pull/2492 Исправь ошибку

2 participants