Commit Graph

313 Commits

Author SHA1 Message Date
root 6aea051c19 feat(monitoring): requeue automatic tasks after a manual human-verification run succeeds
When a manual, desktop-owned collect task succeeds after clearing a human
verification gate, requeue the automatic monitoring tasks that were
previously skipped for the same tenant/business-date/platform/client with
the human-verification skip reason. Restored tasks are reset to pending
(clearing lease, callback, and completion fields), stamped with a
recovery marker in their payload, and their brand projections are
rebuilt after commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 23:57:28 +08:00
root fc7495aba0 feat(tenant): business-date-scope monitor lease lanes and authorization-failure cancellation
Add an optional lane filter to the monitor task lease so callers can pull
a specific lane (e.g. high) and scope authorization-failure cancellation
to the failing task's business date, so a challenge on one day no longer
cancels queued tasks for another day. Monitor authorization-failure
cancellation now requires a business date and no-ops without one. Also
stop writing the nonexistent desktop_tasks.completed_at column when
canceling queued tasks for an authorization failure.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 23:57:10 +08:00
root ce67faadfb feat(prompts): require real local competitors in imitation ranking lists
In ranking or recommendation entries, competitors from the source
article must be replaced with verifiable local companies matching the
target brand's region and business scope; category-style placeholder
names are forbidden, and unverifiable entries are dropped instead of
kept or invented.
2026-07-21 08:42:06 +08:00
root d62f7b3c91 feat(imitation): accept pasted source content as an alternative to URL
- Make source_url optional and add source_content to the request; the
  two are normalized into a source kind ("url" | "content"), URL wins
  when both are present, and missing both returns source_required
- Skip web fetching in the generation worker when pasted content is
  provided; truncate it to the same 24,000-rune cap
- Label untitled pasted-content jobs with a locale-aware display title
  and mark the source kind in wizard state and prompt metadata
- Cover source normalization, truncation, and display title with tests
2026-07-21 08:41:55 +08:00
root efe1cde77c feat(prompts): surface brand KB numbers and genericize competitor figures
- Require rewrite output to weave in verifiable numbers from the brand
  knowledge base, web search, or company profile to highlight advantages
  and credibility
- Rewrite competitor-specific numbers into plain, unremarkable wording
  (e.g. "1000+ stores" becomes "nationwide store coverage")
- Keep article length and structure aligned with the source article
  instead of the fixed ~2000-character target
2026-07-18 21:16:03 +08:00
root 3037cfe059 feat: add MediaSupplyFavorite types and update task plan for generated-code drift diagnosis
Backend CI / Backend (push) Successful in 17m27s
2026-07-15 00:04:13 +08:00
root 1fab7b1e5f feat(monitoring): scope authorization-failure cancellation to platform across accounts
When a monitor task's final account hits human verification or an
authorization failure, cancel the remaining queued desktop/monitoring
tasks for the whole platform instead of only the same account. Follow-up
tasks are now marked skipped/aborted (not failed) with a
platform_human_verification / platform_authorization_unavailable reason
and a user-facing cancellation message, and emit task_canceled lifecycle
events for monitor kinds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 22:00:41 +08:00
root 06dafa88f8 test(tenant): cover desktop task platform id dedup and target count
Assert uniqueMonitorDesktopTaskPlatformIDs trims and collapses duplicate
account specs, and tighten the healthier-candidate case with a target
length check. Apply gofmt alignment fixes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-12 14:17:36 +08:00
root 67a6cbcd9e feat(media-supply): persist favorites with multi-group membership
Move media favorites from client state to PostgreSQL with server-side
search and pagination.

- Store favorites keyed by (tenant, user, group, resource) so a resource
  can belong to multiple groups; the 500-resource cap counts distinct
  resources, not memberships.
- Add favorite-group CRUD and group/global removal routes, with silent
  cleanup of delisted or invisible resources on read.
- Serve favorite resource details server-side, 10 per page, with name/ID
  search; favorites-page removal is group-scoped, resources-page removal
  is global.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 20:21:59 +08:00
root 0bf4b73ebc feat(tenant): inject brand description context into every generation path
Include the current brand description in template, custom, imitation,
and KOL article-generation prompts while bounding prompt growth.

- Add a shared brand-context builder that resolves the current brand,
  compacts long descriptions, and caps rendered output at 2000 runes.
- Snapshot a structured brand prompt context on queued tasks so old
  jobs stay reproducible and retries stay stable.
- Route brand-profile facts through the existing typed fact guard so
  founding dates and year counts get the same pre-persistence validation
  as RAG facts, with brand facts outranking conflicting RAG facts.
- Fix the KOL creator to attach the brand scope its worker consumes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 20:21:59 +08:00
root 418b3c4998 feat(tenant): guard numeric knowledge facts against silent contradiction
Ensure numeric facts present in retrieved knowledge (especially company
founding dates) cannot be silently contradicted in generated articles.

- Add a typed fact guard that extracts constraints (dates, experience
  years, etc.) from precise facts, detects source conflicts, and
  validates generated content before persistence with a bounded repair
  retry.
- Surface fact constraints through KnowledgeContext and render them as
  a canonical, non-derivable fact block in the knowledge prompt section.
- Tighten prompt intro lines to forbid rewriting, mixing old values,
  or deriving service years from founding dates.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 20:21:59 +08:00
root 347cea1296 feat(llm): add configurable request/token rate limiting for LLM client
Introduce process-local and Redis-backed global rate limiting for the
shared LLM client, plus a dedicated generation consumer prefetch knob.

- Add request (RPM) and token (TPM) rate limits with burst controls,
  process or global scope, and fail-closed/process-degraded failover
- Wire the LLM client through NewWithRedis so limits can be shared
  across replicas via a Redis token bucket
- Add generation_consumer_prefetch to tune RabbitMQ generation
  consumers independently of the default prefetch
- Bump generation worker_concurrency to 24 and promote golang.org/x/time
  to a direct dependency
- Drop t.Parallel() from a few middleware/bootstrap tests

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 00:14:40 +08:00
root 2c394d436a feat(tenant): enforce English output for en-US template generation
When the article locale is en-US, Chinese prompt templates could leak
Chinese wording into generated titles, outlines, and article bodies.
Add high-priority language-consistency guards so the model treats the
Chinese template text as internal instructions and emits English only.

- Append per-artifact locale guards (analyze/title/outline) in template
  assist prompts and an article-body guard in the generation prompt,
  only when locale is en-US
- Reinforce locale consistency in the title/outline runtime prompts and
  drop retained images from the rewrite prompt
- Cover the new guards with unit tests

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 19:38:55 +08:00
root f69edc2218 feat(tenant): bill AI points by output characters
Deployment Config CI / Deployment Config (push) Successful in 39s
Backend CI / Backend (push) Successful in 18m14s
Previously AI point cost was computed from request (input) characters at
reservation time. Switch to reserving a single point up front and
settling the final cost from the generated output length on completion.

- Reserve 1 point (or FixedPoints) instead of pricing on request chars
- On completion, recompute points from output chars vs base chars,
  update the reservation amounts, and post a ledger delta for the
  top-up/refund; invalidate the workspace quota summary cache
- MarkCompleted now persists final request_chars/base_chars/points
- Use ceil division in calculateAIPointCost so an exact base boundary
  charges one point instead of rolling over
- Thread output text through all CompleteAIPoints callers (article
  selection, KOL assist, question expansion, template assist, compliance
  judge) and return the settled reservation
- Add unit tests plus an integration test gated on TEST_DATABASE_URL
- Update the user manual: billing is by output characters

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 17:04:37 +08:00
root c8dceb43d7 feat(tenant): make monitoring parse & compliance judge models configurable
Replace the hardcoded doubao-lite model used for monitoring answer
parsing and compliance LLM judging with configurable values, resolved
from config with env overrides and a legacy default fallback.

- Add llm.monitoring_answer_parse_model and compliance.llm_judge_model
  to config struct, env overrides, and all config files
- Thread the resolved model through MonitoringCallbackService via a
  ConfigProvider and into parseMonitoringAnswerWithLLM
- Pass compliance.llm_judge_model into the review-job LLM request

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 17:04:01 +08:00
root fb142e4ca7 docs(swagger): document brand order endpoint
Backend CI / Backend (push) Successful in 18m19s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 23:57:56 +08:00
root e90d6a185f feat(tenant): derive recent article publish status from publish records
GetRecentArticlesByBrand now folds the latest publish record per target
into an aggregated publish_status (publishing / partial_success / success
/ failed), falling back to the stored status when no records exist.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 23:39:07 +08:00
root 58a9b379bc feat(tenant): dedup article publish status by latest record per target
Aggregate publish status from the latest record per publishing target
using a shared target-identity expression, so retries and multi-record
targets no longer inflate the status buckets.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 23:38:59 +08:00
root 832d7f507d feat(publish): cancel stale queued publish tasks after queue timeout
Add CancelStaleQueuedPublishTasks to abort publish tasks that sit in the
queue past a configurable timeout (default 3 days) without being claimed by
a desktop client, so they no longer linger indefinitely as 'queued'. The
lease recovery worker runs the cleanup each cycle and reports a
cancelled_queued count; the timeout is configurable via job run config.
Aborted tasks carry a publish_queue_timeout error payload with a readable
Chinese duration, and the admin-web publish summary surfaces it as an
auto-cancelled queue-timeout message.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 22:56:37 +08:00
root f1334aac80 fix(tenant): finalize definitive/manual-retry publish tasks as failed
Desktop Client Build / Resolve Build Metadata (push) Successful in 58s
Backend CI / Backend (push) Failing after 12m16s
Frontend CI / Frontend (push) Successful in 5m5s
Desktop Client Build / Build Desktop Client (push) Successful in 23m55s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 41s
Add normalizeDesktopTaskCompletionStatusForTask so an "unknown" publish
completion is downgraded to "failed" when the payload is a manual retry or
the error matches a definitive publish failure, instead of leaving it
stuck as unknown.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 22:32:15 +08:00
root aecdb87fa3 feat(tenant): supersede unknown publish tasks on manual retry
Replace the in-place requeue of submit-uncertain unknown publish tasks
with an explicit supersede-and-create-new flow: manual retries mark the
old unknown task failed (manual_retry_superseded) and create a fresh task
carrying manual_retry / superseded_unknown_task_ids in its payload.

Also fold title-length validation into definitivePublishFailurePattern and
check the pattern before the publish_submit_uncertain guard so those
failures are released from the dedup set.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 22:32:06 +08:00
root 71233b6715 feat(brand): add brand sort order and drag-to-reorder
Add a sort_order column to brands with a migration, expose a
PUT /api/tenant/brands/order reorder endpoint, and wire the
admin-web BrandsView with drag-and-drop reordering plus i18n.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 21:48:20 +08:00
root 283e8f6b46 fix: prevent forced re-login from concurrent refresh token rotation
Rotated refresh tokens now stay valid for a 60s grace window so
concurrent refreshes (e.g. multiple browser tabs) each obtain a valid
new pair instead of being logged out. Admin-web additionally serializes
refreshes across tabs via the Web Locks API and reuses tokens already
rotated by another tab.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 20:55:19 +08:00
root ced0c4ec0f Scope knowledge and image libraries by brand
Frontend CI / Frontend (push) Successful in 2m59s
Backend CI / Backend (push) Successful in 14m58s
2026-06-30 12:30:10 +08:00
root 95ddb3057f docs: document media supply billings route
Backend CI / Backend (push) Successful in 14m47s
2026-06-29 23:35:20 +08:00
root c790829880 chore: update generated media supply models
Backend CI / Backend (push) Failing after 8m36s
2026-06-29 23:23:00 +08:00
root 31811b07d4 feat: add media supply billing center
Frontend CI / Frontend (push) Successful in 5m44s
Backend CI / Backend (push) Failing after 6m58s
2026-06-29 23:13:33 +08:00
root 4040d22605 fix: enhance monitoring metrics with latest sample aggregation and derived metrics calculations
Backend CI / Backend (push) Successful in 21m2s
2026-06-29 17:21:38 +08:00
root b9b1db6e5d feat: implement batch processing for daily monitoring tasks across platforms
Backend CI / Backend (push) Successful in 15m17s
2026-06-28 12:26:27 +08:00
root a62ff58575 fix: add DELETE endpoint for desktop publish records
Backend CI / Backend (push) Successful in 14m52s
2026-06-27 19:53:24 +08:00
root 05d4266649 enable desktop monitoring rollout
Deployment Config CI / Deployment Config (push) Successful in 32s
Backend CI / Backend (push) Failing after 8m33s
2026-06-27 16:53:20 +08:00
root 11b8e3f5cd fix monitoring daily dispatch cap 2026-06-27 16:47:28 +08:00
root beb290a5a7 fix monitoring online dispatch retries 2026-06-27 16:17:02 +08:00
root 940ac23493 fix monitoring daily backpressure 2026-06-27 15:31:08 +08:00
root 58fe70268d fix collect-now active request reconciliation
Backend CI / Backend (push) Failing after 8m32s
2026-06-27 14:55:07 +08:00
root 04769dec78 fix publish record deletion
Desktop Client Build / Resolve Build Metadata (push) Successful in 26s
Frontend CI / Frontend (push) Successful in 2m47s
Backend CI / Backend (push) Failing after 10m1s
Desktop Client Build / Build Desktop Client (push) Successful in 23m3s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 29s
2026-06-26 21:04:38 +08:00
root 6780963c28 fix media supply citation attribution
Desktop Client Build / Resolve Build Metadata (push) Successful in 26s
Frontend CI / Frontend (push) Successful in 2m53s
Backend CI / Backend (push) Successful in 16m37s
Desktop Client Build / Build Desktop Client (push) Successful in 23m40s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 28s
2026-06-25 23:53:35 +08:00
root 4d07f40fdf fix monitor desktop task recovery 2026-06-25 18:34:58 +08:00
root cbbec8da85 fix monitoring manual mark attribution
Frontend CI / Frontend (push) Successful in 2m56s
Backend CI / Backend (push) Successful in 14m47s
2026-06-25 09:31:18 +08:00
root bdfe79c921 Preserve publish record history
Frontend CI / Frontend (push) Successful in 3m15s
Backend CI / Backend (push) Successful in 14m44s
2026-06-25 01:52:26 +08:00
root febfd65b45 fix: delete desktop release oss objects 2026-06-25 00:40:08 +08:00
root ed48674ab5 fix: allow retry after definitive publish failures
Frontend CI / Frontend (push) Successful in 3m18s
Backend CI / Backend (push) Successful in 16m16s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 26s
Desktop Client Build / Resolve Build Metadata (push) Successful in 26s
Desktop Client Build / Build Desktop Client (push) Successful in 25m45s
2026-06-25 00:22:59 +08:00
root 590c219a64 chore: update app generation workflow
Desktop Client Build / Resolve Build Metadata (push) Successful in 26s
Frontend CI / Frontend (push) Successful in 2m58s
Backend CI / Backend (push) Successful in 16m11s
Desktop Client Build / Build Desktop Client (push) Successful in 24m1s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 28s
2026-06-24 23:39:12 +08:00
root 98e3dce017 improve desktop issue diagnostics
Desktop Client Build / Resolve Build Metadata (push) Successful in 26s
Backend CI / Backend (push) Successful in 16m8s
Desktop Client Build / Build Desktop Client (push) Successful in 22m48s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 29s
2026-06-24 12:42:49 +08:00
Xu Liang 0afd082d96 feat(doubao): implement challenge handling and monitoring improvements
Desktop Client Build / Resolve Build Metadata (push) Successful in 26s
Frontend CI / Frontend (push) Successful in 3m12s
Backend CI / Backend (push) Failing after 10m8s
Desktop Client Build / Build Desktop Client (push) Successful in 23m53s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 26s
- Added classification for `doubao_challenge_required` as a challenge in platform-auth-adapters.
- Enhanced account action summaries to include specific messages for Doubao human verification.
- Introduced monitoring functions to filter out blocked platforms based on account health.
- Updated task leasing to support platform-specific filtering for monitor tasks.
- Refined issue aggregation in HomeView to consolidate Doubao challenge failures into a single actionable item.
- Improved backend logic to handle platform IDs in task leasing requests and responses.
- Added tests for new functionality, ensuring proper handling of Doubao challenges and task leasing logic.
2026-06-24 02:31:35 +08:00
root a406971187 fix: implement resource reconciliation and update handling in media supply favorites
Frontend CI / Frontend (push) Successful in 2m55s
Backend CI / Backend (push) Failing after 8m41s
2026-06-23 23:34:45 +08:00
root 04bd3e42e0 fix: harden desktop monitoring recovery
Desktop Client Build / Resolve Build Metadata (push) Successful in 37s
Backend CI / Backend (push) Failing after 9m26s
Desktop Client Build / Build Desktop Client (push) Successful in 22m29s
Desktop Client Build / Publish Client Artifacts to NAS (push) Successful in 35s
2026-06-23 23:12:25 +08:00
root b4ebf34728 fix: apply monitoring lease recovery interval migration
Backend CI / Backend (push) Failing after 8m31s
2026-06-23 01:20:38 +08:00
root 0d9c2c7461 fix: increase monitoring lease recovery interval for improved performance
Backend CI / Backend (push) Failing after 8m38s
2026-06-23 01:09:24 +08:00
root d458dd7477 fix: fail expired monitor desktop leases
Frontend CI / Frontend (push) Successful in 2m26s
Backend CI / Backend (push) Failing after 8m42s
2026-06-23 01:03:35 +08:00