Repository navigation
Enhance dashboard web, fix bugs - #67
Merged
Merged
Conversation
Two bugs in the reconciliation engine: 1. Agent processes create_and_start before stop_and_remove because task IDs sort alphabetically (r1 < r1-cleanup). The new container fails with "name already used" because the old container hasn't been removed yet. Fix: sort tasks in agent's processTasks() so stop_and_remove always executes before create_and_start. 2. ContainerReconciler only restarts containers with status "exited", ignoring "not_found". After a cleanup removes the old container from nerdctl, the task shows "not_found" which was never retried. Fix: treat "not_found" as equivalent to "exited" in both ContainerReconciler and DeploymentReconciler health computation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Three related issues after a container restart: 1. Proxy routes to dead container IPs: collectServiceBackends() returned ALL running tasks, including old tasks from before the restart. Fix: filter to latest task per deployment+service+replica so old backend IPs are excluded from heartbeat responses. 2. DNS points to old service IPs: same root cause — agents reconcile DNS from heartbeat backends. Fixing collectServiceBackends fixes DNS automatically. 3. Dashboard shows inflated container count (4/6 instead of 4/4): both dashboard and web API counted all historical create_and_start tasks. Fix: add latestTasksPerReplica() filter to both handlers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cleanupStaleNetworking() was deleting the banyan0 bridge on startup, but running containers have veth pairs attached to it. Deleting the bridge orphans all container networking, causing "No route to host" even though containers are still running (nerdctl ps shows them up). Fix: only delete the WireGuard interface (banyan-wg), which is safely recreated by initializeVPCNetworking(). Preserve the bridge, same as the overlay driver's Cleanup() method which explicitly documents: "the bridge must be preserved because running containers have veth pairs attached to it." Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Container names are reused across restart cycles (both old and new
tasks share the same container name like "my-app-db-0"). Matching
health reports by container name caused ghost containers: old tasks
got refreshed to "running" by the new container's health data.
Systemic fix: add task_id to the ContainerStatus proto message.
The agent sends its task ID with each health report entry. The engine
does a direct O(1) key lookup instead of scanning and guessing.
Before: engine scans all tasks, builds maps by container name, uses
"latest by container name" heuristics to avoid updating wrong task.
Complex, fragile, still broken in edge cases.
After: engine does store.Get(tasks/{agent}/{task_id}) per entry.
No scanning, no maps, no heuristics. Direct and correct.
Removes latestDeploymentIDs() workaround (dead code after this change).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Update file header comment in grpc_handlers_agent.go to remove reference to deleted reconcileDeploymentStatus function - Fix web API task list to use filtered createTasks instead of allTasks (prevents ghost containers in deployment detail view) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
On engine restart, the startup reconciliation ran before any agents reconnected. All agents appeared stale (LastSeen from before restart), so AgentReconciler created cleanup tasks for healthy containers. When agents reconnected seconds later, they executed those cleanup tasks and killed their own running containers. Fix: remove startup reconciliation. The 10s reconcile loop handles it naturally — by the time the first tick fires, agents have reconnected and reported their actual state. No premature cleanup. Update docs to match: engine restart recovery happens via the normal reconciliation loop, not a special startup pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The latestByReplica map in ContainerReconciler considered ALL task types. A stop_and_remove cleanup task (newer CreatedAt) would shadow the original exited create_and_start task for the same replica. The reconciler then skipped it (wrong type), so the exited container was never restarted. Desired state was never restored. Fix: only track create_and_start tasks in latestByReplica. Cleanup tasks are operational artifacts, not container state. This matches the pattern already used in computeHealthStatus (reconcile_deployment.go line 175), which correctly skips stop_and_remove. Regression test: TestContainerReconciler_CleanupTaskDoesNotShadowExited Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
grpc.NewClient defaults to the "dns" resolver. When given a bare IP:port address like "10.200.120.202:50052", the DNS resolver can silently fail to connect, causing the CLI and web dashboard log streaming to hang indefinitely. Fix: use "passthrough:///"+addr to bypass the DNS resolver and connect directly. This matches the pattern already used in all test code throughout the project. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
findContainerAgent scanned ALL nodes alphabetically. A stale node (local-worker, disconnected since February) with old tasks matching the same container names was found first, returning a dead API address. Log streaming connected to the wrong IP and hung. Fix: findContainerAgent now filters to healthy agents only (status=ready, recent LastSeen). Stale/disconnected agents are never consulted. Among matching tasks, returns the latest by CreatedAt. Also includes passthrough scheme for agent gRPC dial (defense in depth for direct IP connections). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The GetLogs and GetRecentLogs APIs now accept an optional agent_id. When provided, the engine does a direct node lookup instead of scanning all nodes and matching by container name. This eliminates the root cause of log streaming failures: stale node records (from old agents) with tasks sharing the same container names were matched first, returning unreachable API addresses. Before: engine scans all nodes alphabetically, matches first task by container name, hopes it's the right agent. After: web dashboard passes agent_id (which it already has from the container data), engine looks up the exact node. CLI falls back to scanning only healthy agents when agent_id is not provided. Changes: - Proto: agent_id field added to GetLogsRequest and GetRecentLogsRequest - Engine: findContainerAgent accepts optional agentID for direct lookup - Frontend: Logs page passes agentId from container data - Frontend: client.ts getRecentLogs/streamLogs accept agentId parameter Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Supports direct agent lookup for log streaming from the CLI: banyan-cli logs my-app-api-0 --agent-id pop-os When --agent-id is provided, the engine skips scanning and connects directly to the specified agent. When omitted, falls back to scanning healthy agents (backward compatible). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add the new --agent-id flag to the CLI reference page with example. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New category: Identity and Lookup Correctness (IDENT-1 through IDENT-5). Catches the pattern that caused 5 bugs during M12: using non-unique display names (container name) as lookup keys instead of unique IDs (task_id, agent_id) that were available all along. Each quick patch added a heuristic that broke in the next edge case. The proper fix was always: pass the unique ID, do a direct lookup. Checks added: - IDENT-1: Lookup key uniqueness - IDENT-2: Caller passes all available context - IDENT-3: No scan when direct lookup is possible - IDENT-4: Proto messages support direct lookup fields - IDENT-5: Historical records don't shadow current state Includes M12 retrospective section documenting the 5 instances of this pattern for future auditor reference. IDENT checks are now #1 priority in time-constrained audits. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Priority 1 (broken flows): - Fix logs pre-selection: ContainerDetail passes container+agent URL params, Logs page reads them and auto-selects on mount - Fix duplicate containers: collectContainers() now uses latestTasksPerReplica() to deduplicate after restart cycles - Health column verified working (backend populates, frontend renders) Priority 2 (missing context): - Deployment column shows relative age with full ID tooltip - Logs dropdown grouped by deployment, filtered to running containers Priority 3 (filters): - Custom FilterSelect component replaces native <select> elements, matching the dark theme with no OS chrome leaking through - Dedicated filter bar below page headers on all list pages - "Showing X of Y" indicator when filters are active - Containers: status, agent, deployment, service filters + search - Deployments/Agents: status filter - Events: type and severity filters Priority 4 (feature gaps): - Events: Load More pagination (50 per page) - Inline collapsible log panel on ContainerDetail with smooth CSS grid expand/collapse animation - Secrets page: full CRUD with reveal toggle, show/hide on create form value input, setup guide when secrets.key not configured - Configuration page: engine status, cluster summary, agent table Sorting: running/healthy items first, then newest, across all pages. Demo script shortened to 4-step flow: Overview → Agents → Container (db) → Logs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.