Pin the SillyTavern borrow, guards, and context controls #186

Merged
weichen merged 14 commits from feature/sillytavern-review into main 2026-10-04 19:47:06 +00:00
Owner

feature/sillytavern-review 任务卡

任务主记录:Dev #186;状态:进行中;owner:weichen

基线与授权

  • 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 4fd03eee62
  • 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-sillytavern-review(worktree);分支:feature/sillytavern-review
  • 授权与交付终点:调研记录、已核实的安全缺口,以及方案里的批次 A–D 都在本任务实现。完成后推送、建 PR、合入,并在 worktree 内 make task-finish。不拷 SillyTavern 代码或文案。不轮换 Tavily 密钥,只在验收说明里建议轮换。不改认证默认 auto,不加 CSRF token,不加 CSP 上报端点。

目标与非目标

  • 目标:Documents 记录与提案 §2.5;HTML 清洗与安全响应头;来源校验与非回环无认证拒绝启动;密钥独立存储与设置快照;个人指令、会话要求、条件注入、上下文分段估算与消息整形;复制、成组排除、追加式候选回复;用户 / 命令展开成提示词且不自动触发。
  • 契约:Message 增加 excluded / variantGroup / variantIndex。Conversation 增加 sessionNote。ContextObservation 增加 sections 与 prefixHash。新表见 Backend 迁移 v16。设置新增 context.userInstructions、context.contextWindow、context.messageShape。
  • 兼容:反向代理或用主机名从局域网访问时,必须把对外域名写入 allowedHosts,否则未开认证时 Host 校验返回 403。旧设置里的明文密钥在启动时迁入 secret_keys 后从设置 JSON 清除;运行时仍接受尚未迁走的旧字段。
  • 非目标:缓存断点、编辑重发、会话分支、窗口外召回、世界书概率/递归/分组/定时、密钥静态加密、i18n、出站代理、画像导入导出、扩展系统、宏、群聊、角色卡、自定义 CSS、删除消息、自动触发的快捷回复。

同步记录

节点 sync_base_sha tested_head_sha checked_at
启动 4fd03eee62 4fd03eee62 2026-10-04T17:06:46Z

结果与验证(完成后填写)

  • 结果:安全缺口 S1–S4 与批次 A–D 已在本分支实现。子仓 PR 已合入:Documents #37、UI #34、Core #21、Frontend #43、Native #16、Squad #15、Backend #63。Dev 钉住的功能提交是这些合入提交的祖先:core 0b5c774,native 3a110a7,squad 5a57636,ui 6b2589c,frontend eb6502f,documents f3f823e,backend c05832d。
  • 验证:make test 与 make build 退出码 0。config explain --addr 0.0.0.0:8788 显示拒绝启动。serve --addr 0.0.0.0:18799 退出码 1 且不建库。dev 已部署 dev@ae06838,监听 127.0.0.1:8788;/ 带 CSP、nosniff、same-origin。该实例开了认证:跨站 POST 403,无 Origin 的 POST 与 Host: evil.example 为 401。同一二进制的无认证实例上,无 Origin 的 POST 为 201,跨站 POST 403,Host: evil.example 403,127.0.0.1 的健康检查 200,HTML 工件带 sandbox。浏览器:Markdown 预览去掉 script 与 javascript: 链接,外链图片变成「外部图片 · 域名」;docx、xlsx、pdf 与示例插件工作区无 CSP 报错;mock 对话一轮可见复制、排除、重新生成和「约 N token」。
  • 影响与剩余项:Tavily 密钥曾暴露在无认证监听上,建议轮换,本任务不轮换。暂缓项与拒绝项仍不做。pptx 没有可用样例,未单独打开预览。
    | 同步前验收 | 4fd03eee62 | cd6be00141 | 2026-10-04T18:42:56Z |
    | 同步前验收 | 4fd03eee62 | ce55168325 | 2026-10-04T18:45:12Z |
    | 同步前验收 | 4fd03eee62 | ae06838d66 | 2026-10-04T19:45:46Z |
    | 同步前验收 | 4fd03eee62 | 3678f58cd3 | 2026-10-04T19:46:37Z |
# feature/sillytavern-review 任务卡 任务主记录:[Dev #186](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Dev/pulls/186);状态:进行中;owner:weichen ## 基线与授权 - 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= 4fd03eee6230f82464def08f2543adab27aba948 - 工作区:/home/weichen/projects/Agent-System-Dev-wt-feature-sillytavern-review(worktree);分支:feature/sillytavern-review - 授权与交付终点:调研记录、已核实的安全缺口,以及方案里的批次 A–D 都在本任务实现。完成后推送、建 PR、合入,并在 worktree 内 `make task-finish`。不拷 SillyTavern 代码或文案。不轮换 Tavily 密钥,只在验收说明里建议轮换。不改认证默认 `auto`,不加 CSRF token,不加 CSP 上报端点。 ## 目标与非目标 - 目标:Documents 记录与提案 §2.5;HTML 清洗与安全响应头;来源校验与非回环无认证拒绝启动;密钥独立存储与设置快照;个人指令、会话要求、条件注入、上下文分段估算与消息整形;复制、成组排除、追加式候选回复;用户 `/` 命令展开成提示词且不自动触发。 - 契约:`Message` 增加 `excluded` / `variantGroup` / `variantIndex`。`Conversation` 增加 `sessionNote`。`ContextObservation` 增加 `sections` 与 `prefixHash`。新表见 Backend 迁移 v16。设置新增 `context.userInstructions`、`context.contextWindow`、`context.messageShape`。 - 兼容:反向代理或用主机名从局域网访问时,必须把对外域名写入 `allowedHosts`,否则未开认证时 Host 校验返回 403。旧设置里的明文密钥在启动时迁入 `secret_keys` 后从设置 JSON 清除;运行时仍接受尚未迁走的旧字段。 - 非目标:缓存断点、编辑重发、会话分支、窗口外召回、世界书概率/递归/分组/定时、密钥静态加密、i18n、出站代理、画像导入导出、扩展系统、宏、群聊、角色卡、自定义 CSS、删除消息、自动触发的快捷回复。 ## 同步记录 | 节点 | sync_base_sha | tested_head_sha | checked_at | |---|---|---|---| | 启动 | 4fd03eee6230f82464def08f2543adab27aba948 | 4fd03eee6230f82464def08f2543adab27aba948 | 2026-10-04T17:06:46Z | ## 结果与验证(完成后填写) - 结果:安全缺口 S1–S4 与批次 A–D 已在本分支实现。子仓 PR 已合入:Documents [#37](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Documents/pulls/37)、UI [#34](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-UI/pulls/34)、Core [#21](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Core/pulls/21)、Frontend [#43](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Frontend/pulls/43)、Native [#16](https://git-home.u1680832.nyat.app:30319/weichen/Agent-Native/pulls/16)、Squad [#15](https://git-home.u1680832.nyat.app:30319/weichen/Agent-Squad/pulls/15)、Backend [#63](https://git-home.u1680832.nyat.app:30319/weichen/Agent-System-Backend/pulls/63)。Dev 钉住的功能提交是这些合入提交的祖先:core `0b5c774`,native `3a110a7`,squad `5a57636`,ui `6b2589c`,frontend `eb6502f`,documents `f3f823e`,backend `c05832d`。 - 验证:`make test` 与 `make build` 退出码 0。`config explain --addr 0.0.0.0:8788` 显示拒绝启动。`serve --addr 0.0.0.0:18799` 退出码 1 且不建库。dev 已部署 `dev@ae06838`,监听 `127.0.0.1:8788`;`/` 带 CSP、nosniff、same-origin。该实例开了认证:跨站 POST 403,无 Origin 的 POST 与 `Host: evil.example` 为 401。同一二进制的无认证实例上,无 Origin 的 POST 为 201,跨站 POST 403,`Host: evil.example` 403,`127.0.0.1` 的健康检查 200,HTML 工件带 `sandbox`。浏览器:Markdown 预览去掉 script 与 `javascript:` 链接,外链图片变成「外部图片 · 域名」;docx、xlsx、pdf 与示例插件工作区无 CSP 报错;mock 对话一轮可见复制、排除、重新生成和「约 N token」。 - 影响与剩余项:Tavily 密钥曾暴露在无认证监听上,建议轮换,本任务不轮换。暂缓项与拒绝项仍不做。pptx 没有可用样例,未单独打开预览。 | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | cd6be001414759f3ad00cf860ae095b70593e296 | 2026-10-04T18:42:56Z | | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | ce551683256e770d96c18fdaf93df49df4e0e3b1 | 2026-10-04T18:45:12Z | | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | ae06838d66c295d674cee0334ac2a7e9acd1a92f | 2026-10-04T19:45:46Z | | 同步前验收 | 4fd03eee6230f82464def08f2543adab27aba948 | 3678f58cd3b8b3ca48e412c650c6be3befdf04fa | 2026-10-04T19:46:37Z |
weichen added 11 commits 2026-10-04 18:46:27 +00:00
Why: The research record, HTML cleaning, listen guard, secret store, and context controls land together, and the parent pointers have to name those commits.
Evidence: Child commits are core bd63223, agent-native 3a110a7, ui d76a8e6, frontend 36b92ed, documents f3f823e, backend 42cca8f. svc.sh forwards the listen switches and info prints them.
Impact: A reverse proxy or a LAN hostname needs allowedHosts or an unauthenticated host check returns 403. Startup moves raw API keys into the secret table after a settings snapshot.
Refs: .task/feature-sillytavern-review.md
Co-authored-by: Cursor <cursoragent@cursor.com>
Why: The card still had placeholders for authorization, scope, and the compatibility note that reverse proxies need allowedHosts.
Evidence: The card names the new message and observation fields and the items that stay out of this task.
Impact: Reviewers can use the card as the PR description without reconstructing the scope.
Refs: docs/records/2026-10-04-sillytavern-review.md
Co-authored-by: Cursor <cursoragent@cursor.com>
Why: Empty innerHTML clears were flagged because the space matcher could backtrack past the quotes. The child tests now keep that whitespace inside the lookahead.
Evidence: Frontend vitest 78 passed. UI html-sinks passed. Child commits are ui 5f8308a and frontend 02cebc0.
Impact: The parent pins match the ratchet that allows clearing a node before appending sanitized children.
Refs: .task/feature-sillytavern-review.md
Co-authored-by: Cursor <cursoragent@cursor.com>
Why: Dev's agent-native moved for message shaping, so squad and backend have to follow or check-pins fails.
Evidence: Squad 5a57636 and backend include that pin. make test previously stopped at test-pins on this mismatch.
Impact: The parent, backend, and squad all resolve agent-native 3a110a7.
Refs: .task/feature-sillytavern-review.md
Co-authored-by: Cursor <cursoragent@cursor.com>
Why: The listen guard reads auth and host policy from config before the database opens, so app depending on config is a real edge.
Evidence: make test stopped in lint-boundaries on backend/app backend/config. The edge is now in the baseline.
Impact: New imports still fail the ratchet. This one records the startup guard's dependency.
Refs: .task/feature-sillytavern-review.md
Co-authored-by: Cursor <cursoragent@cursor.com>
Why: The shared types dropped a spare export so the knip ratchet stays at its baseline, and every container must name those commits.
Evidence: core 0b5c774, ui 6b2589c, frontend 13a1c63, backend c05832d. UI knip 55 and frontend knip 43.
Impact: Gitlinks move together. JSON field names are unchanged.
Refs: .task/feature-sillytavern-review.md
Co-authored-by: Cursor <cursoragent@cursor.com>
Why: The incremental build info commit has to be the gitlink Dev records.
Evidence: modules/frontend is eb6502f. make build produced bin/agent-system.
Impact: The parent branch names the same frontend commit the worktree built.
Refs: .task/feature-sillytavern-review.md
Co-authored-by: Cursor <cursoragent@cursor.com>
Why: The task card has to name the commits and the gates that already passed before sync.
Evidence: make test and make build exited 0. config explain refuses 0.0.0.0:8788. serve on 0.0.0.0:18799 exited 1 and left no database directory.
Impact: The card still says the work is in progress until the pull requests merge.
Refs: .task/feature-sillytavern-review.md
Co-authored-by: Cursor <cursoragent@cursor.com>
Record the sync checkpoint
ci / test (pull_request) Successful in 1m59s
ae06838d66
weichen added 3 commits 2026-10-04 19:46:40 +00:00
Why: The task card is the pull request description, and it has to name the child merges and the checks that already passed.
Evidence: Documents 37, UI 34, Core 21, Frontend 43, Native 16, Squad 15, and Backend 63 are merged. Dev is still open.
Impact: The card stays in progress until the Dev pull request merges.
Refs: .task/feature-sillytavern-review.md
Co-authored-by: Cursor <cursoragent@cursor.com>
Record the sync checkpoint
ci / test (pull_request) Successful in 1m59s
c65f56fe36
weichen merged commit 090be2404e into main 2026-10-04 19:47:06 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Dev#186