Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (codex): a UI process bare PORT also serves devUi edits

Adam Eivy2a858abc42cb
diff --git a/server/services/streamingDetect.js b/server/services/streamingDetect.js
index 5d046bd71b..d21e7a93ed 100644
--- a/server/services/streamingDetect.js
+++ b/server/services/streamingDetect.js
@@ -627,7 +627,10 @@ function rewriteLabelInBlock(block, label, oldP, newP, processName = '') {
// PM2 launches with it, so it must track the label's port. NOT for a ports
// REFERENCE block: there the parser reads the external const and ignores env,
// so rewriting the bare PORT would be a false-success runtime-only change.
- const barePortIsThisLabel = barePortLabel === label;
+ // A UI process's bare PORT serves BOTH `ui` and `devUi`: when an API sibling
+ // exists parseEcosystemConfig relabels that parsed ui port to devUi, so a
+ // devUi edit on a UI-named process targets the same bare PORT.
+ const barePortIsThisLabel = barePortLabel === label || (barePortLabel === 'ui' && label === 'devUi');
const rewriteBarePort = barePortIsThisLabel && !hasPortsReference;
if (label === 'api') {
diff --git a/server/services/streamingDetect.test.js b/server/services/streamingDetect.test.js
index e0b05678d5..0a1a27ff4e 100644
--- a/server/services/streamingDetect.test.js
+++ b/server/services/streamingDetect.test.js
@@ -576,6 +576,23 @@ module.exports = { apps: [
expect(r.content).toContain('PORT: 7000'); // runtime port moves too
});
+ it('rewrites a Vite UI process bare PORT for a devUi edit (parser relabels ui→devUi with an API sibling)', () => {
+ // srv has env.PORT (api); srv-ui has env.PORT 6000 which parseEcosystemConfig
+ // relabels ui→devUi because an API sibling exists. A devUiPort edit on the
+ // UI process must rewrite that bare PORT (its runtime dev UI port).
+ const content = `module.exports = { apps: [
+ { name: 'srv', script: 's.js', env: { PORT: 5555 } },
+ { name: 'srv-ui', script: 'npx vite', env: { PORT: 6000 } }
+] };
+`;
+ const r = rewriteEcosystemPortsByProcess(content, [
+ { processName: 'srv-ui', label: 'devUi', oldPort: 6000, newPort: 7000 },
+ ]);
+ expect(r.applied).toHaveLength(1);
+ expect(parseEcosystemConfig(r.content).processes.find(p => p.name === 'srv-ui').ports.devUi).toBe(7000);
+ expect(r.content).toContain('PORT: 5555'); // api sibling untouched
+ });
+
it('an api (non-UI) process bare PORT is the API port — a ui edit leaves it untouched', () => {
// Bare PORT on a non-UI-named process routes → api. Editing the shared ui
// label must touch ports.ui only, NOT the bare PORT (which is the api port).