LifeOSHooks: `promptSubmit` puts its composed context on the result after `next()`, which the engine does not attach, so memory, nudges and the ORIGIN warning never reach the model

Đang mở Phù hợp với người mới
#2,822 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 6 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
65/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
ai-infra-agents, tooling

Hướng nghiên cứu

Bắt đầu trong skills/LifeOSHooks/hooks/LifeOSHooks.ts tại promptSubmit: ghi nhận nơi từng mục context được xây dựng so với nơi next() được await, và đọc các khai báo PromptSubmitInput.context / PromptSubmitResult.context mà nó trích dẫn để xác nhận đường đi xuống được hỗ trợ. Di chuyển các mục FAST-TOGGLE và ORIGIN vào mảng được truyền qua next({ ...input, context }), giữ scheduleFast và ack bộ nhớ sau một next() được chấp nhận, và trả về kết quả không thay đổi. Hoàn tất nghĩa là một prompt trực tiếp hiển thị dòng thời gian, khối bộ nhớ và dòng ORIGIN: trong context của model. Kiểm tra bản sửa của #2608 trước khi bắt đầu, và coi vấn đề thứ hai, liên quan đến fallback, là follow-up thay vì một phần của chỉnh sửa này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

What. skills/LifeOSHooks/hooks/LifeOSHooks.ts promptSubmit builds its per-turn entries before next() (the time line, then the prompt-context bridge reply: the memory hot layer, AlgorithmNudge, VersionDrift, DriftReminder, ModelDriftGuard, PresenceContext). After next(input) resolves, it appends the FAST-TOGGLE and ORIGIN lines and returns { ...r, context }.

The client's own plugin declarations (PromptSubmitResult.context, as written by 2.1.322) say:

A hook attaches context on the way down; one put here after next resolved is not attached (the prompt had entered), and is logged.

PromptSubmitInput.context gives the supported form: next({ ...e, context: [...(e.context ?? []), mine] }).

What happens. None of the plugin's prompt context reaches the model. In one live session, no time line, memory block or ORIGIN: line appeared in the model's context on any prompt, including prompts the plugin logged with origin task-notification. Context from native command hooks (a PostToolUse additionalContext) did arrive in the same session. Because native MemoryTurnStart exits early in an armed session, an armed session gets no hot memory at all.

The ORIGIN line is the warning that a prompt did not come from the principal and carries no authority. It is lost the same way.

Suggested fix. Build every entry before next() and pass it down, then return the result unchanged. Keep the side effects that need an accepted prompt (scheduleFast, the memory ack) after next():

const context = [...mine];
const bare = e.origin.kind === "composer" && !e.command && !e.isMeta ? bareFast(input.text) : null;
if (bare) context.push(`FAST-TOGGLE: ...`);
if (!PRINCIPAL_ORIGINS.has(e.origin.kind)) context.push(`ORIGIN: ...`);
const r = await next(context.length ? { ...input, context: [...(input.context ?? []), ...context] } : input);
if (r.drop !== undefined) return r;
if (bare) scheduleFast($, s, bare, "bare");
// memory ack, unchanged
return r;

Related. The memory ack in the same hook depends on this. It marks chunks consumed after next(), but those chunks were never attached, so the ack confirmed deliveries that hadn't happened. #2608 (closed, fixed for the next release) moves the ack after an accepted next() and carries the emission id back from prompt-context; its note does not say whether the context itself moved before next(). If that fix already passes the entries down through next(), this issue is covered and can be closed.

A second issue that shows up once context is delivered. When one composer inside prompt-context throws, the bridge withdraws the prompt-context cap and the native command hooks run for that prompt as well, so that turn carries some entries twice. Dropping the plugin's entries in that case doesn't fix it cleanly. Native TimeContext and VersionDrift are registered async: true, so their output arrives a turn late (and TimeContext falls back to UTC when no timezone is configured). VersionDrift has also already started its cooldown during the bridge's run, so its warning would be lost. PromptProcessing and SatisfactionCapture run in the bridge before coverage is decided, so their model request and rating pulse repeat natively either way. A fallback that is equivalent to the bridge would let the bridge report which composers failed, so that only those fall back to their native hooks.

Ngôn ngữ chính
TypeScript
Star
19.8k
Fork
2.5k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của danielmiessler/LifeOS

Tất cả issue của danielmiessler/LifeOS

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.