Skip to content

fix(agent): verify explicit model catalog and Compose runtime - #133

Merged
seonghobae merged 7 commits into
mainfrom
fix/opencode-model-compose-runtime
Aug 9, 2026
Merged

fix(agent): verify explicit model catalog and Compose runtime#133
seonghobae merged 7 commits into
mainfrom
fix/opencode-model-compose-runtime

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Outcome

Follow-up to #122: replace the two disputed validation gaps with executable, least-privilege alternatives.

Changes

  • register and whitelist the selected NVIDIA model in the private OpenCode configuration
  • disable Models.dev refresh and project configuration overrides while explicitly loading reviewed AGENTS.md and CLAUDE.md
  • prove with the pinned OpenCode 1.18.9 binary that a model absent from the bundled catalog resolves to exactly one NVIDIA label, without exposing /v1/models
  • keep Docker authority outside opencode_model and parse the accepted candidate's exact Compose file with --file
  • add credential-free pull-request CI that starts digest-pinned PostgreSQL/NATS, executes SELECT 1, validates JetStream through /jsz, emits bounded failure diagnostics, and always tears down
  • bind Compose ports to loopback and record model-catalog/Compose validation outcomes accurately in the receipt
  • allow the bounded OpenCode catalog contract probe enough deterministic test runtime instead of failing at Vitest's default 5-second timeout
  • construct the synthetic loopback catalog credential at runtime so AppGuardrail can still fail closed on real hard-coded credential-shaped assignments
  • align architecture, operations, research, design, plan, and changelog documentation

Verification discipline

Earlier branch heads demonstrated the intended model-catalog probe, root format/lint/typecheck/build, and commercial-development-agent coverage, but those predecessor results do not transfer to the current head.

The current exact head must independently pass CI, AppGuardrail, Semgrep, Security Scan, Commercial Readiness, automated review, and every repository-required merge gate before merge. In particular, the preceding head exposed two real gate failures that are now addressed on source: the catalog test exceeded Vitest's default timeout, and AppGuardrail correctly rejected secret-shaped placeholder assignments in the test fixture. No current-head pass is claimed until those workflows complete.

No provider secret, GitHub token, model prompt/output, or Docker socket is introduced into the model environment.

Summary by CodeRabbit

  • 개선 사항

    • PostgreSQL과 NATS가 검증된 버전 및 고정된 이미지로 업데이트되었습니다.
    • 데이터베이스와 메시징 서비스 포트가 로컬 환경에서만 접근되도록 제한되었습니다.
    • OpenCode 실행 시 허용된 NVIDIA 모델만 사전 검증하고, 명시된 설정으로 실행합니다.
    • Docker Compose 구성과 PostgreSQL·NATS 상태를 자동으로 점검하며, 실패 시 진단 정보와 정리가 제공됩니다.
    • 검증 결과와 실패 원인이 영수증 및 CI 결과에 더 구체적으로 표시됩니다.
  • 문서

    • 운영 절차, 아키텍처 및 변경 내역 문서가 최신 검증·보안 정책을 반영하도록 업데이트되었습니다.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 54 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

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.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3e1fd3b4-5c23-4906-ac4b-f319ee2b9293

📥 Commits

Reviewing files that changed from the base of the PR and between 2b339bc and 35e2bbb.

📒 Files selected for processing (1)
  • packages/commercial-development-agent/src/workflow-contract.test.mjs
📝 Walkthrough

Walkthrough

OpenCode 실행에 명시적 NVIDIA 모델과 오프라인 카탈로그 검증을 추가했습니다. Compose 검증을 신뢰된 별도 단계로 분리했습니다. PR CI는 고정 이미지로 PostgreSQL과 NATS를 점검하고, 각 검증 결과를 영수증에 기록합니다.

Changes

OpenCode 검증 및 CI

Layer / File(s) Summary
NVIDIA 모델 카탈로그 검증
.github/workflows/opencode-commercial-development.yml, docs/operations/..., docs/research/..., docs/superpowers/..., packages/commercial-development-agent/src/workflow-contract.test.mjs, ARCHITECTURE.md
OpenCode가 명시적 NVIDIA 모델만 사용하도록 설정했습니다. 모델 카탈로그를 오프라인에서 검증한 뒤 credential bridge를 시작합니다. 모델 자동 검색과 프로젝트 로컬 설정 탐색을 비활성화했습니다.
신뢰된 Compose 검증과 런타임 점검
compose.yaml, .github/workflows/ci.yml, .github/workflows/opencode-commercial-development.yml, packages/commercial-development-agent/src/workflow-contract.test.mjs, docs/operations/..., docs/superpowers/..., docs/research/...
Compose 설정 검증을 별도 단계로 분리했습니다. PostgreSQL과 NATS 이미지를 digest로 고정하고 포트를 loopback에 바인딩했습니다. CI는 두 서비스의 상태를 점검하고 실패 시 로그를 출력한 뒤 정리합니다.
검증 순서와 영수증 상태
.github/workflows/opencode-commercial-development.yml, packages/commercial-development-agent/src/workflow-contract.test.mjs, packages/commercial-development-agent/vitest.config.mjs, docs/operations/..., CHANGELOG.md
소스 검증과 Compose 검증 결과를 별도로 수집합니다. 모델 카탈로그 실패를 invalid_configuration으로 기록합니다. 영수증에 각 검증 단계의 상태를 기록하고 관련 로그를 정리합니다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant OpenCodeWorkflow
  participant NVIDIAModelCatalog
  participant CredentialBridge
  participant TrustedComposeValidation
  participant PostgreSQL
  participant NATS
  OpenCodeWorkflow->>NVIDIAModelCatalog: 명시적 모델 카탈로그 검증
  NVIDIAModelCatalog-->>OpenCodeWorkflow: 검증 결과 반환
  OpenCodeWorkflow->>CredentialBridge: 성공 시 credential bridge 시작
  TrustedComposeValidation->>PostgreSQL: 컨테이너 기동 및 쿼리 점검
  TrustedComposeValidation->>NATS: 모니터링 엔드포인트 점검
  TrustedComposeValidation-->>OpenCodeWorkflow: Compose 검증 결과 반환
  OpenCodeWorkflow->>OpenCodeWorkflow: 영수증 상태 기록
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 명시적 모델 카탈로그와 Compose 런타임 검증이라는 풀 리퀘스트의 핵심 변경을 정확하고 간결하게 설명합니다.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/opencode-model-compose-runtime

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.

Copy link
Copy Markdown
Contributor Author

@opencode-agent Repair PR #133 on exact head 5297a5ac18d55def32739f4799b9a4679db746b1 only. RCA from exact-head AppGuardrail run 31313284703: the scanner reports deploy-blocking hardcoded-api-credential / hardcoded-generic-secret findings at packages/commercial-development-agent/src/workflow-contract.test.mjs around the real OpenCode catalog probe because the test embeds the literal local-loopback-placeholder directly in provider.nvidia.options.apiKey and NVIDIA_API_KEY. This is synthetic loopback probe material, but committed secret-shaped literals are still a valid repository security-contract defect.

Fix the root cause without suppressing AppGuardrail or weakening the real OpenCode probe: construct a deterministic non-secret loopback probe value at runtime from separate trusted fragments (or another scanner-safe deterministic composition), reuse that variable for both OpenCode config apiKey and NVIDIA_API_KEY, and keep the existing assertions that the pinned OpenCode binary resolves exactly nvidia/cwl/contract-probe-model-v1 with models fetch/project config disabled. Add/adjust the narrow regression contract so the test source itself no longer embeds a credential-like literal while the probe still receives a non-empty synthetic key. Do not change provider authority, /v1/models policy, repository secrets, Docker authority, branch protection, or unrelated files.

Run the focused workflow-contract test, commercial-development-agent suite/coverage as appropriate, root formatting, and AppGuardrail-compatible static verification. Before committing, verify the branch is still exactly the expected head; if it moved, stop rather than overwriting concurrent work. Commit only the bounded causal repair to this branch and report the resulting exact head/evidence.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@packages/commercial-development-agent/src/workflow-contract.test.mjs`:
- Around line 228-260: Update the test setup around the `config` JSON and
`spawnSync` invocation to write the generated configuration to the
`$MODEL_HOME/opencode.json` location used by the operational `OPENCODE_CONFIG`
path, then invoke the CLI through that file-based configuration instead of
`OPENCODE_CONFIG_CONTENT`. Explicitly assert the generated `loopbackProbeValue`
is non-empty and reuse that exact value for both
`provider.nvidia.options.apiKey` and `NVIDIA_API_KEY`, with no credential-like
literal values embedded in the test.
🪄 Autofix

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e0c8b00d-91e6-455b-bc42-41574fb9fcaa

📥 Commits

Reviewing files that changed from the base of the PR and between 8768500 and 2b339bc.

📒 Files selected for processing (11)
  • .github/workflows/ci.yml
  • .github/workflows/opencode-commercial-development.yml
  • ARCHITECTURE.md
  • CHANGELOG.md
  • compose.yaml
  • docs/operations/opencode-commercial-development-loop.md
  • docs/research/2026-08-07-opencode-commercial-development-loop-standards.md
  • docs/superpowers/plans/2026-08-07-opencode-commercial-development-loop.md
  • docs/superpowers/specs/2026-08-07-opencode-commercial-development-loop-design.md
  • packages/commercial-development-agent/src/workflow-contract.test.mjs
  • packages/commercial-development-agent/vitest.config.mjs

@seonghobae
seonghobae merged commit 38dde3f into main Aug 9, 2026
32 checks passed
seonghobae added a commit that referenced this pull request Aug 9, 2026
…134)

* test(identity): define durable authentication-age provenance

* feat(identity): preserve authentication instant in session lifecycle

* feat(identity): expose credential-free authentication age

* feat(identity): persist session authentication provenance

* feat(identity): migrate session authentication age

* test(identity): cover persisted authentication age

* test(identity): prove authentication age survives PostgreSQL rotation

* fix(readiness): separate canonical buyer gaps from capability maturity (#131)

* test(readiness): define canonical buyer-gap registry contract

* feat(readiness): evaluate canonical buyer-gap evidence

* feat(readiness): register canonical buyer-visible gaps

* feat(readiness): attach canonical buyer-gap evidence

* feat(readiness): add live buyer-gap audit entrypoint

* fix(readiness): render capability and buyer gaps separately

* build(readiness): verify buyer-gap audit modules

* ci(readiness): reconcile canonical buyer-gap state

* test(readiness): cover bounded buyer-gap collection

* test(readiness): verify separated buyer-gap reporting

* test(readiness): verify buyer-gap CLI boundary

* test(readiness): harden buyer-gap snapshot validation

* test(readiness): preserve capability maturity under buyer-gap evidence

* fix(readiness): bind audit evidence to exact PR head

* test(readiness): require exact-head PR audit checkout

* style(readiness): format buyer-gap renderer

* test(readiness): assert canonical buyer-gap exhaustion failures

* test(readiness): reject coerced buyer-gap timestamps

* docs(readiness): explain capability and buyer-gap report contract

* test(readiness): reject non-string buyer-gap timestamps

* fix(readiness): require string buyer-gap timestamps

* fix(agent): verify explicit model catalog and Compose runtime (#133)

* fix(agent): verify model and compose runtime

* fix(ci): use supported Compose exec TTY flag

* fix(agent): allow bounded OpenCode catalog probe runtime

* test(agent): avoid secret-shaped catalog fixtures

* test(agent): generate an ephemeral catalog credential

* test(agent): derive non-secret catalog probe value

* test(agent): exercise operational OpenCode config path

* fix(identity): preserve legacy session authentication lineage

* test(identity): prove legacy authentication-age migration

* fix(identity): narrow callback session dependency

* test(identity): isolate migration regression as test code

* test(identity): move migration regression under tests

* test(readiness): reject malformed buyer-gap evidence

* docs(readiness): explain buyer-gap renderer contracts

* test(identity): require staged authentication-age validation

* fix(identity): stage authentication-age constraints before validation

* fix(identity): finalize validated authentication-age constraint

* test(identity): verify staged authentication-age finalization

* fix(readiness): validate buyer-gap evidence boundary

* test(identity): reject cross-boundary rotation lineage

* test(identity): align invalid lineage cases with existing tenant FK

* test(identity): keep migration policy regressions out of app-code scan

* test(identity): remove migration contract from production source

* test(identity): remove dynamic SQL from migration fixture

* test(identity): clarify staged authentication migration assertions

* test(identity): normalize migration layout before assertions

* test(agent): resolve installed OpenCode through pnpm exec

* test(identity): use neutral disposable database name

* test(identity): serialize migration fixture database

* test(readiness): reject malformed buyer gap items

* chore(agent): restore protected-main workflow contracts

* fix(readiness): validate attached buyer gap evidence

* test(identity): always release migration fixture lock

* docs(readiness): document buyer gap validation helpers
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.

2 participants