LearnNewsExamplesServices
Frontmatter
id12526
titleRemove GitLab workflow B3 AiConfig defensive reads
stateClosed
labels
enhancementairefactoringarchitecture
assigneesneo-gpt
createdAtJun 4, 2026, 7:58 PM
updatedAtJun 5, 2026, 3:47 AM
githubUrlhttps://github.com/neomjs/neo/issues/12526
authorneo-gpt
commentsCount0
parentIssue12461
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 5, 2026, 3:47 AM

Remove GitLab workflow B3 AiConfig defensive reads

Closed v13.0.0/archive-v13-0-0-chunk-16 enhancementairefactoringarchitecture
neo-gpt
neo-gpt commented on Jun 4, 2026, 7:58 PM

Context

This is a narrow child leaf under the B3 production-read cleanup tracked by #12461 and parent Epic #12456. The broad #12461 ticket is valid as the B3 workstream, but it is intentionally cluster-shaped: one PR per source cluster. Current duplicate checks found active leaves for ProtoSource (#12504 / PR #12505) and orchestrator (#12515 / PR #12516), but no GitLab workflow leaf.

Observed current-source evidence on dev:

  • ai/services/gitlab-workflow/HealthService.mjs imports ai/mcp/server/gitlab-workflow/config.mjs as aiConfig.
  • HealthService.healthcheck() reads aiConfig.gitlab?.hostUrl || '' and aiConfig.gitlab?.token.
  • ai/mcp/server/gitlab-workflow/config.template.mjs declares resolved leaves for gitlab.hostUrl (NEO_GITLAB_HOST, default https://gitlab.com) and gitlab.token (NEO_GITLAB_PAT, default empty string).

The Problem

ADR 0019 classifies defensive reads around the AiConfig Provider SSOT as B3. Optional chaining on the guaranteed gitlab subtree masks a broken config tree instead of failing loud. The || '' hidden default also re-states a leaf default at the consumer instead of letting the leaf own the default.

For this service, that means the healthcheck can quietly convert a malformed/missing gitlab subtree into an empty host URL and then report a generic missing-host detail, rather than surfacing the actual SSOT violation.

The Architectural Reality

ADR 0019 is the source of authority: read resolved leaves at the use site; never defend against the SSOT. The GitLab workflow config already owns these leaves:

Surface Source of authority Current defensive read Sanctioned read
gitlab.hostUrl ai/mcp/server/gitlab-workflow/config.template.mjs leaf hostUrl: leaf('https://gitlab.com', 'NEO_GITLAB_HOST', 'url') `aiConfig.gitlab?.hostUrl
gitlab.token ai/mcp/server/gitlab-workflow/config.template.mjs leaf token: leaf('', 'NEO_GITLAB_PAT', 'string') aiConfig.gitlab?.token aiConfig.gitlab.token

The Fix

Update ai/services/gitlab-workflow/HealthService.mjs to read the resolved leaves directly:

  • replace aiConfig.gitlab?.hostUrl || '' with aiConfig.gitlab.hostUrl;
  • replace aiConfig.gitlab?.token with aiConfig.gitlab.token.

Keep the existing healthcheck behavior that reports a missing host when the resolved leaf is empty; the cleanup is about SSOT fail-loud semantics, not changing the public healthcheck payload shape.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
HealthService.healthcheck().gitlab.hostUrl ai/services/gitlab-workflow/HealthService.mjs; ai/mcp/server/gitlab-workflow/config.template.mjs gitlab.hostUrl leaf; ADR 0019 Report the resolved aiConfig.gitlab.hostUrl leaf value. None in consumer; leaf default/env binding owns fallback. Existing class JSDoc stays accurate. Unit/static coverage should verify no gitlab?.hostUrl or consumer-side `
HealthService.healthcheck().gitlab.tokenConfigured ai/services/gitlab-workflow/HealthService.mjs; ai/mcp/server/gitlab-workflow/config.template.mjs gitlab.token leaf; ADR 0019 Derive Boolean from resolved aiConfig.gitlab.token. None in consumer; leaf default/env binding owns fallback. Existing class JSDoc stays accurate. Unit/static coverage should verify no gitlab?.token remains.

Decision Record impact

aligned-with ADR 0019 (AiConfig reactive Provider SSOT).

Acceptance Criteria

  • ai/services/gitlab-workflow/HealthService.mjs contains zero aiConfig.gitlab?. reads.
  • HealthService.healthcheck() reads aiConfig.gitlab.hostUrl and aiConfig.gitlab.token directly.
  • No consumer-side hidden default (|| '') remains for gitlab.hostUrl; the config leaf owns the default.
  • Targeted verification proves the GitLab workflow B3 leaf is removed without changing the healthcheck payload contract.
  • PR body cites ADR 0019 and relates back to #12461.

Out of Scope

  • Other B3 clusters under #12461 (memory-core, knowledge-base, graph/ingestion, maintenance, examples).
  • B4 test singleton writes (#12435).
  • The SSOT lint (#12451).
  • GitLab API connectivity or GitLab client implementation.

Avoided Traps

  • Do not add a helper or local alias for gitlab; direct leaf reads are the point.
  • Do not move the GitLab host/token defaults into HealthService; the leaf declaration already owns defaults and env binding.
  • Do not broaden this PR to unrelated B3 clusters; #12461 explicitly wants cluster-sized PRs.

Related

Parent B3 workstream: #12461 Parent Epic: #12456 Sibling leaves: #12504, #12515 Authority: ADR 0019 (learn/agentos/decisions/0019-aiconfig-reactive-provider-ssot.md)

Origin Session ID: dcdaac0b-9ae0-45b5-b4da-da39541af497

Retrieval Hint: query_raw_memories("GitLab workflow B3 AiConfig defensive reads HealthService") or search current source for aiConfig.gitlab?..

tobiu referenced in commit f890d60 - "fix(ai): remove GitLab B3 config defenses (#12526) (#12528) on Jun 5, 2026, 3:47 AM
tobiu closed this issue on Jun 5, 2026, 3:47 AM