ci: sandbox-note fixture depends on ambient provider credentials
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
- Domain
- testing
Research direction
Start with tests/worker-sandbox-note.test.ts, especially its beforeEach, expectedNote, and piTurnContext setup, then inspect the exact-note assertions for the three existing cases. Make the fixture control and restore the relevant credential environment entries so ambient variables cannot change notes expected to contain no keys. Run the focused offline test command with an empty environment and controlled fictional values; done means both controls pass while the existing assertions remain intact.
Written by the indexing model from the issue text.
Description
Out of scope
- Do not change product provider-credential admission, generated note semantics, isolation, offline guards or test deadlines.
- Do not repeat the wide import-graph sweep to hide this fixture failure.
Context
The single wide preflight for #2747 on ada2e1767626ef6f4e8fa7ef50784998988eaa5c completed 626 distinct file reports (all 464 historical reference files plus 162 current additions), but failed two cases in tests/worker-sandbox-note.test.ts: PI_INIT_NOTE and GOVERNED_PI_INIT_RESOLVED_NOTE. The expected Secrets paragraph says the worker holds no provider keys; pi's actual paragraph names the admitted OPENAI_API_KEY and OPENROUTER_API_KEY variables. No credential values are needed to reproduce it.
The fixture sets HOME and the pi agent directory but does not establish its intended provider environment (beforeEach, tests/worker-sandbox-note.test.ts:32-46). Its expected note omits provider keys (expectedNote, tests/worker-sandbox-note.test.ts:55-61), while the pi helper opens a session using the ordinary host environment (piTurnContext, tests/worker-sandbox-note.test.ts:85-129). The production path computes the kept credentials (providerKeys, packages/ui-backend-pi/src/worker-session.ts:200-200) and includes them in the note (sandboxNote, packages/ui-backend-pi/src/worker-session.ts:230-232).
Focused offline controls on the same unchanged source: removing the five ambient provider variables used by this environment gives 3 passes; setting only OPENAI_API_KEY and OPENROUTER_API_KEY to the fictional odysseus-offline-sentinel gives 1 pass / 2 failures at those same note assertions. An earlier partial-clear diagnostic retained three other provider variables and also failed; a complete fixture environment is required. The wide command already clears ANTHROPIC_API_KEY, GEMINI_API_KEY and TYPESAFE_API_KEY, so clearing only those does not make this fixture hermetic.
Scope
Make the sandbox-note fixture establish and restore the provider environment relevant to its exact-note assertions. Keep the existing backend-owned new-tail, governed protection/history and staging-cleanup assertions.
Acceptance criteria
- The existing three cases pass with the intended empty provider environment even when the caller sets nonempty provider variables.
- Controlled fictional values for the relevant admitted provider variables prove that ambient state cannot alter an assertion that expects an empty provider list; all changed environment entries restore their original presence and values in teardown.
- Preserve product provider admission and note behavior, offline guards, per-test deadlines, append-only history and every original behavioral assertion.
- A mutation restoring ambient dependence fails the named exact-note assertion; restored focused controls pass.
Verification
Use scripts/test-offline.sh -- bun run test ./tests/worker-sandbox-note.test.ts with an explicitly empty provider environment and then controlled fictional values, retaining both exit codes and named assertions. No network or real provider key is required. Run the required local preflight and affected suites for the eventual repair; no further wide replay is authorized by this issue alone.
Contract impact
None expected. Test-fixture environment ownership only.
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 0
- Avg merge
- 5h 38m
- Merged PRs (30d)
- 960
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from schlessera/brain-kit
-
agent-ready area: ui-server priority: p2 type: test
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
schlessera/brain-kit#2758 ·
Maintainers usually reply within 1 day
-
agent-ready area: ui-react blocked priority: p0 type: fix
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
schlessera/brain-kit#2723 · 1 comment ·
Maintainers usually reply within 1 day
-
agent-ready area: ci area: ui-react priority: p2 type: test
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
schlessera/brain-kit#2615 · 1 comment ·
Maintainers usually reply within 1 day
-
agent-ready area: ci area: docs type: docs
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
schlessera/brain-kit#2612 ·
Maintainers usually reply within 1 day
-
agent-ready area: ui-react priority: p2 type: fix
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
schlessera/brain-kit#2605 ·
Maintainers usually reply within 1 day
All issues in schlessera/brain-kit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
awesome-dsh-plugin/awesome-dsh-plugin#9184 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
farion1231/cc-switch#8829 ·
Maintainers usually reply within 1 day
-
[core-client] Remove unused hand-maintained transport helpers after the definition-table cutoverOpendoc-audit enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100