Skip to content

chore(integration): publish local integration branch as the stacked base for main - #94

Merged
wefio merged 17 commits into
mainfrom
integr/timing-rebase
Oct 20, 2026
Merged

wefio merged 17 commits into
mainfrom
integr/timing-rebase

Conversation

@wefio

@wefio wefio commented Oct 20, 2026

Copy link
Copy Markdown
Owner

变更描述

What(改了什么):把本地积压的 15 个提交推上远端并合入 main,作为另外两个堆叠 PR(事件域、召回词表池)的公共底座。

Why(为什么改 / 解决什么问题):这些工作此前只在本机 integr/timing-rebase,origin/main 停在 91b2238(PR #93)。底座不在远端时,任何功能分支直接对 main 开 PR 都会把 14 个无关提交一起送进去,评审无法分辨。先让底座可见,A/B 两个 PR 才能各自只显示一个提交。

Changes(关键改动点,按文件或模块列出):

  • feat(daemon):受控代码重载与围栏交接;修正 reload 取用与中止调用契约。
  • feat(state):统一 AG 与 board 读写入口。
  • feat(recall) / fix(recall):会话级意图词组试点、补充搜索携带提词、中文回忆问句识别。
  • fix(retrieval):证据上限之前先解词法并列。
  • fix(maintenance):排除不可排空的访问压力。
  • docs(board):事件记录与 Agent 状态契约(实现见堆叠 PR「事件域」)。
  • docs(recall)、docs(experiments):两层保留评估、词法分层闭环、既有事件信号可行性、Google 弱行为信号文献综述。
  • fix(integration):OpenCode 黑板工具按具体 operation 驱动;清理检索章节继承来的冲突标记。

未验证项

Not verified(没验证什么):

  • 本分支末尾的 docs(experiments) 提交只经过 docs:check(384 files / 0 errors / 0 warnings);整条链的代码门禁是在包含它的工作树 feat/unified-recall-pool 上跑出的 agent:verify(fdc02580-bd45-4ff4-8681-9eebc56ee51f,16 项阻断 exit 0)与提交后 clean 门禁(db62134b-7017-4c08-913e-92ec4198c40b),未对 integr/timing-rebase 这个精确 SHA 单独重跑。
  • 两个堆叠 PR(事件域、召回词表池)尚未合并进本分支。
  • 未部署、未重启共享 daemon;真实宿主承载未验收。
  • advisory 套件 verify:research / verify:chaos 未运行。
  • 本分支落后 origin/main 6 个提交,尚未与最新 main 合并或变基。

完成检查项

本地质量检查

  • npm run verify:static 全绿(在包含本分支全部提交的工作树上跑过)
  • npm run test:product 通过(同上;1876 例,1874 通过、2 跳过、0 失败)
  • 未改依赖或 lockfile(check:lock 通过)
  • 子包经 verify:packages 通过
  • 文档改动跑过 docs:check
  • npm run complexity:gate 通过
  • 未提交可再生产物

RCP(Repository Control Plane)

  • 各提交在其所属任务内登记过 in-flight goal(详见堆叠 PR 的 RCP 节)
  • 改动路由的 reconcile 证据见 .nmg/verification/(按任务分目录)
  • CI 全绿尚未观察:本 PR 以 draft 建立,待 nmg-rcp forge-status --pr <PR号> 读取
  • 只推送本分支自身提交;未吞并行 Agent 改动

CI 完成确认

  • nmg-rcp forge-status 的 All checks passed 为 SUCCESS
  • CodeFactor 通过
  • Static job 通过(含 Dependency audit)

wefio added 17 commits October 17, 2026 23:13
Reuse the current session's existing search captures instead of adding a second recorder. Record the bounded read-only sample, its cost boundary, and missing necessity labels; leave runtime and recall-gate activation unchanged.
Record descriptive MLE/model comparisons, source-weighted boundary calibration,
sigma-driven refinement and same-budget source-admission proxy replay.

Keep explicit trial assumptions, wide bootstrap uncertainty and direct-only
sensitivity visible. The first pass recommends no lexical-layer adoption rather
than promoting a tighter score distribution into a memory-need policy.

Preserve private reproduction artifacts without publishing user inputs or
changing runtime configuration, activation or shared-service lifecycle.
Replace request-syntax and uniform-phrase assumptions in the offline study
with paired execution and exact-get record follow-through, keeping proxy
limitations explicit. Compare equal-age and equal-capacity eviction-only
tiers, predefined subsets and temporally purged session holdout.

The 8-cue/1h shadow pool peaks at two and never evicts, so no useful
retention subset is identified. Retain FIFO; make no runtime, activation,
permanent-tier or natural-benefit claim. Private data and scripts remain
local; publish only the bounded methods and aggregate findings.
Apply the existing deterministic FTS5 coverage tie-break before direct and Active Graph truncation. Preserve non-tied scores, semantic and forced surface paths, gate parameters and budget defaults. Add bounded public-interface regressions and record the controlled comparison; agent verification and 1689 product tests passed without live model calls.
Keep world messaging and find-Agent behavior while adding coarse event history, channel references and opt-out update subscriptions. Define default-idle published Agent status with self-authored notes and automatic task associations. Record the explicitly approved design separately from runtime delivery; update baseline, navigation, completion ledger and unresolved work without changing APIs or storage.
Add the state RPC, CLI commands and nmg_state model tool for Pi, MCP and
DSH. Reuse the private AG/lease authority and board state machine directly;
keep typed InformationView output, original source identities and short
AG mutation acknowledgements.

Capture host-owned AG fences before transport and preserve them across
retries. Reject unknown directions, operations and foreign AG fields.
Coordination opt-out leaves AG state available. Legacy board and Lab
RPC/CLI remain administrative compatibility paths, not extra model tools.

Refresh the existing /nmg state view on unified AG writes and preserve
per-user-turn carriage without per-inference injection. Migrate wake
guidance, canonical prompts, skills and owning contracts. Correct the
package manifest to include the current working-state view.

Keep named tool registration baselines independent in the complexity
gate without raising its limit.

Verified: targeted state/host tests, zero LSP diagnostics, type checks,
complexity gate and package runtime closure. Final clean-tree verification
is recorded separately in .nmg/verification/state-space-implementation/.
Port the controlled reload feature onto the merged daemon: explicit nmg daemon reload with an exclusive handover gate, ticketed replacement (--reload-ticket), drain before restart and durable-data retention. invokeDaemon keeps its options/signal contract and gains a reload-aware connection refresh; read-only retries stay gated after owner change. Registry/audit rows and the daemon lifecycle design record the feature; shared production replacement stays unexercised.
Merge question-form patterns into EXPLICIT_RECALL_PATTERNS (bare reminders and anything not ending in the question marker stay non-recall) with gate unit coverage, and record the shared-recall-entry diagnosis. Pi-level session-flow tests already live in tests/integration/session-flows.test.ts, so the timing-side duplicated inline block is dropped rather than doubled; the gate line decision/experiment docs are carried.
Port the recall_gate Lab capability onto the merged daemon: a default-off session-leased in-memory trial that caches assistant-proposed literal cues (prepare/correct/list/remove/clear) with revision-tied correction and secret-boundary capture refusal; Lab lifecycle resets drop cues on status-unset, disable, release and project change. beginDisclosureTurn gains optional recall input and returns a typed preparation plus recallGateActive, leaving old clients untouched. Pi runs the task-window demand first, forwards the native prompt only while the gate is enabled, reuses a gate-proposed cue only when no scheduled recall exists, and surfaces the trial notice in its single budgeted context message; inline session-flow classes stay in src/integration and the cue-trial integration test is kept instead of duplicating tests/integration/session-flows.test.ts. Decision/design/registry/manual docs and DSH/Claude adapters are carried.
Replace the per-turn recall prepare RPC and injected notices with piggyback semantics: while recall_gate is leased, beginDisclosureTurn returns a small phrase snapshot with lease expiry and opaque generation/turn fences when a project dir is supplied; an ordinary supplemental search can carry recallCue and recallSource (the native observation is host-only, stripped before retrieval, provider input and persisted traces; automatic and persistTrace:false probes are rejected; invalid, stale or disabled proposals never fail the search). Pi reuses the shared matcher locally, keeps static and task-anchor recalls ahead of any gate-proposed cue, and sends the native prompt only with a real proposal - one native attempt per turn; the explicit prepare-revision path stays for MCP and DSH. SessionRecallTrial gains generation fences, an admission ring bounded to sixteen events per session and reintroduction-aware retirement records, exposed behind the events operation. The per-turn skip and hint notice prompt keys are dropped together with their only consumer; the DSH adapter keeps its own single-quote convention outside the repo prettier scope while grafting the same two search parameters. Decision, design, registry and manual are updated to the piggyback contract, and the pi integration test now covers search-riding proposals instead of a prepare RPC.
The invocation boundary keeps reload awareness without violating the aborted-call invariant (an aborted automatic call never reconnects a dead daemon) or the handover-refresh invariant (deliberately stale discovery refreshes before a missing-method refusal). invokeDaemon now waits for an in-progress handover fence, then adopts a replaced endpoint through exactly one authenticated hello against the current state file - no probes, no recursion and never a spawn, so a call cannot claim ownership of the controller's replacement; adoption marks the endpoint as not owned. The replacement predicate no longer treats a dead owner with an unchanged descriptor as evidence of handover, and any abort wins immediately as the call's own deadline instead of being masked by compatibility or probe noise. Fetch-level failures keep the established reconnect path with read-only replay after an owner change.
… section

The lexical tie paragraph came in with an orphaned marker left in the timing parent's design.md; the surrounding text is the picked tie-before-caps wording and keeps its mention of the 500-character bounded excerpt span. No content change.
The nmg_state schema declares action: read|write plus a concrete operation,
but the board handler re-derived the operation from `action` and overwrote
the caller value on the RPC body, so every board write reached the daemon as
operation:"write" and failed INVALID_PARAMS 400; reads worked only because
"read" doubles as a concrete verb. Extract the payload assembly into
opencode-plugin/state-args.ts: prefer the schema operation, tolerate the
legacy single-verb shape, fail closed on a bare direction, and attach the
session identity (agentId/agentName/sourceSessionId) deterministically.
Covered by tests/integration/opencode-board-args.test.ts.
Primary-source reading on how search and recommendation systems infer usefulness from weak behavior signals, and which of those mechanisms do not transfer to NMG recall. Body unchanged: the file declares itself an external-literature synthesis, not an approved design.
…bilingual rollout

#93 split design.md, completion-audit.md and hidden-features-registry.md into
subfiles with zh-CN and terms companions, so every conflict was documentation.
Resolution takes main's structure and re-homes this branch's own content:

- design/progressive-retrieval: Chinese recollection questions, lexical tie
  resolution before the direct cap and AG budget, session-only recall cue pilot
- design/incremental-storage-and-index-maintenance: access-pressure eligibility
- design/product-boundary/agent-cli-and-resident-service: controlled daemon reload
- completion-audit/requirement-matrix and hidden-features-registry/feature-register:
  event-record and controlled-reload rows
- decisions 2026-10-15-session-recall-cues and 2026-10-17-board-event-records:
  terms companions
- board-event-records plus five experiment records: zh-CN and terms companions
  required by the post-#93 document-group contract; the Chinese originals moved to
  .zh-CN.md and English text now sits on the canonical name

No source file conflicted; the code from this branch is unchanged by the merge.
CI's Ubuntu product run failed both real-process reload tests with "reload owner
did not exit; no replacement was started". `isProcessAlive` used `kill(pid, 0)`,
which still succeeds for a Linux zombie: an exited process stays visible until
its parent reaps it, and the tests run the reload CLI synchronously, so the old
owner's entry is never collected while the CLI waits.

A zombie executes no code, so reporting it alive is wrong on its own terms and
also makes reload and stale-lease recovery wait for an owner that already
stopped. The check now reads the state letter from `/proc/<pid>/stat` on Linux
and keeps the previous behaviour elsewhere; the parser is exported and unit
tested on fixtures so the Linux branch is covered where zombies cannot be made.

Windows and macOS behaviour is unchanged.
@wefio
wefio marked this pull request as ready for review October 20, 2026 05:55
@wefio
wefio merged commit d94cb7e into main Oct 20, 2026
7 checks passed
@wefio
wefio deleted the integr/timing-rebase branch October 20, 2026 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant