new-api icon indicating copy to clipboard operation
new-api copied to clipboard

[Feature] Durable native task events and webhook recovery hooks for Task Plugins

Open iamluxe77 opened this issue 1 month ago • 1 comments

Read This First

  • Docs: https://docs.newapi.ai/
  • Usage questions first: https://deepwiki.com/QuantumNous/new-api
  • Do not report issues when pass-through is enabled; pass-through sends content as-is and does not go through new-api processing logic.
  • State facts and evidence concisely. Do not paste unfiltered AI-generated text in the issue body or in later comments.
  • Reports about Coding Plan services, reverse-engineered channels, third-party API wrappers, or compatibility issues caused by exposing a Codex endpoint through a reverse proxy as a general-purpose API are not accepted. Protocols or behavior specific to the Codex API should not be treated as standard OpenAI API behavior; confirm such issues with the channel or API provider first.
  • This project does not provide official hosting and does not support third-party hosting sites, relays, or API services; contact their operator instead.
  • Warning: issues with this template removed, section headings deleted, or content cleared may be closed directly. Repeated submissions of unfiltered AI-generated text, or repeated abusive submissions, may result in a block.

Your current newapi version

Official self-hosted v1.0.0-rc.41@sha256:3293fc3d13bbf243ae720d9c4e0b8049e8ed01f5c130d3bdcdad8a1a2c7e57ed. Plugin API проверен также в rc.43 c6741c36a9a1a729554ad94ee99f21602a214a23.

Submission Checks

  • [x] Non-duplicate issue: поиск task webhook/inbox/outbox Issues/PR указан ниже; payment webhook запросы отличаются.
  • [x] Read this first: рассмотрены официальные docs/README/plugin API и host registry; runtime конфигурация этой capability не найдена. DeepWiki сейчас HTTP429.
  • [x] Supported version: запрос для неизменённого официального rc.41, с актуальным rc.43 source review.
  • [x] Not a third-party service: нужен общий native task event API, не поддержка стороннего receiver или форка.
  • [x] Not pass-through: forwarding/pass-through defect не заявлен.
  • [x] Channel and protocol boundary: provider-independent Task lifecycle, не Coding Plan, wrapper, reverse-engineered API либо Codex proxy.
  • [x] Template intact: поля Feature Request и все agent-only разделы .agents/github/ISSUE.md сохранены.
  • [x] Maintainer time: короткий feature контракт и первичные source-ссылки; непроверенные гарантии не объявлены реализованными.

Feature Description

Supported native durable task events/notification worker и task-bound receiver checkpoint hooks. PluginState и Go-only handler registry не предоставляют сохранённый delivery intent до HTTP и отдельный recovery terminal task events. Нужен stable Event-ID, bounded retry и независимость delivery от generation status.

Use Case

Self-hosted standard async task продолжает completion notification после worker restart, без второй product task DB и без повторной генерации. Это запрос maintainer alignment для нового host API; production callback loss или недоступность стороннего receiver здесь не заявляются.

Agent

  • Tool: Codex
  • Tool version: runtime session metadata 0.162.0-alpha.17.2
  • Model (full id): gpt-6.1-sol (session metadata)
  • Host (CLI / IDE / GitHub coding agent / other): Codex desktop, local executor
  • Date (UTC): 2026-10-11

User request

  • Verbatim: «Ты можешь им issues накатать чего не хватает в движке для нас?»
  • Later constraints or corrections from the user (quote, or none): none. Действующее ограничение владельца: «Движок не менять, чужой WIP сохранять.»

Out of scope — refuse

  • Matched: no. Запрос о новых native task event/worker hooks, не об ошибке стороннего webhook endpoint или supplier dialect.
  • If yes, what was told to the user (stop here; do not file): не применимо.

File gate — do not file unless all are satisfied

  • Out of scope (including pass-through): no.
  • Usage / configuration / integration (answered instead of filing): no; это новый host lifecycle-контракт.
  • Required facts present without invention (actual behavior, impact, frequency, evidence in new-api, applicable type fields): yes; ограничения опубликованного API и требуемая гарантия описаны ниже.
  • Body is short and factual; no unfiltered AI-generated text: yes; только относящиеся к контракту факты.
  • File: yes.
  • If no, what was told to the user (stop here): не применимо.

Kind

  • [ ] Bug
  • [x] Feature
  • [ ] Investigation
  • [ ] Other:

Usage / configuration / integration check

  • https://docs.newapi.ai/ — изучены Task Plugin и deployment/settings; native durable task webhook API не установлен.
  • https://deepwiki.com/QuantumNous/new-api — актуальное чтение вернуло HTTP429; доказательства ниже из primary repo.
  • README / repo docs: README Asynchronous tasks/Task plugins и published docs/plugin-api/v1.md.
  • Relevant code paths and conclusion: private PluginState сохраняется только при возврате hook и последующем task update; SystemTaskHandler регистрируется Go-кодом.
  • Can the current version already do this? (required for feature requests): проверенный Task Plugin API не даёт durable task event intent/receiver checkpoint либо регистрацию recovery handler.
  • Verdict: new feature, maintainer alignment до PR; не usage question.

Environment

  • new-api version / commit / image tag (not latest / unknown): deployed v1.0.0-rc.41@sha256:3293fc3d13bbf243ae720d9c4e0b8049e8ed01f5c130d3bdcdad8a1a2c7e57ed; source 2035a82aeb5414253a728bd937d4b8f97aa99b9b. Проверены rc.43 c6741c36a9a1a729554ad94ee99f21602a214a23 и main 0f38a14a5e8e322ea741478b0e49878be3130e1d.
  • Deploy source (repo release / official image / main source / other): неизменённый официальный docker.io/calciumion/new-api.
  • Database (sqlite / mysql / postgres): PostgreSQL + Redis; feature должен определить поддержку всех штатных DB.

Problem facts

  • Actual behavior: published plugin API имеет query/result/state/usage/content hooks, но не native durable delivery intent и отдельный scheduler terminal task events. Handler registry — Go interface, недоступный загруженному JS plugin.
  • Impact: внешний callback из query hook нельзя атомарно связать с native commit; успешный HTTP ACK до сохранения checkpoint допускает повтор, а terminal task больше не выбирается обычным polling.
  • Frequency: отсутствие capability постоянно для проверенного API. Частота реального callback loss не измерена; существующие успешные доставки не заявляются сломанными.
  • Evidence that the problem is in new-api rather than the client or upstream: ограничение host API/state persistence/selection, а не response стороннего receiver.

Type-specific details

Relay / API

  • Не применимо как forwarding report: запрос нового native task notification контракта. Нет жалобы на поставщика/model/конверсию и нет требования повторить provider generation.

Billing

  • Не применимо как расчёт цены/usage report. Требуется определить, какой durable native completion checkpoint разрешает notification; финансовая атомарность — отдельный запрос.

Frontend

  • Не применимо: browser/UI defect не заявлен.

Deployment / upgrade

  • Не применимо как upgrade report: текущий официальный rc.41, Linux/amd64, PostgreSQL; rc.43 runtime не устанавливался для исследования.

Reproduction and expected result

  • Steps to reproduce: проверить перечень published Task Plugin hooks/utilities и Go RegisterSystemTaskHandler, затем TaskPrivateData.PluginState/poll selection. Повтор ACK до native persistence — окно внешнего side effect, не заявленная production авария. Test-only fresh-handler/capsule fixture отдельно подтверждает необходимость stable Event-ID/dedup; она не доказывает native outbox.
  • Expected result: event intent сохраняется native host до внешнего HTTP, terminal generation не прекращает pending delivery recovery; повтор имеет один Event-ID.
  • Related screenshots (optional): отсутствуют.

Feature (feature requests only)

  • Feature description: supported native task events с durable delivery checkpoints/retries и bounded receiver hook для authenticated supplier events, если plugin использует webhook reconciliation.
  • Use case: self-hosted standard asynchronous image/video task может сообщить completion после worker restart без отдельной product task DB; receiver dedup и polling fallback сохраняют ту же task.

Duplicate check

  • Search queries (issues, PRs, discussions): Issues/PR: webhook outbox, durable callback, inbox, 回调, outbox; совпадающего task event API не найдено. Отдельный поиск Discussions не выполнялся.
  • Closest existing threads: #6201, #6633; текущий service/webhook.go и payment webhook controllers.
  • Why this is not a duplicate: payment webhooks не являются общим Task Plugin inbox/outbox. Закрытый #6201 прямо оставляет generalized durable task side effects за пределами своего PR.

Research

Docs

  • https://docs.newapi.ai/ : task/plugin/deployment scope; готовый native completion notification контракт не установлен.
  • https://deepwiki.com/QuantumNous/new-api : HTTP429 при актуальном чтении; не основание для утверждения поддержки.
  • README / other repo docs: Task Plugin API v1.
  • Conclusions: utils.fetch — ограниченный GET/HEAD к разрешённым hosts, не SQL checkpoint/worker registration API.

Code

Experiments

  • Command or redacted request: read-only GitHub contents для pinned rc.41/rc.43/main и сравнение перечисленных контрактов; нового webhook/fault experiment для official image не выполнялось.
  • Direct upstream result: не применимо, provider/receiver HTTP не вызывался.
  • Result through new-api: в опубликованном API не установлен отдельный durable event intent/recovery hook; source review, не live outage proof.
  • Conclusion: требуется official host feature, а не ещё один stateless sidecar HTTP retry.

Working theory

  • What is broken or missing: native persisted event intent, delivery checkpoints и terminal event scheduler, доступные Task Plugin через поддержанный контракт.
  • Why: возвращаемый PluginState сам по себе не даёт атомарную границу внешнего HTTP и native persistence.
  • What would falsify this: существующий supported host API, который гарантирует persisted intent перед HTTP и возобновление delivery terminal task после restart.

Scope

  • In scope for a later PR: native task event lifecycle; host-controlled ownership/correlation, duplicate suppression и recovery; payload projection через поддержанный plugin hook.
  • Out of scope / not this repo: supplier-specific signing dialect, доступность внешнего receiver, новый sidecar task store, платежные интеграции.
  • Large or directional feature? If yes, this issue is for maintainer alignment; do not open a PR yet: да, сначала согласование lifecycle/API.

Proposed direction

Сохранённый native intent переживает restart; delivery работает независимо от generation polling и имеет bounded retry/history. Event-ID стабилен; получатель дедуплицирует at-least-once delivery, HTTP exactly-once не обещается. Callback failure не меняет successful generation/refund. Если предусмотрен inbox, authenticated event сохраняется до2xx, коррелирует одну native task и инициирует reconciliation без повторной покупки. Публичный payload не раскрывает upstream credentials/private IDs.

Not verified

Не заявляются official image process-crash acceptance, гарантированный ACK внешнего receiver, долговременное outage recovery, новая DB/schema implementation либо полный security review будущего receiver. Существующие private capsule fixtures не заменяют эти критерии.

Related

iamluxe77 avatar Oct 11 '26 05:10 iamluxe77

[Bot Review]

感谢提交!但是您的 Issue 未使用项目提供的标准模板(缺少必要的模板结构和字段)。为了更好地追踪和评估功能请求,请使用完整的 Feature Request 模板重新提交。该 Issue 将被关闭,期待您的再次提交!