You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "ARE404 (via GitHub)" <gi...@apache.org> on 2026/09/07 23:38:10 UTC
[PR] feat(workhub): restore chat identity and reuse standard composer [maka]
ARE404 opened a new pull request, #5003:
URL: https://github.com/apache/maka/pull/5003
## Summary
WorkHub now reuses the standard Composer with attachments, model and permission controls, with aligned conversation and Composer layouts on wide and narrow screens. Selecting a Work applies configuration to that Work; without a selection, settings become defaults for new Work. Automatically routed existing Work retains its configuration.
Messages show Project / Work identity with a right-side user rail, left-side assistant rail and colored Work metadata. Hovering a message rail, navigation entry or prompt anchor highlights the same Work across the conversation.
Attachment staging supports file-only sends and preserves uploads on retry. Runtime Host validates source ownership and copies attachments into the target Session. Protocol epoch increases from 125 to 126 for the new wire fields.
Refs #3492
## Verification
- 180 tests passed across WorkHub protocol, action gate, routing, IPC and attachment suites. Main run: `tests 179 / pass 179 / fail 0`; the separate real artifact-store test adds one passing test.
- 11 Storybook browser interaction runs passed across light/dark themes and wide/narrow layouts, covering rail hover, navigation filtering, prompt anchors, Composer configuration, file-only sends and failed-send retry. Composer stories verify alignment geometrically and signal completion after all interactions.
- Desktop typecheck, dependency build, main/renderer builds, renderer architecture check, protocol epoch guard and diff whitespace check passed.
- Native Electron whole-app verification remains unverified: startup failed before assertions. Lint and formatting were not separately run.
- Publication only changes branch naming and commit trailers; the source tree matches the locally validated commit e674323b1.
## AI use
- [ ] No generative tool made a substantive contribution
- [x] Generative tooling made a substantive contribution
Tool(s) and scope: OpenAI Codex implemented the changes and validation. Affected commits include `Generated-by: Codex`; retain the trailer when squashing.
## Checklist
- [x] Tests cover the change and fail without it
- [ ] Lint, format, typecheck and the affected suites pass locally
Does this PR entail a change in behavior?
- [x] Yes — described under Summary above
- [ ] No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] feat(workhub): restore chat identity and reuse standard composer [maka]
Posted by "M4n5ter (via GitHub)" <gi...@apache.org>.
M4n5ter merged PR #5003:
URL: https://github.com/apache/maka/pull/5003
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] feat(workhub): restore chat identity and reuse standard composer [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #5003:
URL: https://github.com/apache/maka/pull/5003#discussion_r3953538944
##########
packages/runtime-host/src/server/execution-composition.ts:
##########
@@ -1556,7 +1563,10 @@ export async function createExecutionRuntimeHostComposition(
.digest('hex')
.slice(0, 48);
const messageId = `whm_${suffix}`;
- const content = normalizeMessageContent({ text: input.userText });
+ const targetAttachments = !durable && input.attachments?.length
+ ? await copyWorkHubAttachmentsToTarget(openedArtifactStore, artifacts, input.targetSessionId, input.attachments)
+ : input.attachments;
+ const content = normalizeMessageContent({ text: input.userText, ...(targetAttachments ? { attachments: targetAttachments } : {}) });
Review Comment:
**[P1] Extend the atomic assignment contract for attachment content**
On the normal `delegate_existing/create_new/replace` path, this now puts target-owned attachments into `admission.content`, but [`SqliteSessionMetadataStore.assignWorkHubMessage`](https://github.com/apache/maka/blob/55d492ffac9bd79c7257cb6167ea522e85feefd5/packages/storage/src/sqlite-session-metadata-store.ts#L1763) still compares that content with `normalizeMessageContent({ text: assignment.userText })`. `messageContentsEqual` compares attachments, so every nonempty attachment array causes `Invalid WorkHub assignment identity` before the transaction commits.
Could we extend the existing store invariant to validate the Coordination-source → target-copy attachment relationship, rather than dropping the identity check? A regression through the real assignment store should verify both the source refs in the Coordination link and target refs in the pending Message. The new copy-helper test does not reach this consumer.
<details>
<summary>简体中文</summary>
**[P1] 将附件内容贯通到原子 assignment 契约**
正常 delegate_existing/create_new/replace 路径已把目标 Session 的附件放入 admission.content,但真实 SQLite 存储入口仍将它与纯文字内容比较。messageContentsEqual 会比较附件,所以任何非空附件都会在提交前触发 Invalid WorkHub assignment identity。
建议扩展现有存储不变量,校验 Coordination 源附件与 target 复制引用的合法关系,不直接删除身份校验。回归应经过真实 assignment store,同时验证 Coordination link 的源引用和 pending Message 的目标引用;新增复制 helper 测试没有走到这个消费者。
</details>
##########
packages/runtime-host/src/server/workhub-message-attachments.ts:
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import type { AttachmentRef } from '@maka/core/events';
+import { WORKHUB_COORDINATION_SESSION_ID } from '@maka/core/session';
+import type { InteractiveArtifactStoreWriter } from '@maka/storage/artifact-stores';
+import type { HostArtifactCoordinator } from './artifact-coordinator.js';
+import { WorkHubActionEffectFailure } from './workhub-coordination-action-gate.js';
+
+/** Preserve canonical ownership when a Coordination message is delegated. */
+export async function copyWorkHubAttachmentsToTarget(
+ store: Pick<InteractiveArtifactStoreWriter, 'copyConversationArtifacts'>,
+ artifacts: Pick<HostArtifactCoordinator, 'validateTurnAttachments'>,
+ targetSessionId: string,
+ attachments: readonly AttachmentRef[],
+): Promise<AttachmentRef[]> {
+ const invalid = await artifacts.validateTurnAttachments(
+ WORKHUB_COORDINATION_SESSION_ID,
+ attachments,
+ );
+ if (invalid) throw new WorkHubActionEffectFailure('operation_conflict', invalid);
+ const ids = attachments.map((attachment) => {
+ if (attachment.ref.kind !== 'session_file') throw new Error('Invalid WorkHub attachment');
+ return attachment.ref.relativePath;
+ });
+ const copied = await store.copyConversationArtifacts({
Review Comment:
**[P2] Make the pre-assignment copy replayable**
This is called before the assignment transaction and even before the target's `reserved` check. If copying succeeds and admission then returns `session_busy`, persistence fails, or the Host exits before assignment, retry still sees no durable assignment and calls this again. The existing copy API derives a deterministic destination ID but [rejects an existing destination](https://github.com/apache/maka/blob/55d492ffac9bd79c7257cb6167ea522e85feefd5/packages/storage/src/artifact-store.ts#L429) with `Artifact target already exists`.
This recovery defect remains after fixing the text-only assignment guard. Please make identical copies converge through the existing Artifact ownership/replay seam, coordinated with target admission/deletion, without accepting mismatched content. A “copy committed → assignment interrupted → restart → same action retry” regression should finish with one assignment.
<details>
<summary>简体中文</summary>
**[P2] 让 assignment 之前的附件复制可以重放**
复制发生在 assignment 事务之前,甚至早于目标 reserved 状态检查。复制成功后若 admission 返回 session_busy、持久化失败,或 Host 在 assignment 前退出,重试仍读不到 assignment,会再次复制。现有复制 API 使用确定性的目标 ID,却在目标已存在时报 Artifact target already exists。
即使修复纯文字 assignment 校验,这个恢复问题仍然存在。建议通过已有 Artifact 所有权/重放接缝让相同复制收敛,并与目标 admission/删除协调;内容不一致仍须拒绝。回归覆盖“复制已提交→assignment 中断→重启→同 action 重试”,最终只产生一条 assignment。
</details>
##########
apps/desktop/src/renderer/app-shell.tsx:
##########
@@ -568,7 +566,7 @@ function AppShellContent({
}
: defaultHostConnections.snapshot;
}
- const activeConnectionSnapshot = activeId
+ const activeConnectionSnapshot = workHubActive || activeId
Review Comment:
**[P2] Invalidate the connection projection WorkHub now consumes**
On a normal configuration-change path, WorkHub can be open with no ordinary `ownerActiveId`. It now reads `sessionHostConnections`, but `refreshConnectionProjections` and `handleConnectionEvent` below still skip that projection without an owner. Adding/removing a connection therefore refreshes only the default/new-task projections, leaving WorkHub's model choices stale.
The Coordination lifecycle subscription does not cover this: its availability callback only retries a failed generation, not a healthy resolved one. Please include the active Coordination Host in the existing refresh/event routing. A connection-change regression with WorkHub open and no ordinary active Session should observe the updated choices.
<details>
<summary>简体中文</summary>
**[P2] 让失效事件覆盖 WorkHub 当前读取的连接投影**
正常配置变更路径中,WorkHub 可以在没有普通 ownerActiveId 时打开。这里改为读取 sessionHostConnections,但下面的 refreshConnectionProjections 和 handleConnectionEvent 仍在没有 owner 时跳过它。新增/删除连接只刷新 default 和 new-task 投影,WorkHub 保留过期模型选项。
Coordination lifecycle 的 availability callback 只重试失败代际,不能刷新健康且已解析的 WorkHub。建议把当前 Coordination Host 纳入已有刷新/事件转发;回归覆盖“WorkHub 打开、无普通活动 Session、连接目录变化”。
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org