Repository navigation
Conversation
…codeg-server The desktop app's Tauri `setup` hook and `bin/codeg_server.rs` each carried their own copy of the daemon's startup — the bundled skill installs, the chat-dir GC, the delegation broker and its tool configs, the persisted settings, the delegation listener, the chat channels, the LifecycleSubscriber, the pet state mapper, the idle and office-watch sweeps, the automation and work-task engines, config sync, the Codex model list refresher — kept in step by "mirrors lib.rs setup" comments. Move those steps into `src-tauri/src/boot.rs`, which both hosts call in the same order. `boot` does not depend on Tauri: events go out through `EventEmitter`, and the native pieces (browser tabs, computer use) are handed in by the host. What only one host has stays where it was: the tray, windows, deep links, close behavior, pet panel, embedded web server and binary-cache startup sweep on the desktop; the listener, token, proxy-JWT, computer-use opt-in and upload staging purge in the server. No HTTP/WS API change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
The desktop app's Tauri
setuphook (src-tauri/src/lib.rs) andsrc-tauri/src/bin/codeg_server.rseach start the same daemon with their own copy of the steps, kept in step by hand throughmirrors lib.rs setup/mirrored in bin/codeg_server.rscomments. That is easy to get out of sync: a new background service has to be added in two places, in the right order relative to the delegation broker and the persisted settings, in two different styles (Tauri managed state vs.AppStatefields).This PR moves the shared steps into a new
src-tauri/src/boot.rsand has both hosts call it. Pure refactor, no HTTP/WS API change.bootAPICalled in this order by both hosts (the module doc lists it too):
spawn_startup_housekeeping(conn, data_dir, emitter): periodic scratch-dir sweep, bundled expert and science skills, orphaned chat-dir GC, worktree-folder alias backfill.DelegationStack::build(cm, conn, data_dir): the broker, token registry, socket path and the per-tool runtime configs as named fields (the 9-tuple fromapp_state::build_delegation_stack).apply_persisted_settings(conn, cm, &stack).await: terminal settings, the delegation / feedback / question / session-info / chat-authoring / browser-tools / computer-tools switches, the generative-UI skill.start_delegation_service(&Daemon, browser, computer): the host passes itsBrowserToolAccess/ComputerToolAccess(native tabs and the screen on desktop;NoBrowserTabsand the optionalCODEG_COMPUTER_USEservice on the server).start_chat_channels(&Daemon):install_chat_channel+start_background; returns a'staticfuture, which the desktop spawns and the server awaits before binding (as before).spawn_daemon_services(&Daemon) -> DaemonServices: LifecycleSubscriber, pet state mapper, ACP idle sweep, office-watch sweep, automation engine, work-task engine + forge auto-processing, config-sync uploader, Codex model list refresher.DaemonServices::stop()releases the office-watch previews at exit (what both hosts called directly before).Daemon<'a>is a borrowed view of what both hosts own (DB connection, data dir,ConnectionManager,ChatChannelManager, broadcaster, event bus,EventEmitter, pet state, the delegation stack). Nothing inbootdepends on Tauri.What only one host has stays where it was:
codeg-cliservice with the desktop opener, embedded web server auto-start, deep links, window restore,mark_served;CODEG_COMPUTER_USE, upload staging purge, listener, port bridge,codeg-cliservice/access.Order changes
All of these only move where a background task is spawned; none of the moved tasks waits on the others.
codeg-cliservice and the embedded web server auto-start instead of after.AppStateis built instead of before; the skill installs before the delegation listener instead of after; terminal settings are applied before the tool switches instead of after;cli_runs.spawn_background()runs after the work-task engine instead of between it and the automation engine.Testing
Testworkflow, all 9 Rust cells on Linux / macOS / Windows plus the frontend job): https://github.com/Tinghecui/codeg/actions/runs/42279754798🤖 Generated with Claude Code