@@ -105,8 +105,8 @@ type Options struct {
105105}
106106
107107type Client interface {
108- ConnectRPC26 (ctx context.Context ) (
109- proto.DRPCAgentClient26 , tailnetproto.DRPCTailnetClient26 ,error ,
108+ ConnectRPC27 (ctx context.Context ) (
109+ proto.DRPCAgentClient27 , tailnetproto.DRPCTailnetClient27 ,error ,
110110)
111111tailnet.DERPMapRewriter
112112agentsdk.RefreshableSessionTokenProvider
@@ -506,7 +506,7 @@ func (t *trySingleflight) Do(key string, fn func()) {
506506fn ()
507507}
508508
509- func (a * agent )reportMetadata (ctx context.Context ,aAPI proto.DRPCAgentClient26 )error {
509+ func (a * agent )reportMetadata (ctx context.Context ,aAPI proto.DRPCAgentClient27 )error {
510510tickerDone := make (chan struct {})
511511collectDone := make (chan struct {})
512512ctx ,cancel := context .WithCancel (ctx )
@@ -721,7 +721,7 @@ func (a *agent) reportMetadata(ctx context.Context, aAPI proto.DRPCAgentClient26
721721
722722// reportLifecycle reports the current lifecycle state once. All state
723723// changes are reported in order.
724- func (a * agent )reportLifecycle (ctx context.Context ,aAPI proto.DRPCAgentClient26 )error {
724+ func (a * agent )reportLifecycle (ctx context.Context ,aAPI proto.DRPCAgentClient27 )error {
725725for {
726726select {
727727case <- a .lifecycleUpdate :
@@ -801,7 +801,7 @@ func (a *agent) setLifecycle(state codersdk.WorkspaceAgentLifecycle) {
801801}
802802
803803// reportConnectionsLoop reports connections to the agent for auditing.
804- func (a * agent )reportConnectionsLoop (ctx context.Context ,aAPI proto.DRPCAgentClient26 )error {
804+ func (a * agent )reportConnectionsLoop (ctx context.Context ,aAPI proto.DRPCAgentClient27 )error {
805805for {
806806select {
807807case <- a .reportConnectionsUpdate :
@@ -932,7 +932,7 @@ func (a *agent) reportConnection(id uuid.UUID, connectionType proto.Connection_T
932932// fetchServiceBannerLoop fetches the service banner on an interval. It will
933933// not be fetched immediately; the expectation is that it is primed elsewhere
934934// (and must be done before the session actually starts).
935- func (a * agent )fetchServiceBannerLoop (ctx context.Context ,aAPI proto.DRPCAgentClient26 )error {
935+ func (a * agent )fetchServiceBannerLoop (ctx context.Context ,aAPI proto.DRPCAgentClient27 )error {
936936ticker := time .NewTicker (a .announcementBannersRefreshInterval )
937937defer ticker .Stop ()
938938for {
@@ -967,7 +967,7 @@ func (a *agent) run() (retErr error) {
967967}
968968
969969// ConnectRPC returns the dRPC connection we use for the Agent and Tailnet v2+ APIs
970- aAPI ,tAPI ,err := a .client .ConnectRPC26 (a .hardCtx )
970+ aAPI ,tAPI ,err := a .client .ConnectRPC27 (a .hardCtx )
971971if err != nil {
972972return err
973973}
@@ -984,7 +984,7 @@ func (a *agent) run() (retErr error) {
984984connMan := newAPIConnRoutineManager (a .gracefulCtx ,a .hardCtx ,a .logger ,aAPI ,tAPI )
985985
986986connMan .startAgentAPI ("init notification banners" ,gracefulShutdownBehaviorStop ,
987- func (ctx context.Context ,aAPI proto.DRPCAgentClient26 )error {
987+ func (ctx context.Context ,aAPI proto.DRPCAgentClient27 )error {
988988bannersProto ,err := aAPI .GetAnnouncementBanners (ctx ,& proto.GetAnnouncementBannersRequest {})
989989if err != nil {
990990return xerrors .Errorf ("fetch service banner: %w" ,err )
@@ -1001,7 +1001,7 @@ func (a *agent) run() (retErr error) {
10011001// sending logs gets gracefulShutdownBehaviorRemain because we want to send logs generated by
10021002// shutdown scripts.
10031003connMan .startAgentAPI ("send logs" ,gracefulShutdownBehaviorRemain ,
1004- func (ctx context.Context ,aAPI proto.DRPCAgentClient26 )error {
1004+ func (ctx context.Context ,aAPI proto.DRPCAgentClient27 )error {
10051005err := a .logSender .SendLoop (ctx ,aAPI )
10061006if xerrors .Is (err ,agentsdk .ErrLogLimitExceeded ) {
10071007// we don't want this error to tear down the API connection and propagate to the
@@ -1020,7 +1020,7 @@ func (a *agent) run() (retErr error) {
10201020connMan .startAgentAPI ("report metadata" ,gracefulShutdownBehaviorStop ,a .reportMetadata )
10211021
10221022// resources monitor can cease as soon as we start gracefully shutting down.
1023- connMan .startAgentAPI ("resources monitor" ,gracefulShutdownBehaviorStop ,func (ctx context.Context ,aAPI proto.DRPCAgentClient26 )error {
1023+ connMan .startAgentAPI ("resources monitor" ,gracefulShutdownBehaviorStop ,func (ctx context.Context ,aAPI proto.DRPCAgentClient27 )error {
10241024logger := a .logger .Named ("resources_monitor" )
10251025clk := quartz .NewReal ()
10261026config ,err := aAPI .GetResourcesMonitoringConfiguration (ctx ,& proto.GetResourcesMonitoringConfigurationRequest {})
@@ -1067,7 +1067,7 @@ func (a *agent) run() (retErr error) {
10671067connMan .startAgentAPI ("handle manifest" ,gracefulShutdownBehaviorStop ,a .handleManifest (manifestOK ))
10681068
10691069connMan .startAgentAPI ("app health reporter" ,gracefulShutdownBehaviorStop ,
1070- func (ctx context.Context ,aAPI proto.DRPCAgentClient26 )error {
1070+ func (ctx context.Context ,aAPI proto.DRPCAgentClient27 )error {
10711071if err := manifestOK .wait (ctx );err != nil {
10721072return xerrors .Errorf ("no manifest: %w" ,err )
10731073}
@@ -1100,7 +1100,7 @@ func (a *agent) run() (retErr error) {
11001100
11011101connMan .startAgentAPI ("fetch service banner loop" ,gracefulShutdownBehaviorStop ,a .fetchServiceBannerLoop )
11021102
1103- connMan .startAgentAPI ("stats report loop" ,gracefulShutdownBehaviorStop ,func (ctx context.Context ,aAPI proto.DRPCAgentClient26 )error {
1103+ connMan .startAgentAPI ("stats report loop" ,gracefulShutdownBehaviorStop ,func (ctx context.Context ,aAPI proto.DRPCAgentClient27 )error {
11041104if err := networkOK .wait (ctx );err != nil {
11051105return xerrors .Errorf ("no network: %w" ,err )
11061106}
@@ -1115,8 +1115,8 @@ func (a *agent) run() (retErr error) {
11151115}
11161116
11171117// handleManifest returns a function that fetches and processes the manifest
1118- func (a * agent )handleManifest (manifestOK * checkpoint )func (ctx context.Context ,aAPI proto.DRPCAgentClient26 )error {
1119- return func (ctx context.Context ,aAPI proto.DRPCAgentClient26 )error {
1118+ func (a * agent )handleManifest (manifestOK * checkpoint )func (ctx context.Context ,aAPI proto.DRPCAgentClient27 )error {
1119+ return func (ctx context.Context ,aAPI proto.DRPCAgentClient27 )error {
11201120var (
11211121sentResult = false
11221122err error
@@ -1279,7 +1279,7 @@ func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context,
12791279
12801280func (a * agent )createDevcontainer (
12811281ctx context.Context ,
1282- aAPI proto.DRPCAgentClient26 ,
1282+ aAPI proto.DRPCAgentClient27 ,
12831283dc codersdk.WorkspaceAgentDevcontainer ,
12841284script codersdk.WorkspaceAgentScript ,
12851285) (err error ) {
@@ -1311,8 +1311,8 @@ func (a *agent) createDevcontainer(
13111311
13121312// createOrUpdateNetwork waits for the manifest to be set using manifestOK, then creates or updates
13131313// the tailnet using the information in the manifest
1314- func (a * agent )createOrUpdateNetwork (manifestOK ,networkOK * checkpoint )func (context.Context , proto.DRPCAgentClient26 )error {
1315- return func (ctx context.Context ,aAPI proto.DRPCAgentClient26 ) (retErr error ) {
1314+ func (a * agent )createOrUpdateNetwork (manifestOK ,networkOK * checkpoint )func (context.Context , proto.DRPCAgentClient27 )error {
1315+ return func (ctx context.Context ,aAPI proto.DRPCAgentClient27 ) (retErr error ) {
13161316if err := manifestOK .wait (ctx );err != nil {
13171317return xerrors .Errorf ("no manifest: %w" ,err )
13181318}
@@ -1401,6 +1401,7 @@ func (a *agent) updateCommandEnv(current []string) (updated []string, err error)
14011401"CODER_WORKSPACE_NAME" :manifest .WorkspaceName ,
14021402"CODER_WORKSPACE_AGENT_NAME" :manifest .AgentName ,
14031403"CODER_WORKSPACE_OWNER_NAME" :manifest .OwnerName ,
1404+ "CODER_WORKSPACE_ID" :manifest .WorkspaceID .String (),
14041405
14051406// Specific Coder subcommands require the agent token exposed!
14061407"CODER_AGENT_TOKEN" :a .client .GetSessionToken (),
@@ -2098,7 +2099,7 @@ const (
20982099
20992100type apiConnRoutineManager struct {
21002101logger slog.Logger
2101- aAPI proto.DRPCAgentClient26
2102+ aAPI proto.DRPCAgentClient27
21022103tAPI tailnetproto.DRPCTailnetClient24
21032104eg * errgroup.Group
21042105stopCtx context.Context
@@ -2107,7 +2108,7 @@ type apiConnRoutineManager struct {
21072108
21082109func newAPIConnRoutineManager (
21092110gracefulCtx ,hardCtx context.Context ,logger slog.Logger ,
2110- aAPI proto.DRPCAgentClient26 ,tAPI tailnetproto.DRPCTailnetClient24 ,
2111+ aAPI proto.DRPCAgentClient27 ,tAPI tailnetproto.DRPCTailnetClient24 ,
21112112)* apiConnRoutineManager {
21122113// routines that remain in operation during graceful shutdown use the remainCtx. They'll still
21132114// exit if the errgroup hits an error, which usually means a problem with the conn.
@@ -2140,7 +2141,7 @@ func newAPIConnRoutineManager(
21402141// but for Tailnet.
21412142func (a * apiConnRoutineManager )startAgentAPI (
21422143name string ,behavior gracefulShutdownBehavior ,
2143- f func (context.Context , proto.DRPCAgentClient26 )error ,
2144+ f func (context.Context , proto.DRPCAgentClient27 )error ,
21442145) {
21452146logger := a .logger .With (slog .F ("name" ,name ))
21462147var ctx context.Context