fix(server): wait for plugin readiness before session.permission.create - #210
Merged
Merged
Conversation
The default agent's permission ruleset (e.g. the *.env -> ask rule) is registered by AgentPlugin/ConfigAgentPlugin in a forked, non-blocking fiber right after a location boots (PluginInternal.Service). A permission check that races a freshly-created session can observe an empty agent registry and fall back to deny-all instead of the real ruleset, causing v2.session.permission.create to intermittently return effect: "deny" instead of "ask" under the real Effect runtime (--mode effect in the httpapi exercise). Await PluginInternal.Service.ready (bounded, 5s timeout) before calling permission.ask(...), mirroring the same pattern already used in session/prompt.ts and the provider httpapi handler for this class of race. Closes #209 Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
On 2-vCPU Windows CI runners (windows-latest), running 5 parallel Chromium browsers under load caused extreme CPU starvation during Shiki WASM Web Worker compilation and diff rendering. As a result, element visibility assertions in specs like session-timeline-file-projection.spec.ts took 8-12s, hitting the 10s expect timeout and causing chronic flaky failures (#189). Scale workers on Windows CI to 3 to alleviate CPU starvation, and increase expect timeout to 25s (and test timeout to 90s) on Windows to provide adaptive headroom per packages/app/e2e/AGENTS.md guidelines.
…prompt test timeouts - PR #211 merged new memory routes (/memory/global, /memory/project/entries, /memory/entry, /memory/promote) without scenarios in test:httpapi, causing exerciser failure. Added all 4 scenarios. - Widen tight 10s subprocess timeout to 30s in two prompt shell-loop tests observed timing out at ~10,020ms on Windows CI under heavy load (#193).
…ts on windows - In instance-bootstrap.test.ts, provide explicit 120s timeout budget for instance bootstrap tests that initialize full instances and git repos to avoid Windows CI load timeout near 60s (#193). - In prompt.test.ts, mark 'sleep 0.2' shell tests as unix-only via unix() wrapper, matching other shell tests in the same file.
Investigando ao vivo (mobile não mostrava um projeto com sessão recente): confirmei que um repo git sem commit/remote resolve pra ID.global de propósito (já coberto por "should handle git repository with no commits"), e que fromDirectory já tem a lógica de resgate certa (UPDATE session SET project_id=novoID WHERE project_id='global' AND directory=<esse diretório exato>) assim que o repo ganha um commit — sem afetar sessões não relacionadas em outros diretórios que também estão em "global". Não havia nenhum teste cobrindo esse caminho específico (só o caso análogo via remote, em "migrates cached root project data..."); este cobre a promoção a partir do literal ID.global. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This was referenced Sep 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #209
Resolves #189, #193, #163
Summary of Fixes
1. Fix #209 (v2.session.permission.create race)
AgentPlugin/ConfigAgentPluginruns in a forked, non-blocking fiber right after location boot. A permission check racing a freshly-created session observes an empty agent registry, falling back to deny-all (effect: "deny"instead of"ask").PluginInternal.Service.ready(bounded, 5s timeout) insession.permission.createHTTP handler before callingpermission.ask(...).2. Fix e2e (windows) load contention (#189)
session-timeline-file-projection.spec.tsremained 0-height for 8-12s, hitting the 10s expect timeout and triggering cascading retries with heavy video/trace capture that exceeded the 60s teardown limit.packages/app/playwright.config.ts, and set adaptive headroom (expect.timeout: 25_000, test timeout90_000) perpackages/app/e2e/AGENTS.mdguidelines.3. Fix missing httpapi scenarios from PR #211
GET /memory/global,GET /memory/project/entries,POST /memory/entry,POST /memory/promote) without exerciser scenarios, failingtest:httpapionunit (linux).packages/opencode/test/server/httpapi-exercise/index.ts.4. Fix Windows unit test timeouts and shell compatibility (#193, #163)
command: "sleep 0.2"usingit.instanceinstead of theunixwrapper.unixwrapper inprompt.test.tsmatching other shell tests in the file.instance-bootstrap.test.ts.eventuallyEffectinworkspace.test.tshad a 1500ms timeout, too tight for SSE workspace sync under load.Verification (All CI Checks 100% Green)