Cube stores snapshots in the same template store as GET /templates, so
skill-image generations leaked into the settings picker. Subtract
ListSnapshots (and snap- IDs) so the step only offers base templates.
The host skills/preloaded tree is not what execute_skill_script finds
inside the sandbox, so stop merging it into the agent's advertised set.
Seed install files as a tar, publish transcript locators before the copy,
and wait in the UI instead of 404-polling.
Give sandbox shell calls a display_type and keep stdout/stderr on the
live payload so the timeline can show the command, exit code, and
streams instead of the generic raw-output fallback.
Updated documentation across multiple files to specify that the `source` for skill installation must be explicitly defined as `@owner/slug` for ClawHub or a full URL for GitHub/SkillHub. Bare `owner/slug` is now rejected as ambiguous. This change enhances clarity for users regarding valid input formats and improves error handling in the installation process.
Updated the skill installation process to eliminate the need for a token when installing skills from ClawHub, SkillHub, or Git URLs. The source must now be readable anonymously, ensuring that no credentials are sent during the fetch process. Adjusted related documentation and UI components to reflect this change, enhancing the user experience by simplifying the installation workflow.
* fix(sandbox): skip identical skill installs and prune old snapshots
Re-uploading the same archive of a ready skill was still booting a billed sandbox and growing a new generation. Superceded snapshots also accumulated on the provider because the ledger never deleted them.
Skip the rebuild when the digest already matches a skill still in the live image, and let the reaper delete superseded provider snapshots after 24h while leaving extras not in the ledger untouched.
* fix(sandbox): retry stale same-zip installs and prune active leftovers
A re-upload of the same archive skipped every installing row, so a dead process could not recover until the reaper. Skip only recent in-flight runs, still refresh the stored bundle, and prune non-live active snapshots after retention.
* fix(sandbox): beat install liveness and guard the snapshot prune
A fixed window on the submission time cannot tell a slow install from a
dead one: a single agent command may take installCommandTimeout and an
install runs several of them, so a two-minute window called live runs
dead, reset their progress and pushed the reaper's own deadline out.
Stamp InstallingSince while the run works and read that instead, which
also stops the reaper from failing installs that are merely long.
Answer the skip question from the image only for a ready row. The ledger
records which skill a snapshot carries, not which archive, so a row
installing a new bundle would look finished from the previous bundle's
snapshot and report a success that never happened.
Prune now refuses to delete once the credentials no longer address the
account that built the image: the delete would come back not-found, and
the ledger would record another account's still-billed snapshots as
gone. It also waits for an eligible row before building a provider
client, since most configs have nothing to prune on most sweeps.
* ui(sandbox): rename settings to code sandbox and simplify cards
"Sandbox backend" leaked implementation jargon into the settings nav.
Call the page what users configure — an isolated runtime for skill
scripts — and only surface incomplete-config warnings on the cards.
* fix(sandbox): type the card overflow menu options
vue-tsc rejected pushing a themed delete item onto an untyped options
array; name the option shape so the menu still marks delete as danger.
* fix(sandbox): keep the editor wizard moving into skills
Saving on the runtime step used to close the drawer when editing, so
step 4 was only reachable from the rail. Continue after save, move
full verification off the runtime form, and stop treating "using the
base template" as the empty value for every image field.
* fix(sandbox): store skill bundles on the workspace default backend
Skill install passed a stub tenant with no default storage, so saving
the zip failed with empty provider and the 500 hid the real cause.
* ui(sandbox): regroup skill install and rename to skill sandbox
Show install vs installed groups, fold long descriptions in the list,
and call the settings surface a skill sandbox.
* ui(sandbox): show skill install transcript in a compact popup
Keep the card from growing; the run opens beside the history button
with a capped height and its own scroll.
* ui(sandbox): show installed skills on config cards
Cube/E2B tiles now list skill names so the list reads as skill sandboxes; a click opens the editor on the skills step.
* ui(sandbox): show finished skill installs as static history
A completed run already has durable messages; replaying the event log would animate the whole install again. Hide chat answer actions in this transcript.
* style(frontend): enhance compact skill timeline display with improved font sizes
Updated the CSS for the compact skill timeline to adjust font sizes for various elements, ensuring better readability in the popup interface. This includes specific adjustments for embedded agent streams and markdown content.
* ui(sandbox): refactor header structure in SandboxConfigEditorDrawer and SettingDrawer
Updated the header structure in both SandboxConfigEditorDrawer and SettingDrawer components to improve layout and organization. Added a new slot for extra header content in SettingDrawer and adjusted CSS for better alignment and spacing in both components.
* ui(sandbox): enhance skill loading feedback and improve deep check logic
Updated the SandboxConfigEditorDrawer to refine the logic for deep checks based on the current step. Enhanced the SkillInstallTimeline component to manage in-flight live loops and provide better feedback for skill loading failures. Adjusted the SandboxSettings view to display error messages for failed skill loads, ensuring users are informed of any issues during the skill installation process.
* feat(sandbox): enhance skill management in sandbox configurations
Updated the skill management system to allow listing, installing, and removing skills within sandbox configurations. The ListSkills function now accepts a sandboxConfigID to filter skills based on the selected configuration. Introduced a new SandboxSkillsDrawer component for managing skills through the UI, along with necessary updates to the API and localization files to support these features.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix: keep skill maintenance sessions out of the console session list
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: store and expose the installer transcript locators
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: record the skill installer agent's conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: stream and persist the installer transcript during a skill install
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: expose install transcript locators on the skill type
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: add the floating skill install transcript window
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat: open the install transcript from the sandbox skills drawer
Co-authored-by: Cursor <cursoragent@cursor.com>
* feat(sandbox): 重构技能安装体验,支持内联时间线、编辑第4步及保留镜像指针
- 替换右下角浮窗为内联安装时间线 (SkillInstallTimeline.vue)
- 新增 GET /api/v1/sandbox-configs/:id/skills/:skillId/transcript 接口,支持回放与追尾
- 移除 /sessions/continue-stream 依赖,避免 404 问题
- 事件日志以 install_prompt 开头,不再将工具调用 preamble 拼入最终答案
- 删除 SkillInstallTranscript.vue,技能条目下可展开/折叠时间线
- 编辑向导新增第 4 步「管理技能」
- Cube/E2B 环境:连接 → 模板 → 运行配置 → 技能(第4步)
- Docker/Local 环境:无第4步(无快照镜像)
- 首次创建必须按 1→2→3 顺序,第3步保存成功后自动进入第4步
- 已有配置支持步骤条数字跳转,可直接访问任意步骤
- 卡片菜单「管理技能」打开同一抽屉并定位至第4步
- SandboxSkillsDrawer.vue 重命名为 SandboxSkillsPanel.vue,去除独立抽屉壳
- 修复保存运行配置时冲掉 skill_image 的问题
- 顶部展示信息(基础模板/快照ID/版本/构建时间)读取 config.skill_image
- 编辑器保存 payload 不再包含 skill_image,合并时保留已有 SkillImage 和 VolumeMount
- MergeSandboxConfigForUpdate 增加对 SkillImage 和 VolumeMount 的保护
- 已冲掉的配置需重新安装技能才能恢复镜像指针
- 「查看安装过程」在安装开始时即显示
- 技能列表中出现「正在安装」状态即展示按钮
- 若记录尚未写入,展示等待提示并自动重试,避免误报「没有留下记录」
* 沙盒内技能目录从 UUID 改成 SKILL.md 的 name。
* fix(sandbox): heal stuck skill rows and block planted maintenance sessions
The reaper left a mid-upgrade install spinning forever when the old snapshot was still live, and restored removals to ready after the pointer had already moved. Client session create/update can no longer hide chats behind the skill_maintenance: prefix.
* style: gofumpt the skill reaper test stubs
* style: satisfy golangci on the tenant skill admin API
* feat(sandbox): rebuild skill images at turn boundaries, not mid-exec
Hold a session turn lease through AgentQA so an install cannot tear down
the live sandbox between tool calls; the next turn's first resolve picks
up the new image. Configs can instead keep existing sandboxes and boot
the new snapshot only for new sessions.
* fix(sandbox): judge stuck skill runs from the snapshot chain
InstalledSnapshotID only records the generation that installed a skill; later
installs of other skills advance the live pointer without rewriting older rows.
Comparing those IDs made the reaper fail healthy installs and delete live
skills whose removal had stalled.
---------
Co-authored-by: hailongzhao <hailongzhao@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
A queued remove or a failed older install could stamp or delete a row a
re-upload already claimed, and an empty MCPSelectionMode handed the root
installer every tenant MCP tool. Fail closed on those races, pin the
installer surface, and refuse a missing bundle or leftover zip files.
Abort a queued install if the skill row was removed or superseded, refuse to
restamp a snapshot with a rotated provider fingerprint, and honor the workspace
sandbox kill switch before creating a maintenance session.
Introduce the hidden skill-installer agent and TenantSkillService so a
sandbox config can install or remove skills into snapshot images under a
per-config lock, without yet exposing HTTP or UI entry points.
Co-authored-by: Cursor <cursoragent@cursor.com>
The settings form rebuilds the payload without skill_image, so merge
must ignore client values or a save would drop the snapshot (and a
crafted PUT could plant one). Also reject skill names that escape
the image root and require SupportsSnapshots on the snapshot manager.
Give Cube/E2B a shared snapshot API and persist skill image pointers so later session sandboxes can inherit installed skills from a config snapshot instead of the base template.
Co-authored-by: Cursor <cursoragent@cursor.com>
Accumulate token usage across every LLM round of an agent turn and
expose the aggregate everywhere a turn is observable:
- AgentState.TurnUsage accumulates each round's reported usage,
including the final-answer synthesis call; TokenUsage.Accumulate
keeps the cache counters as prompt subsets and recomputes the
combined cache status (unsupported survives only while every call
was itself unsupported).
- The agent completion event carries the aggregate, and the complete
stream event exposes it both as data.usage and as a typed
StreamEvent.Usage that buildStreamResponse promotes into the
previously-unused StreamResponse.Usage wire field.
- The assistant message persists it as a nullable usage column on
both migration targets (postgres 000085 jsonb, sqlite 000012 text),
for web and IM channels alike, so history reads still carry the
turn's cost after the live stream is gone.
- "[LLM Usage]" log lines gain ", session_id=..., principal=type:id"
when the context carries them; calls outside sessions stay
byte-identical.
Usage from failed retry attempts is not accumulated: the per-call
usage log remains the ground truth, while the turn aggregate serves
as the operational signal.
GORM hydrates default:true back onto the struct during Create, so the HTTP
201 body (and a later Update on the same pointer) could disagree with the
row just written.
* feat(types): add AdminCreateUserRequest for system-admin user creation
Password un-tagged so an empty value reaches the service and triggers
OIDC-style random-password generation.
* feat(system-admin): scaffold POST /system/admin/users/create endpoint
- Handler skeleton under the SystemAdmin()-guarded group
- Binding and validation live (400); happy path 501 until the
service logic lands
- Response type declares the once-only generated_password contract
* test(system-admin): contract tests for user creation
- Create/audit/generated-password cases assert the final contract
and are intentionally red against the 501 stub
- Binding and trim validation cases already pass
- Adds the system.user_created audit action as the audit contract
* feat(frontend): add createSystemUser API wrapper
Mirrors promote/revoke/reset-password conventions, including the
once-only generated_password contract on the response type.
* fix(system-admin): never rewrite password; re-check trimmed username
- Handler no longer trims the password: whitespace is part of the
credential, hashed byte-for-byte (mirrors auth.go Register)
- Trimmed username re-checked to 2-50 runes (binding ran on the
raw JSON)
* feat(service): implement AdminCreateUser with random-password fallback
- Empty password: OIDC-style crypto/rand generation, returned once
- Explicit password: must satisfy the 8-32 letter-and-number policy
- Delegates to Register: duplicate checks, tenant provisioning and
Owner membership bootstrap match public registration
* feat(system-admin): implement create-user handler
- Resolves tenant mode from the shared auth.default_tenant_mode
policy (single source for registration and admin creation)
- Emits system.user_created audit without the plaintext password
- 201 + once-only generated password; 400 for policy/duplicate,
500 for internal failures
* test(service): whitespace-only password must be rejected
- All-whitespace password: ErrPasswordPolicy, nothing persisted
(matches AdminResetPassword); only truly empty triggers generation
- Red against the current TrimSpace-empty check
- Handler test drops the whitespace-only 201 expectation, keeps
byte-for-byte pass-through for spacey valid passwords
* fix(service): treat only a truly empty password as generate-request
Generation now triggers only on the empty string; whitespace-only
input is rejected by the 8-32 policy like AdminResetPassword.
* fix(service): regenerate until the generated password passes policy
A 32-char base64url draw misses digits ~0.4% of the time and could
400 a creation nobody picked a password for; regenerate until the
policy passes (expected ~1.004 draws).
* refactor(system-admin): drop TenantProvisioning from create payload
The value lived both on the request and as the service argument;
keep it only as the argument, mirroring LoginWithOIDC.
* test(system-admin): pin password_generated audit value; cover dupes
- Audit assertions check the exact password_generated boolean
(true generated, false caller-supplied)
- Duplicate mapping table-driven over email and username errors
* feat(system-admin): explicit provide-and-validate password semantics
- Password pointer-typed: absence (or null) triggers random
generation; any provided value, empty string included, is
policy-checked and rejected otherwise
- Service: generation on nil only, all provided values hashed
byte-for-byte
- Tests: empty string -> 400, absent -> generate, nil pass-through
at the handler boundary
- Frontend: document that any provided value is policy-checked
* test(system-admin): merge duplicate rejection tests
Whitespace-only and weak-password rejection tests were structurally
identical, differing only in inputs. Merged into one table-driven
test covering weak, empty, whitespace and whitespace-only values.
* feat(system-admin): idempotent create on duplicate identity
- Register returns typed sentinels ErrUser{Email,Username}Exists
- AdminCreateUser re-queries the existing row, lookup targeted at the
sentinel-named identity (email or username)
- Handler: duplicate sentinels -> 200 + UserInfo with idempotent=true
audit, policy errors stay 400; drops the substring-matched branch
* fix(system-admin): reject partial identity conflicts on user create
Idempotent 200 now requires both email and username to match the existing
row; partial collisions return 409. Align handler identity sanitization and
password docs with nil-or-null generation semantics.
---------
Co-authored-by: wizardchen <wizardchen@tencent.com>
The stuck-row sweep asks the asynq inspector whether a candidate still has
work queued, and treats "nothing queued" as proof the row is orphaned. For
Wiki that question cannot be answered by asynq at all:
- Wiki ingest work is durable per document in task_pending_ops, keyed by
dedup_key = knowledge ID (newWikiIngestPendingOp).
- asynq only receives a per-KB wake-up trigger, whose payload carries
KnowledgeBaseID and no knowledge ID (enqueueWikiIngestTrigger).
- matchesKnowledge() gates on taskTypesForKnowledgeCancel, which
deliberately excludes TypeWikiIngest.
So HasQueuedTasksForKnowledge structurally returns false for a document
whose only outstanding work is a queued Wiki ingest. The sweep then flips a
perfectly healthy 'finalizing' row to 'failed' with "task stuck in
processing", zeroes pending_subtasks_count, and the durable op later runs
anyway — which is how a document ends up failed while present in neither the
dead-letter table nor any visible queue.
Probe task_pending_ops directly before consulting the inspector. A durable
probe error defers every candidate to the next sweep instead of failing them:
wrongly failing a live document is not user-recoverable, waiting one interval
is. The inspector's own fail-safe direction is unchanged.
A nil inspector no longer disables the whole gate, only the transient half.
TestHousekeeping_NoFalseKill_DurableWikiIngestPending reproduces the bug (it
fails on the unpatched sweep); TestHousekeeping_StillRecoversWhenNoDurableOp
guards against the gate becoming a blanket amnesty.
applyMMR recomputed every candidate's redundancy against every
already-selected result on each round, re-tokenizing the selected passages
each time. With C candidates and k selections that is O(k^2) calls to
getEnrichedPassage + tokenizeSimple over full chunk bodies, and the
diagnostic average-redundancy loop afterwards re-tokenizes another O(k^2)
times. Since k defaults to len(candidates), this is quadratic in the number
of results that survive dedup/rerank.
On a knowledge base where ~250 candidates reach the MMR stage this burns
tens of seconds of pure CPU inside every knowledge_search call, and no log
line attributes the time to MMR.
Cache each candidate's running max jaccard against the selected set and fold
in only the newly selected result per round, and reuse the already-computed
token sets for the average-redundancy diagnostic. Tokenization now happens
once per candidate. Selection output is unchanged, including tie-breaking;
the added test pins the new implementation against the previous one over a
deterministic corpus, and a benchmark contrasts the two.
GenerateTitle writes the model completion straight into sessions.title,
which every shipped migration declares as VARCHAR(255). When the model
ignores the "short title" instruction and returns an explanation along with
the title, the follow-up Update fails with SQLSTATE 22001 (value too long
for type character varying(255)) and the session silently ends up with no
title. The error only reaches the log and the answer itself is unaffected,
so the failure is easy to miss.
Trim the reasoning prefix and surrounding whitespace, then truncate to 100
runes - by rune rather than byte, so a multi-byte character is never cut in
half - and log a warning when truncation happens so the prompt can be
revisited.
* feat: support editing document summaries
* fix: address review feedback for manual summary editing
Reset summary edit state when the drawer closes or generation is in
flight, sync summary_status on manual description updates, and add
service tests plus API docs for partial PUT behavior.
* chore: gofmt client/initialization.go for pre-push hook
---------
Co-authored-by: wizardchen <wizardchen@tencent.com>
* fix(hybrid-search): normalize MatchCount once instead of at the truncation site
An omitted match_count deserializes to Go's zero value, which reached the
truncation step in HybridSearch and sliced the deduplicated chunk list to
[:0] — a successful retrieval returned an empty result set. A negative
value panicked on that same slice bound and surfaced as a 500.
Resolve the value once at the top of HybridSearch via normalizedMatchCount
so all three consumers agree, rather than patching the truncation site
alone: the over-retrieval floor, the FAQ iterative-retrieval trigger
(which never fired on this path because len(chunks) < 0 is false), and the
truncation itself.
Bound the FAQ iterative path while here, since normalization is what makes
it reachable with a large MatchCount: its TopK seeds from MatchCount*3 and
doubles five times, previously without limit. It now stops at the pool cap
instead of re-issuing an identical query.
Co-authored-by: Cursor <cursoragent@cursor.com>
* refactor(retrieval): share the default retrieval depth as one constant
The value 50 was written three times — the over-retrieval floor in
HybridSearch, the MatchCount fallback added alongside it, and
RetrievalConfig.GetEffectiveEmbeddingTopK — with nothing recording that the
three are meant to agree. Anyone tuning one would silently desync the
others.
Promote it to types.DefaultRetrievalTopK. No behavior change.
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: drakezhang <drakezhang@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
AppendWithOverlap deduplicates chunker-prepended table headers by
matching a suffix of acc against a head window of next. When chunks are
strictly contiguous (positionOverlap == 0) there is no overlap to
deduplicate, but the loop still ran. If a sentence at the tail of acc
reappeared as real content inside next's head window (same sentence
written multiple times in the document), the head of next was mistaken
for a prepended header and deleted — silently losing up to hundreds of
bytes from the merged result.
This affects three callers:
- chat_pipeline.mergeOverlappingChunks: RAG search results returned
to the LLM with truncated content
- wiki_ingest.reconstructContent: distillation text fed to the LLM
is truncated, so wiki search returns 0 hits for present content
- frontend doc-content.vue port: the "merged" document view drops
the same segment
Fix: skip text matching when positionOverlap <= 0 and concatenate
verbatim. The chunker's prepended-header case only occurs inside the
overlap region (positionOverlap > 0), which still runs the loop.
Add a regression test covering a compliance-doc scenario where a
logging-requirement sentence recurs in a later Compliance section.