Home

mweinbach / agent-coworker

publicmweinbach/agent-coworker
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

fix: restore A2UI session state and tighten desktop flag contracts

6 months ago

c1f4dd3
Authored
mweinbach4/18/2026, 10:25:22 PM
PR #83 still had two real review gaps and a credible CI-stability problem.
The desktop workspace record exposed resolved feature flags through a partial
type, and resumed A2UI sessions rebuilt feed/UI state without rebuilding the
server-side surface manager, so valid resumed actions could fail as
`unknown_surface`. In parallel, the A2UI renderer action test was leaving
browser globals installed across the Bun process, matching the recurring
11-test desktop failure cluster we saw on GitHub Actions.

This commit tightens `defaultFeatureFlags` to the resolved workspace flag type
while preserving partial override inputs for patch APIs, hydrates
`A2uiSurfaceManager` from persisted `ui_surface` feed history on restore, and
moves the renderer-action test onto the shared JSDOM harness so its globals are
restored after each case.

Constraint: Restored session interaction state must agree with the persisted UI/feed snapshot before any new model step runs
Rejected: Keep `defaultFeatureFlags` partial and rely on `resolveWorkspaceFeatureFlags()` at every read site | preserves a misleading contract and future undefined-flag footguns
Rejected: Rebuild resumed A2UI state lazily only after the first new a2ui tool call | still lets valid resumed user actions fail before the model touches the surface again
Rejected: Keep bespoke JSDOM setup in the renderer test and add manual cleanup there | duplicates shared harness logic and keeps test-global drift likely
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Treat persisted desktop/session state as resolved runtime data; keep partial shapes only at mutation/input boundaries and ensure restored interactive managers are hydrated from persisted projections
Tested: bun run typecheck
Tested: bun test test/session.test.ts apps/desktop/test/a2ui-renderer-actions.test.tsx apps/desktop/test/workspace-settings-sync.test.ts apps/desktop/test/providers-page.test.ts apps/desktop/test/usage-page.test.ts
Tested: bun test --max-concurrency 1
Not-tested: GitHub Actions rerun after this commit (push will retrigger CI)
EOF && git push origin codex/a2ui-phase-3-full

Parentdfa8a47

5 files changed
  • apps/desktop/src/app/store.actions/workspaceDefaults.ts+4−2
  • apps/desktop/src/app/types.ts+4−2
  • apps/desktop/test/a2ui-renderer-actions.test.tsx+63−59
  • src/server/session/AgentSession.ts+27−0
  • test/session.test.ts+106−0