# Nuhet account retention recovery - 2026-10-05

## Current direction and authority

User approved this sequential successor and implementation on 2026-10-05: "Yes, proceed and make this happen. Dont forget to cleanup the old commands that we no longer need when this is done."

Implement universal non-destructive deletion marking. Retain users, relationships, business rows, files and statistics for 12 calendar months from actual `deleted_at`. Repeated marking must preserve the clock; restoration cancels purge eligibility. Permanent cleanup must freshly reject active, restored or insufficiently old deletions through every entry point, including explicit IDs and legacy serialized jobs. Preserve legitimate cancellation timing, payment and notification semantics. Do not promise reversal of external billing effects.

The immediate-spam purge plan is withdrawn. No campaign activation, grace-period bypass or real permanent purge is authorized. Retire obsolete purge commands, schedules, campaign runner/activation/claims configuration and stale executable references. Do not install the unused claims table or trigger. An inert historical migration may remain for compatibility; any applied schema retirement requires a separately verified forward plan, never blind down/rollback.

Card #1921, Nuhet, freshly verified open/In Progress/high, solely Jonathan Hamberg (authenticated user 2), Development 16, estimate 90, nonbillable, AGENT QUESTION. Protect its description and leave monthly Nuhet cards untouched. Subsequent assignment, column-list, Nuhet read probe, paired policy comments and timer start returned `user rejected MCP tool call`; no retry or successful write is claimed. No timer was started by this successor. Active time needs reconciliation when Xhronos writes are available.

## Project and startup

- Sole user-facing root: `NUHET: CLEAN UP #1`, Xherd tab `t_183b569d4c04`, pane `p_9ac9f4823d66`, workspace `w_de89eeeeb938`, DESKTOP-7NVPSJ5. Actual Windows cwd `C:\Users\zerav`; effective runtime workspace-write/restricted network, not inherited full access.
- Original tab `NUHET: CLEAN UP`, `t_579df86ef69b`, pane `p_b46f5e5ccea1`, preserved. Original has no duplicate writer. Supported pin controls/readback are unavailable. Startup report `session_send` returned `denied by user`; it was not delivered or retried. Startup is evidenced here and in this root turn, not by a transport receipt.
- Existing isolated worktree `\\wsl.localhost\Ubuntu\var\www\nuhet-spam-campaign-20260924`, branch `codex/nuhet-spam-campaign-20260924`, preserved. Primary Nuhet workspace untouched; no active E: dependency. No applicable ancestor/project AGENTS or overrides found by fresh scoped checks.
- Startup HEAD `9172df55f661c1981da2f5cb4b956456f0c4bbe8`; only checkpoint modified, diff check clean. Approved WSL runner/audit exit 0 verified. Latest remote master fetched through the account-isolated GitHub wrapper at `4168cba27ba15a81fbd75824d613e3587364d0f5`. Integrated locally at `543a0c23f5ae9d92403a1cdb2ea39d5e1e2436b1`, clean state and master ancestry verified. Checkpoint-only add/add conflict resolved preserving the complete newer task history.
- Root read task-lifecycle v1.4.0, delegation v2.2.0, central AGENTS v7.8.6, xhronos v1.7.2, WSL health v3.0.0, runner v2.1.0, GitHub v4.0.0, live access v1.3.0, Nuhet MCP v1.0.0, credentials v1.9.0 and reliability v1.3.0. Catalog versions match. Xherd and Xherd SSH skills read. No Computer Use authorized.
- Native UNC `apply_patch` fails because the path contains a reparse point. Approved scratch snapshots under `K:\AI_docs_tmp\nuhet-retention-1921` permit patch preparation. Root brokers real worktree writes through the approved WSL runner and verifies actual diffs; scratch is not a new workspace or durable recovery record.

## Work ledger and next action

- One native in-thread worker (`retention_implementation`, gpt-6.1-sol/high due data-retention risk) implemented staged code/tests and released ownership. A separate read-only `retention_review` agent independently reviewed the actual integrated source and evidence. Root owns this checkpoint, actual integration, tests, release and final acceptance. Initially denied child UNC reads were resolved using hash-verified tracked source and mandatory policy copies in approved scratch. Cost savings remain unmeasured.
- Accepted implementation committed as `2a93e89c76e7caae36445fb0f34de8d7660566c8` (62 files), pushed to the existing task branch, and opened as [PR #1455](https://github.com/xilesoftware/nuhet/pull/1455). Fresh GitHub state confirms OPEN, base master, correct task branch/head and MERGEABLE; no remote check rollup is configured/reported. Shared retention, cancellation/legacy-job compatibility, bounded audited soft marking, guarded cleanup, sending/access/background checks, campaign retirement and inert historical migration are present. No deployment or production account mutation performed.
- Actual final verification: `git diff --check` and PHP lint for 52 changed files passed; focused 62 tests/843 assertions passed; full 236 tests/1,747 assertions passed. Opt-in disposable local MariaDB 10.6.22 two-connection retention test passed 1 test/16 assertions, including company-row lock contention and fresh eligibility. Each PHPUnit run reports one existing deprecation. This is not a full filesystem/statistics/permanent-purge rehearsal.
- Independent review accepted immutable `review-integrated-2` (572 source files, diff SHA256 `0199b0f5c85e71093e890fde9d16c4cb01837900aa16d8ce1c6c4242f34e397e`) for commit/PR, with no remaining code acceptance blockers. Root accepts that actual candidate and evidence. Earlier findings are resolved: first/API login, stale import/media jobs, comment-author exclusions, cross-account preflight, common kill-switch, bulk model gateways, retained-queue selection/process-limit starvation and nullable optional links. Queue regressions verify retained work does not block active selection/progress and processing remains locked.
- Legacy feature fixtures now use the correct isolated company connection/approver schema, and the SMS fixture reflects incoming-master receiver-capacity behavior. Production guards and incoming-master behavior were preserved. Audit tests were reduced from the historical mixed 1,017-line file to focused audit coverage plus shared fixture and separate retention/access/background/preflight/spam tests; the earlier split recommendation is resolved within this task.
- Incoming master receiver/bounce changes must survive candidate application. In particular preserve two Kernel registrations and three `countsTowardLimit()` CompanyController changes; use patches against merged state for any changed shared files.
- Master was freshly fetched again and remains `4168cba27ba15a81fbd75824d613e3587364d0f5`, an ancestor of HEAD. Actual source inventory and hashes were compared back to the independent-review snapshot before commit; only this root-owned recovery update differed. Generated PHPUnit result cache was moved to approved scratch and later runs disable result caching. Next: obtain explicit renewal for the denied live comparison below, then fresh host notes and per-command release verification before guarded deployment. Card comments/link and timer reconciliation remain unsaved due the earlier rejected calls. No installation authorized.

## Exact account scope and live gates

Deferred organization recommendation: `app/Console/Commands/QueueMailer.php` now measures 998 lines/36,663 bytes and `SMTPQueueMailer.php` 850 lines/31,879 bytes. Their batch selection, recipient mutation and transport delivery responsibilities obscure the company-lock boundary. A later scoped split should move recipient processing into `app/Services/Mail/QueuedMailProcessor.php` and `SMTPQueuedMailProcessor.php`, sharing `CompanyRetention` while commands retain selection and loop limits; transport/server credential and attachment handling can then move behind a shared `SmtpDelivery` interface. Migrate QueueMailer first, then SMTPQueueMailer; verify retained/active queue progress, transport behavior and full PHPUnit after each. Current authorized correction extracts bounded helpers; the broader module split is deferred, not authorized by this recommendation.

Original cohort is IDs 43269-45090, active free package 1, company name containing `tw1.ru` or `swtest.ru`, older than 30 days, full conservative audit exclusions retained. Prior user-run IDs 43249-43268 are separate. Oct5 full read-only report: 500 + 500 + 500 + 315 = 1815 eligible, zero exclusions, no dispatch/deletion. Earlier zero pending/failed job counts are not residual-data or partial-deletion proof. A fresh bounded replacement dry-run and exact soft-delete action/scope must be reviewed before any live marking. Do not widen to all inactive accounts or bypass hard blockers.

Production profile `Nuhet`: post.nuhet.se, `/var/www/html`, nuhetftp, stored sudo capability, shared server. Last recorded tracked checkout clean master `4168cba2`, 24 GB free/90% used. Soft deletion will not free retained storage. Fresh host inventory and full notes required before any live action; per-command SSH approval remains effective.

The prior read-only production `CustomerCleanup.php` release-diff comparison was denied. Its current live contents remain NOT VERIFIED. Do not retry, rephrase or bypass that decision without explicit renewal. Local master contents and old reports do not establish fresh live verification. No live action has been attempted by this successor.

NEVER run `php artisan config:cache` on this host: notes record SMS breakage from runtime `env()` values. Preserve unrelated effective cached settings. Production has no Nuhet GitHub credentials; deployment uses a locally verified Git bundle, SFTP and guarded fast-forward. No credential setup, `git fetch` on production or other app deploy keys.

Full server images are difficult last-resort recovery, not routine rollback. Permanent deletion still requires targeted rehearsal/recovery for company DB, separate statistics connection and files; a transaction cannot roll back filesystem/statistics destruction. Do not purge real accounts or blindly retry partial cleanup.

## History and continuity

Earlier campaign deployment, audit, safety findings and successor evidence are retained in [the historical evidence archive](archive/known-spam-campaign-history-20261005.md). Its activation/migration proposals are retired and must not be executed. This current checkpoint is the operational source.

Original session had at least five known compactions; this successor has one known compaction. Task-lifecycle policy was reread after recovery. Current successor assessment: not needed; continuity remains reliable for this approved phase. Reassess after recovery/compaction or a release boundary.
